For clean Markdown of any page, append .md to the page URL. For a complete documentation index, see https://docs.telcoflow.com/introduction/llms.txt. For full documentation content, see https://docs.telcoflow.com/introduction/llms-full.txt.

# 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 TelcoflowClient(config)`, register event handlers, and then call `run_forever()`.

## SANDBOX Mode (API Key Authentication)

```python
import asyncio
import os

from telcoflow_sdk import ActiveCall, TelcoflowClient, TelcoflowClientConfig
import telcoflow_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 = TelcoflowClientConfig.sandbox(
        api_key=os.getenv("WSS_API_KEY"),
        connector_uuid=os.getenv("WSS_CONNECTOR_UUID"),
        sample_rate=24000,
    )

    async with TelcoflowClient(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 telcoflow_sdk import TelcoflowClientConfig

config = TelcoflowClientConfig.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