Skip to content
ZHIVEXDocs

Get started with Python

Install the async-first Python SDK and make a provider-backed request from server code.

PythonStable
Source baseline · reviewed Aug 20, 2026

The Python SDK provides an async-first foundation for text, streaming, structured output, agents, workflows, and provider routing.

1. Create an environment

Zhivex supports Python 3.11 and newer.

python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install zhivex-ai-sdk

Keep provider credentials in the server environment:

export OPENAI_API_KEY="your-server-side-key"

2. Generate text

Create quickstart.py:

import asyncio

from zhivex_ai import create_openai, generate_text


async def main() -> None:
    provider = create_openai()
    result = await generate_text(
        model=provider("gpt-5.6-terra"),
        prompt="Explain Zhivex AI SDK in one sentence.",
    )
    print(result.text)


if __name__ == "__main__":
    asyncio.run(main())

Run it:

python quickstart.py

3. Create an agent

An agent combines a model, instructions, tools, handoffs, and runtime policy:

import asyncio

from zhivex_ai import Agent, create_openai, run_agent


async def main() -> None:
    provider = create_openai()
    agent = Agent(
        name="support",
        instructions="Give concise, operational answers.",
        model=provider("gpt-5.6-terra"),
    )

    result = await run_agent(
        agent=agent,
        prompt="Summarize the next action for this case.",
    )
    print(result.text)


asyncio.run(main())

Use stream_text() for progressive foundation output and stream_agent() for lifecycle-aware agent streaming.

Choose the next path

Production code should import public APIs from zhivex_ai and isolate beta or provider-native features behind an application-owned service boundary.

Zhivex AI SDKsPortable by default. Native when needed.
Copied