dsh-agora 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +88 -0
  3. package/assets/agora/SKILL.md +113 -0
  4. package/assets/agora/references/cli/README.md +161 -0
  5. package/assets/agora/references/cli/automation.md +189 -0
  6. package/assets/agora/references/cli/doctor.md +129 -0
  7. package/assets/agora/references/cli/env.md +158 -0
  8. package/assets/agora/references/cli/install-auth.md +152 -0
  9. package/assets/agora/references/cli/projects.md +116 -0
  10. package/assets/agora/references/cli/quickstarts.md +117 -0
  11. package/assets/agora/references/cloud-recording/README.md +86 -0
  12. package/assets/agora/references/conversational-ai/README.md +285 -0
  13. package/assets/agora/references/conversational-ai/agent-client-toolkit-react.md +182 -0
  14. package/assets/agora/references/conversational-ai/agent-samples.md +101 -0
  15. package/assets/agora/references/conversational-ai/agent-toolkit-android.md +209 -0
  16. package/assets/agora/references/conversational-ai/agent-toolkit-ios.md +208 -0
  17. package/assets/agora/references/conversational-ai/agent-toolkit.md +201 -0
  18. package/assets/agora/references/conversational-ai/agent-ui-kit.md +63 -0
  19. package/assets/agora/references/conversational-ai/architecture.md +221 -0
  20. package/assets/agora/references/conversational-ai/auth-flow.md +154 -0
  21. package/assets/agora/references/conversational-ai/conversational-ai-studio.md +173 -0
  22. package/assets/agora/references/conversational-ai/go-sdk.md +184 -0
  23. package/assets/agora/references/conversational-ai/integration-from-quickstart.md +203 -0
  24. package/assets/agora/references/conversational-ai/python-sdk.md +122 -0
  25. package/assets/agora/references/conversational-ai/quickstarts.md +710 -0
  26. package/assets/agora/references/conversational-ai/server-custom-llm.md +45 -0
  27. package/assets/agora/references/conversational-ai/server-mcp.md +40 -0
  28. package/assets/agora/references/conversational-ai/server-sdk-rename.md +78 -0
  29. package/assets/agora/references/conversational-ai/server-sdks.md +128 -0
  30. package/assets/agora/references/doc-fetching.md +67 -0
  31. package/assets/agora/references/integration-patterns.md +201 -0
  32. package/assets/agora/references/mcp-tools.md +49 -0
  33. package/assets/agora/references/rtc/README.md +104 -0
  34. package/assets/agora/references/rtc/android.md +344 -0
  35. package/assets/agora/references/rtc/cross-platform-coordination.md +61 -0
  36. package/assets/agora/references/rtc/flutter.md +282 -0
  37. package/assets/agora/references/rtc/ios.md +306 -0
  38. package/assets/agora/references/rtc/nextjs.md +87 -0
  39. package/assets/agora/references/rtc/react-native.md +266 -0
  40. package/assets/agora/references/rtc/react.md +186 -0
  41. package/assets/agora/references/rtc/web.md +506 -0
  42. package/assets/agora/references/rtm/README.md +80 -0
  43. package/assets/agora/references/rtm/android.md +277 -0
  44. package/assets/agora/references/rtm/ios.md +231 -0
  45. package/assets/agora/references/rtm/web.md +348 -0
  46. package/assets/agora/references/server/README.md +22 -0
  47. package/assets/agora/references/server/tokens.md +74 -0
  48. package/assets/agora/references/server-gateway/README.md +80 -0
  49. package/assets/agora/references/server-gateway/linux-cpp.md +251 -0
  50. package/assets/agora/references/testing-guidance/SKILL.md +65 -0
  51. package/assets/agora/references/testing-guidance/completeness-gate.md +28 -0
  52. package/assets/agora/references/testing-guidance/convoai-rest.md +83 -0
  53. package/assets/agora/references/testing-guidance/mobile-rtm-and-renewal.md +109 -0
  54. package/assets/agora/references/testing-guidance/rtc-android.md +70 -0
  55. package/assets/agora/references/testing-guidance/rtc-ios.md +73 -0
  56. package/assets/agora/references/testing-guidance/rtc-react.md +51 -0
  57. package/assets/agora/references/testing-guidance/rtc-web.md +94 -0
  58. package/cordis.patch.yml +5 -0
  59. package/index.js +53 -0
  60. package/package.json +49 -0
