> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.agentao.com/llms.txt.
> For full documentation content, see https://docs.agentao.com/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.agentao.com/_mcp/server.

# Quick Start

For `0.24.0`, the recommended pattern is to create the client config with a factory helper, start the client with `async with AgenTaoClient(config)`, register event handlers, and then call `run_forever()`.

## SANDBOX Mode (API Key Authentication)

```python
import asyncio
import os

from agentao_sdk import ActiveCall, AgenTaoClient, AgenTaoClientConfig
import agentao_sdk.events as events

async def handle_call(call: ActiveCall):
    @call.on(events.CALL_TERMINATED)
    def on_terminated():
        print("Call terminated")

    await call.answer()

    async for audio_chunk in call.audio_stream():
        response_audio = await ai_model.process(audio_chunk)
        await call.send_audio(response_audio)

    # Because this flow never calls connect(), close() ends the call.
    await call.close()

async def main():
    config = AgenTaoClientConfig.sandbox(
        api_key=os.getenv("WSS_API_KEY"),
        connector_uuid=os.getenv("WSS_CONNECTOR_UUID"),
        sample_rate=24000,
    )

    async with AgenTaoClient(config) as client:
        @client.on(events.INCOMING_CALL)
        async def on_incoming_call(call: ActiveCall):
            await handle_call(call)

        await client.run_forever()

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

## Separate Receive and Send Pipelines

If your application needs to read from `audio_stream()` and write with `send_audio()` independently, use `asyncio.TaskGroup` and a queue so neither side blocks the other.

## PROD Mode (mTLS Authentication)

```python
from agentao_sdk import AgenTaoClientConfig

config = AgenTaoClientConfig.production(
    cert_path="/etc/certs/client.pem",
    key_path="/etc/certs/client.key",
    sample_rate=24000,
)
```

## Next Steps

- [Architecture](/concepts/architecture) - Understand the dual-connection model
- [Call Commands](/concepts/call-commands) - Learn the core commands used by `ActiveCall`
- [Call States](/concepts/call-states-and-lifecycle) - Understand the call lifecycle
- [API Reference](/reference/api-reference) - Review the full public surface