> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spatius.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# TEN Framework Extension

> Configure spatius_avatar_python in a TEN Framework graph.

## Configure

Get the App ID and API Key from [Apps](https://app.spatius.ai/apps) (**Developer → API Key**) and the Avatar ID from the [Avatar Library](https://app.spatius.ai/avatars/library). Keep the Spatius API Key and Agora App Certificate in the TEN environment.

```json theme={null}
{
  "params": {
    "spatius_api_key": "${env:SPATIUS_API_KEY|}",
    "spatius_app_id": "${env:SPATIUS_APP_ID|}",
    "spatius_avatar_id": "your-spatius-avatar-id",
    "agora_appid": "${env:AGORA_APP_ID|}",
    "agora_appcert": "${env:AGORA_APP_CERTIFICATE|}",
    "agora_channel": "your-agora-channel",
    "agora_uid": "2001",
    "agora_token": "${env:AGORA_TOKEN|}",
    "region": "us-west",
    "sample_rate": 24000,
    "session_expire_minutes": 30
  }
}
```

Provide either `agora_token` or `agora_appcert`. Keep the App Certificate on the backend, give the avatar publisher its own UID, and match `sample_rate` to the TTS output. See [Regions](/api-reference/regions) for optional region values.

## Wire the graph

Place `spatius_avatar_python` after the component that produces final avatar speech audio.

| TEN input | Purpose |
| - | - |
| `audio_frame_in: pcm_frame` | Sends PCM avatar speech audio to Spatius. |
| `data_in: tts_audio_end` | Marks the end of the current response. |
| `cmd_in: flush` | Interrupts the current response. |

The extension and every client must join the same Agora channel. Give the avatar publisher, conversational agent, and each client a different UID. Generate client RTC tokens on your backend; never put the Agora App Certificate in the app.

## Next steps

<CardGroup cols={2}>
  <Card title="Client" icon="globe" href="/agora-convoai/client" />

  <Card title="Audio" icon="waveform" href="/concepts/audio" />
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.