@@ -0,0 +1,184 @@
1
+ ---
2
+ name: agora-server-sdk-go
3
+ description: |
4
+ Go SDK for Agora Conversational AI server-side integration. Use when the user is
5
+ building a Go backend to start/stop/manage ConvoAI agents. Triggers on:
6
+ agora-agents-go, github.com/AgoraIO/agora-agents-go, agentkit Go,
7
+ AgentSession Go, Go ConvoAI server, context.Context agent, go get agora agent.
8
+ license: MIT
9
+ metadata:
10
+ author: agora
11
+ version: '1.0.0'
12
+ ---
13
+
14
+ # ConvoAI Server SDK — Go
15
+
16
+ Go SDK for managing Agora Conversational AI agents from a server-side application. Wraps the ConvoAI REST API.
17
+
18
+ **Module:** `github.com/AgoraIO/agora-agents-go`
19
+ **Minimum Go version:** 1.21
20
+ **Repo:** <https://github.com/AgoraIO/agora-agents-go>
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ go get github.com/AgoraIO/agora-agents-go
26
+ ```
27
+
28
+ ## Quick Start
29
+
30
+ ```go
31
+ package main
32
+
33
+ import (
34
+ "context"
35
+ "fmt"
36
+ "log"
37
+ "time"
38
+
39
+ "github.com/AgoraIO/agora-agents-go/agentkit"
40
+ )
41
+
42
+ func main() {
43
+ client, err := agentkit.NewAgora(
44
+ agentkit.WithAppID("YOUR_APP_ID"),
45
+ agentkit.WithAppCertificate("YOUR_APP_CERTIFICATE"),
46
+ )
47
+ if err != nil {
48
+ log.Fatal(err)
49
+ }
50
+
51
+ agent := agentkit.NewAgent(
52
+ agentkit.WithName("my_agent"),
53
+ agentkit.WithInstructions("You are a helpful voice assistant."),
54
+ agentkit.WithLlm(agentkit.OpenAI{APIKey: "OPENAI_KEY"}),
55
+ agentkit.WithTts(agentkit.ElevenLabs{APIKey: "ELEVENLABS_KEY"}),
56
+ agentkit.WithStt(agentkit.Deepgram{APIKey: "DEEPGRAM_KEY"}),
57
+ )
58
+
59
+ session := agent.CreateSession(agentkit.SessionOptions{
60
+ Channel: "my-channel",
61
+ AgentUID: 0,
62
+ })
63
+
64
+ // Bound start time to 10 seconds
65
+ ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
66
+ defer cancel()
67
+
68
+ agentID, err := session.Start(ctx)
69
+ if err != nil {
70
+ log.Fatal(err)
71
+ }
72
+ fmt.Printf("Agent started: %s\n", agentID)
73
+
74
+ // Stop from the same process
75
+ if err := session.Stop(context.Background()); err != nil {
76
+ log.Fatal(err)
77
+ }
78
+ }
79
+ ```
80
+
81
+ ## context.Context Pattern
82
+
83
+ Every session method takes `ctx context.Context` as its first argument. Use this to bound operation time:
84
+
85
+ ```go
86
+ // Bound start — fails after 10s if the agent hasn't connected
87
+ ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
88
+ defer cancel()
89
+ agentID, err := session.Start(ctx)
90
+
91
+ // Stateless stop (different request handler) — use a fresh context
92
+ agentID, err := client.StopAgent(context.Background(), agentID)
93
+ ```
94
+
95
+ ## Error Handling
96
+
97
+ All methods return `(result, error)`. Idiomatic check:
98
+
99
+ ```go
100
+ agentID, err := session.Start(ctx)
101
+ if err != nil {
102
+ // handle error
103
+ return fmt.Errorf("start agent: %w", err)
104
+ }
105
+
106
+ // Stop returns nil for 404 (agent already stopped) — same graceful behavior as TypeScript/Python
107
+ err = session.Stop(context.Background())
108
+ if err != nil {
109
+ // genuine error — not "already stopped"
110
+ }
111
+ ```
112
+
113
+ ## Builder Pattern (Functional Options)
114
+
115
+ Go uses functional options (`With*` functions) instead of chained methods or object literals:
116
+
117
+ ```go
118
+ // TypeScript equivalent: new Agent({ name: "..." }).withLlm(new OpenAI({ ... }))
119
+ agent := agentkit.NewAgent(
120
+ agentkit.WithName("my_agent"),
121
+ agentkit.WithLlm(agentkit.OpenAI{APIKey: "OPENAI_KEY", Model: "gpt-4o"}),
122
+ agentkit.WithTts(agentkit.ElevenLabs{APIKey: "ELEVENLABS_KEY", VoiceID: "..."}),
123
+ )
124
+ ```
125
+
126
+ ## Session Status Constants
127
+
128
+ Check `session.Status` before calling methods:
129
+
130
+ | Constant | Meaning |
131
+ |----------|---------|
132
+ | `agentkit.StatusIdle` | Ready, not started |
133
+ | `agentkit.StatusStarting` | Start in progress |
134
+ | `agentkit.StatusRunning` | Active — `Stop`, `Say`, `Interrupt`, `Update` available |
135
+ | `agentkit.StatusStopping` | Stop in progress |
136
+ | `agentkit.StatusStopped` | Stopped — `Start` available again |
137
+ | `agentkit.StatusError` | Error — `Start` available again |
138
+
139
+ ## Token Helpers
140
+
141
+ ```go
142
+ // Generate an RTC token
143
+ rtcToken, err := agentkit.GenerateRTCToken(agentkit.TokenOptions{
144
+ AppID: "YOUR_APP_ID",
145
+ Certificate: "YOUR_CERTIFICATE",
146
+ Channel: "my-channel",
147
+ UID: 12345,
148
+ ExpiresIn: agentkit.ExpiresInHours(1),
149
+ })
150
+
151
+ // Generate a combined RTC+RTM ConvoAI token (for Token Auth mode)
152
+ convoAIToken, err := agentkit.GenerateConvoAIToken(agentkit.TokenOptions{
153
+ AppID: "YOUR_APP_ID",
154
+ Certificate: "YOUR_CERTIFICATE",
155
+ Channel: "my-channel",
156
+ Account: "agent-account",
157
+ ExpiresIn: agentkit.ExpiresInHours(1),
158
+ })
159
+ ```
160
+
161
+ ## Auth Modes
162
+
163
+ Same three modes as TypeScript and Python. Pass exactly one set of credentials:
164
+
165
+ ```go
166
+ // App Credentials (recommended) — SDK generates ConvoAI token per request
167
+ client, _ := agentkit.NewAgora(
168
+ agentkit.WithAppID("..."),
169
+ agentkit.WithAppCertificate("..."),
170
+ )
171
+
172
+ // Token Auth — pre-built combined RTC+RTM token; reused until you replace it
173
+ client, _ := agentkit.NewAgora(
174
+ agentkit.WithAppID("..."),
175
+ agentkit.WithAuthToken("YOUR_TOKEN"),
176
+ )
177
+
178
+ // Basic Auth — Customer ID + Secret; for testing only
179
+ client, _ := agentkit.NewAgora(
180
+ agentkit.WithAppID("..."),
181
+ agentkit.WithCustomerID("..."),
182
+ agentkit.WithCustomerSecret("..."),
183
+ )
184
+ ```
@@ -0,0 +1,203 @@
1
+ ---
2
+ name: conversational-ai-integration-from-quickstart
3
+ description: |
4
+ Existing-app integration workflow for Agora Conversational AI. Use when the user has a web, mobile, backend, or multi-project app and wants ConvoAI added. Detect the app shape with read-only inspection, clone or inspect the official quickstart as source, then produce a copy map before editing the existing app.
5
+ license: MIT
6
+ metadata:
7
+ author: agora
8
+ version: '1.0.0'
9
+ ---
10
+
11
+ # ConvoAI Integration From Quickstart
12
+
13
+ Use this file after [README.md](README.md) classifies a request as `integration`: the user has an existing app or multi-project workspace and wants Agora ConvoAI added.
14
+
15
+ The workflow is:
16
+
17
+ 1. **Detect the app shape** with read-only inspection.
18
+ 2. **Inspect the official quickstart source** in a separate folder or branch.
19
+ 3. **Map what to copy or adapt** before editing the existing app.
20
+ 4. **Integrate minimally** while preserving the app's architecture.
21
+
22
+ Do not edit the existing app until the official quickstart source has been inspected and a copy map exists. Runtime proof from [quickstarts.md](quickstarts.md) is required before claiming the integrated app works, but the quickstart's main role is to provide source-of-truth code rather than code generated from memory.
23
+
24
+ ## Detect First, Then Ask
25
+
26
+ Resolve required values in this order:
27
+
28
+ 1. **Session memory**: use what the user already said.
29
+ 2. **Workspace detection**: inspect files read-only.
30
+ 3. **Ask the user**: only for the missing value, after stating what was detected.
31
+
32
+ Explicit user statements win over detected values. The latest user statement wins on conflict.
33
+
34
+ ## Read-Only Detection Signals
35
+
36
+ Use file inspection only. Do not install, run, write config, or start app code during detection.
37
+
38
+ Initial scan scope:
39
+
40
+ - repo root
41
+ - first-level common dirs: `server/`, `api/`, `backend/`, `client/`, `web/`, `frontend/`, `mobile/`, `apps/*`, `packages/*`
42
+ - skip `node_modules`, `.git`, `dist`, `build`, `.next`, `coverage`
43
+
44
+ | Signal | Detects |
45
+ | --------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
46
+ | `package.json` deps | Frontend (`next`, `react`, `vue`, `svelte`, `astro`, `nuxt`, `remix`, `solid-js`) and backend (`express`, `fastify`, `koa`, `@nestjs/core`, `hono`) |
47
+ | `pyproject.toml` / `requirements.txt` | Python backend; framework via `fastapi`, `flask`, `django` |
48
+ | `go.mod` | Go backend; framework via `gin`, `echo`, `fiber` |
49
+ | `pom.xml` / `build.gradle` | Java backend |
50
+ | `Gemfile` | Ruby / Rails backend |
51
+ | `composer.json` | PHP backend |
52
+ | `.csproj` / `.sln` | .NET backend |
53
+ | `pubspec.yaml` | Flutter mobile |
54
+ | `Podfile` + `*.xcodeproj` | iOS native |
55
+ | `build.gradle` + `app/src/main/AndroidManifest.xml` | Android native |
56
+ | `pnpm-workspace.yaml`, `turbo.json`, `nx.json`, `lerna.json` | Monorepo roots and workspace apps |
57
+ | `.env`, `.env.local`, `.env.example` | Existing env naming conventions |
58
+ | `agora-rtc-sdk-ng`, `agora-rtm-sdk`, `agora-token`, `agora-rtc-react` | Existing Agora RTC/RTM/token wiring |
59
+ | `vercel.json`, `netlify.toml`, `Dockerfile`, `fly.toml` | Deployment hints only |
60
+
61
+ ## App Inventory Artifact
62
+
63
+ Emit `app_inventory` once during integration setup.
64
+
65
+ ```yaml
66
+ app_inventory:
67
+ workspace_layout: single # single | monorepo-configured | monorepo-implicit | client-backend-split | side-by-side
68
+ frontend:
69
+ framework: nextjs # nextjs | react | vue | svelte | astro | nuxt | remix | none | unknown
70
+ version: '15'
71
+ detected_from: package.json
72
+ backend:
73
+ language: python # node | python | go | java | ruby | php | csharp | none | unknown
74
+ framework: fastapi # express | fastapi | django | gin | spring | rails | none | unknown
75
+ detected_from: pyproject.toml
76
+ mobile:
77
+ platform: none # ios | android | flutter | react-native | none
78
+ projects:
79
+ - path: apps/web
80
+ role: frontend
81
+ framework: nextjs
82
+ - path: apps/api
83
+ role: backend
84
+ language: python
85
+ framework: fastapi
86
+ integration_targets:
87
+ - apps/api
88
+ - apps/web
89
+ agora_already_installed: false
90
+ baseline_track: python # python | nextjs | agent-samples | unsupported
91
+ detection_confidence: high # high | medium | low
92
+ ```
93
+
94
+ For `workspace_layout: single`, `projects` may be absent and `integration_targets` can be auto-populated. For multi-project workspaces, populate `integration_targets` from the user's answer to the listing question.
95
+
96
+ ## Detection Confidence
97
+
98
+ Confidence is `high` only when the target frontend and backend resolve to a single, documented framework with no conflicts.
99
+
100
+ | Case | Confidence | Action |
101
+ | --------------------------------------------------------------------- | ---------- | --------------------------------------------------------------------------------------------- |
102
+ | Single Next.js app, no conflicting backend | `high` | Pick `baseline_track: nextjs`; skip stack-preference intake. |
103
+ | Single Python backend + web client | `high` | Pick `baseline_track: python`; skip stack-preference intake. |
104
+ | Conflicting frontend frameworks, such as `next` and `vite` | `medium` | State both candidates and ask which is active. |
105
+ | React dependency but no framework or directory signal | `medium` | Ask whether it is Vite, CRA, Next.js, or custom. |
106
+ | Mixed Node and Python backend frameworks | `medium` | Ask which backend starts server-side actions. |
107
+ | Configured monorepo with multiple apps | `medium` | List apps and ask which are integration targets. |
108
+ | Implicit monorepo with multiple project files but no workspace config | `medium` | List candidate projects and ask which target to use. |
109
+ | Client/backend split, such as `client/` + `server/` | `medium` | Explain backend starts the agent and client joins RTC; ask whether to wire both. |
110
+ | Web plus mobile clients | `medium` | Ask which client or clients should join the channel. |
111
+ | Existing Agora RTC packages but no proven ConvoAI baseline | `medium` | State that RTC is already present, but baseline still runs separately first. |
112
+ | Empty or stub project files | `low` | Ask whether this is the correct project root or a fresh project. |
113
+ | Scan error, unreadable file, broken symlink, or encoding failure | `low` | Report which file failed and ask one focused question. Never guess. |
114
+ | Only unsupported backend stack, such as Rails, PHP, Java, or .NET | `medium` | Prove baseline in Python or Node, then use [auth-flow.md](auth-flow.md) for REST integration. |
115
+ | No actionable signals | `low` | Treat as likely `quickstart`, not `integration`. |
116
+
117
+ Before asking any question for `medium` or `low`, list what was detected. Do not ask blind.
118
+
119
+ Example:
120
+
121
+ ```text
122
+ I see:
123
+ - apps/web: Next.js
124
+ - apps/api: FastAPI
125
+ - apps/mobile: React Native
126
+
127
+ ConvoAI needs a backend to start the agent and at least one client to join the RTC channel. Should I wire `apps/api` + `apps/web`, or include `apps/mobile` too?
128
+ ```
129
+
130
+ ## Source Phase
131
+
132
+ Clone or open the official quickstart separately from the user's app:
133
+
134
+ - use a separate directory or branch
135
+ - do not scaffold a replacement app
136
+ - do not edit the existing app until the copy map exists
137
+ - use [quickstarts.md](quickstarts.md) for commands, state machine, prompt/config customization, and runtime proof
138
+ - if the user has an Agora Studio Agent ID, source the baseline from the official quickstart using the Studio-managed path from [conversational-ai-studio.md](conversational-ai-studio.md), then return here
139
+
140
+ If quickstart clone or source inspection fails, troubleshoot that first and pause integration edits. If runtime verification fails later, keep troubleshooting the quickstart/environment before claiming the existing-app integration works.
141
+
142
+ ## Copy Map Required
143
+
144
+ Before editing the existing app, produce a copy map from inspected quickstart files:
145
+
146
+ | Source quickstart file | Destination in existing app | Adaptation notes |
147
+ | ---------------------- | --------------------------- | -------------------------------------------------------------------- |
148
+ | `[quickstart path]` | `[existing app path]` | Env names, auth route, token generation, client hook, RTC/RTM events |
149
+
150
+ Allowed to copy or adapt after baseline:
151
+
152
+ - ConvoAI session lifecycle
153
+ - auth and token flow
154
+ - RTC/RTM channel wiring
155
+ - event handling for agent state, metrics, errors, and transcripts
156
+ - minimal UI controls needed to start, stop, and observe the agent
157
+
158
+ Forbidden before source alignment:
159
+
160
+ - replacing the user's app architecture
161
+ - creating a fresh standalone app in the user's repo
162
+ - using undocumented commands or command variants
163
+ - adding new server routes, client hooks, or UI code before the copy map exists
164
+
165
+ ## Integration Completion Gates
166
+
167
+ Track these after source alignment. `baseline_verified` may remain false while the agent prepares the copy map or adapts quickstart-derived code, but it must be true before the agent claims the integration works.
168
+
169
+ ```yaml
170
+ integration_gate:
171
+ source_inspected: true
172
+ baseline_verified: false
173
+ copy_map_approved: false
174
+ integration_compiles: false
175
+ agent_start_stop_in_app: false
176
+ voice_roundtrip_verified: false
177
+ ```
178
+
179
+ - `source_inspected`: official quickstart files were cloned/opened and used as source for the copy map.
180
+ - `baseline_verified`: `baseline_gate` from [quickstarts.md](quickstarts.md) is all true.
181
+ - `copy_map_approved`: user approved the map, or explicitly said to proceed.
182
+ - `integration_compiles`: existing app builds or type-checks with the integration.
183
+ - `agent_start_stop_in_app`: existing app can start and stop the agent.
184
+ - `voice_roundtrip_verified`: user can speak from the existing app and hear agent audio.
185
+
186
+ ## Integration Response Template
187
+
188
+ For integration replies, be quiet unless state changes or something is blocked. Before runtime proof, make clear that the app is being adapted from quickstart source; do not claim it works until `voice_roundtrip_verified` is true.
189
+
190
+ When status is needed, include:
191
+
192
+ ```yaml
193
+ current_gate:
194
+ baseline_verified: true
195
+ copy_map_approved: false
196
+ next_command: '[exact command or none]'
197
+ files_to_copy_or_adapt_next:
198
+ - source: '[quickstart file]'
199
+ destination: '[existing app file]'
200
+ blocked: 'copy_map_approved is false; produce or approve the copy map first'
201
+ ```
202
+
203
+ Use user-facing words "baseline" and "integration"; do not say "Track A" or "Track B" in chat.
@@ -0,0 +1,122 @@
1
+ ---
2
+ name: agora-server-sdk-python
3
+ description: |
4
+ Python SDK for Agora Conversational AI server-side integration. Use when the user is
5
+ building a Python backend to start/stop/manage ConvoAI agents. Triggers on:
6
+ agora-agents Python, agent_server_sdk_python, AsyncAgora, AsyncAgentSession,
7
+ pip install agora-agents, Python ConvoAI server, agora_agent.
8
+ license: MIT
9
+ metadata:
10
+ author: agora
11
+ version: '1.1.0'
12
+ ---
13
+
14
+ # ConvoAI Server SDK — Python
15
+
16
+ Python SDK for managing Agora Conversational AI agents from a server-side application. Wraps the ConvoAI REST API.
17
+
18
+ **Package:** `agora-agents`
19
+ **Repo:** <https://github.com/AgoraIO-Conversational-AI/agent-server-sdk-python>
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ pip install agora-agents
25
+ # or with Poetry:
26
+ poetry add agora-agents
27
+ ```
28
+
29
+ ## Sync vs Async
30
+
31
+ Two parallel APIs exist:
32
+
33
+ | Use case | Classes |
34
+ |----------|---------|
35
+ | Sync (scripts, Flask, Django) | `Agora`, `AgentSession` |
36
+ | Async (FastAPI, aiohttp, asyncio apps) | `AsyncAgora`, `AsyncAgentSession` |
37
+
38
+ **Rule:** use the async variants in any async framework. Mixing sync calls into an async event loop blocks it.
39
+
40
+ ## Async Example
41
+
42
+ ```python
43
+ import asyncio
44
+ from agora_agent import AsyncAgora, Agent
45
+ from agora_agent.agentkit import OpenAI, ElevenLabsTTS, DeepgramSTT
46
+
47
+ async def main():
48
+ client = AsyncAgora(
49
+ app_id="YOUR_APP_ID",
50
+ app_certificate="YOUR_APP_CERTIFICATE", # App Credentials mode
51
+ )
52
+
53
+ agent = (
54
+ Agent(name="my_agent", instructions="You are a helpful voice assistant.")
55
+ .with_stt(DeepgramSTT(api_key="DEEPGRAM_KEY"))
56
+ .with_llm(OpenAI(api_key="OPENAI_KEY"))
57
+ .with_tts(ElevenLabsTTS(api_key="ELEVENLABS_KEY"))
58
+ )
59
+
60
+ session = agent.create_session(channel="my-channel", agent_uid=0)
61
+
62
+ agent_id = await session.start()
63
+ print(f"Agent started: {agent_id}")
64
+
65
+ # Later — stop from the same process
66
+ await session.stop()
67
+
68
+ # Or stop from a stateless handler (different request)
69
+ await client.stop_agent(agent_id)
70
+
71
+ asyncio.run(main())
72
+ ```
73
+
74
+ For the first-success default combo, use the quickstart guidance in [quickstarts.md](quickstarts.md). For the current provider matrix and vendor-specific configuration details, use the official live ConvoAI provider docs rather than maintaining a local copy in this SDK usage file.
75
+
76
+ ## Naming Conventions
77
+
78
+ All method names are snake_case — same API surface as TypeScript but with Python naming:
79
+
80
+ | TypeScript | Python |
81
+ |-----------|--------|
82
+ | `session.start()` | `session.start()` |
83
+ | `session.stop()` | `session.stop()` |
84
+ | `session.getHistory()` | `session.get_history()` |
85
+ | `session.getInfo()` | `session.get_info()` |
86
+ | `client.generateRtcToken()` | `client.generate_rtc_token()` |
87
+
88
+ ## Deprecation Warnings
89
+
90
+ Three patterns generate `DeprecationWarning` at runtime. Suppress them by migrating to the replacement:
91
+
92
+ | Deprecated | Replacement |
93
+ |-----------|-------------|
94
+ | `TurnDetection.type` field | Use `config.start_of_speech` / `config.end_of_speech` directly |
95
+ | `InterruptMode` on standard LLM sessions | Only valid for MLLM with `server_vad` or `semantic_vad` |
96
+ | `Eagerness` parameter | MLLM-only — remove from standard LLM configs |
97
+
98
+ ## Debug Logging
99
+
100
+ ```python
101
+ client = AsyncAgora(
102
+ app_id="YOUR_APP_ID",
103
+ app_certificate="YOUR_APP_CERTIFICATE",
104
+ debug=True, # enables request/response logging
105
+ )
106
+ # Auth headers are redacted automatically — logs show "Basic ***", not the actual value
107
+ ```
108
+
109
+ ## Auth Modes
110
+
111
+ Same three modes as TypeScript. Pass exactly one:
112
+
113
+ ```python
114
+ # App Credentials (recommended) — SDK generates ConvoAI token per request
115
+ client = AsyncAgora(app_id="...", app_certificate="...")
116
+
117
+ # Token Auth — you supply a pre-built combined RTC+RTM token; reused until replaced
118
+ client = AsyncAgora(app_id="...", auth_token="YOUR_TOKEN")
119
+
120
+ # Basic Auth — Customer ID + Secret; for testing only
121
+ client = AsyncAgora(app_id="...", customer_id="...", customer_secret="...")
122
+ ```