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,710 @@
1
+ ---
2
+ name: conversational-ai-quickstarts
3
+ description: |
4
+ Locked quickstart flow for Agora Conversational AI. Use when no working baseline exists.
5
+ BLOCKING: Do not generate ConvoAI code from memory, scaffold replacement projects, or propose custom architecture before inspecting the official quickstart source. Runtime proof validates the user's environment: quickstart_repo_cloned, official_start_command_run, agent_join_verified, rtc_client_connected.
6
+ SAMPLE INTEGRITY: Run official sample commands verbatim. Do not substitute startup commands or replace the sample. Internally check baseline_gate before every actionable reply; show status only on first reply, gate flips, blocked actions, or user status requests.
7
+ license: MIT
8
+ metadata:
9
+ author: agora
10
+ version: '1.5.0'
11
+ ---
12
+
13
+ # Conversational AI Quickstart
14
+
15
+ Use this file for `quickstart` and `integration` mode from [README.md](README.md).
16
+
17
+ ## Working-Baseline Rule
18
+
19
+ A **working ConvoAI baseline** means the developer has already started an Agora ConvoAI agent successfully and the client can join the same RTC channel and interact with it.
20
+
21
+ The following do **not** count as a working baseline:
22
+
23
+ - only RTC code exists
24
+ - a sample repo is cloned but the agent has never started successfully
25
+ - environment variables are present but unverified
26
+ - the user only knows the desired backend language or framework
27
+
28
+ If the user already has a working baseline, exit this file and route back through [README.md](README.md).
29
+
30
+ ## Quickstart Source and Runtime Proof
31
+
32
+ ### Official repo (Path A)
33
+
34
+ For this flow, pick the correct official template by stack:
35
+
36
+ - Python baseline (`agent-quickstart-python`) with Bun, using
37
+ `https://github.com/AgoraIO-Conversational-AI/agent-quickstart-python`
38
+ - Next.js baseline (`agent-quickstart-nextjs`) with pnpm, using
39
+ `https://github.com/AgoraIO-Conversational-AI/agent-quickstart-nextjs`
40
+ - Go baseline (`agent-quickstart-go`) with Makefile-based startup, using the official Go quickstart template for the `go` template family in Agora CLI.
41
+
42
+ Use this official sample as-is and only adapt documented fields once clone + runtime checks pass.
43
+
44
+ ### Required env mapping by template
45
+
46
+ Use template-specific env files/keys for the selected official template:
47
+
48
+ - Next.js quickstart (`agent-quickstart-nextjs`):
49
+ - write `.env.local`
50
+ - `AGORA_APP_ID` -> `NEXT_PUBLIC_AGORA_APP_ID`
51
+ - `AGORA_APP_CERTIFICATE` -> `NEXT_AGORA_APP_CERTIFICATE`
52
+ - Python quickstart (`agent-quickstart-python`):
53
+ - write `server/.env`
54
+ - `AGORA_APP_ID` -> `APP_ID`
55
+ - `AGORA_APP_CERTIFICATE` -> `APP_CERTIFICATE`
56
+ - Go quickstart (`agent-quickstart-go`):
57
+ - write `server-go/.env`
58
+ - `AGORA_APP_ID` -> `APP_ID`
59
+ - `AGORA_APP_CERTIFICATE` -> `APP_CERTIFICATE`
60
+
61
+ The quickstart is the source of truth for code shape. The agent does not need to prove Agora's official quickstart works in the abstract before reading or adapting it. It does need runtime proof before claiming the user's environment, Agora project, and customized flow work end to end.
62
+
63
+ Track runtime proof with this artifact:
64
+
65
+ ```yaml
66
+ baseline_gate:
67
+ quickstart_repo_cloned: false # official sample cloned at a known path
68
+ official_start_command_run: false # documented start command run verbatim
69
+ agent_join_verified: false # agent reached RUNNING in the RTC channel
70
+ rtc_client_connected: false # client joined the same channel and heard agent audio
71
+ ```
72
+
73
+ If `quickstart_repo_cloned` is false, the following are blocked:
74
+
75
+ - `/join` payload generation from memory
76
+ - SDK implementation files in the user's repo
77
+ - custom file structures or new app scaffolds
78
+ - existing-app edits that are not backed by a copy map sourced from the official quickstart
79
+
80
+ After the official quickstart source is cloned and inspected, the agent may:
81
+
82
+ - update the cloned quickstart's agent prompt, greeting, persona, scenario details, or documented join/config fields to match the user's requested agent
83
+ - produce a copy map for an existing app from the inspected quickstart files
84
+ - adapt only the mapped quickstart-derived pieces into the user's app after copy-map approval
85
+
86
+ Do not change the sample's architecture, token flow, env names, lifecycle, or documented commands unless the official quickstart source itself requires a minimal upstream-shaped fix.
87
+
88
+ The baseline gate is complete only when the sample-ready gate succeeds: app opens, conversation starts, the agent joins the RTC channel, and the user can speak and hear TTS back.
89
+
90
+ ## Response Status Rules
91
+
92
+ Before every actionable reply, reconcile the current `baseline_gate` state with the action you are about to take. This internal check is mandatory but is not user-visible by default.
93
+
94
+ Show status only in these cases:
95
+
96
+ | Trigger | Format | Fields |
97
+ | ------------------------------------- | ----------- | --------------------------------------------------------------- |
98
+ | First ConvoAI reply | Full block | `official_template`, `next_command`, `baseline_gate`, `blocked` |
99
+ | Gate flips from false to true | One line | `baseline_gate: 2/4 -> 3/4; next: <command>` |
100
+ | Blocked action | Short block | False gate field plus the command that unblocks it |
101
+ | User asks "where are we?" or "status" | Full block | Same as first-reply format |
102
+ | Routine command, Q&A, explanation | No footer | None |
103
+
104
+ Use checkmark glyphs in user-visible baseline status:
105
+
106
+ ```text
107
+ baseline_gate:
108
+ ✓ quickstart_repo_cloned
109
+ ✗ official_start_command_run
110
+ ✗ agent_join_verified
111
+ ✗ rtc_client_connected
112
+ ```
113
+
114
+ Tone rules:
115
+
116
+ - Do not use the phrase "policy violation" in user-visible replies. Say what is blocked and what command unblocks it.
117
+ - Do not use "Track A" or "Track B" in user-visible replies. Say "baseline" and "integration."
118
+ - Keep the footer silent on routine progress; show it only when it changes something for the user.
119
+
120
+ ## Recovery Rule
121
+
122
+ If the agent has already deviated, stop the custom path and pivot back to the official sample.
123
+
124
+ Deviation triggers:
125
+
126
+ - generated a `/join` payload from memory before inspecting quickstart source
127
+ - created SDK implementation files in the user's repo before inspecting quickstart source and producing a copy map
128
+ - created a new `package.json`, `routes/`, or scaffold for a ConvoAI app instead of adapting the official quickstart source
129
+ - changed documented sample command semantics, such as replacing the README start command with a custom wrapper
130
+ - attempted to fix `[ERR_PNPM_IGNORED_BUILDS]` or configure pnpm build approvals instead of proceeding to the documented start command
131
+ - wrote `.env` / `.env.local` with literal `$AGORA_APP_ID` or `$AGORA_APP_CERTIFICATE` strings instead of expanded credential values
132
+
133
+ Recovery response:
134
+
135
+ 1. Acknowledge the deviation in plain language.
136
+ 2. Show the current `baseline_gate` with incomplete fields.
137
+ 3. Give the exact next official sample command.
138
+ 4. Do not continue custom edits until source alignment is restored. Runtime proof is still required before claiming the flow works.
139
+
140
+ ## Sequence
141
+
142
+ Follow this exact user-visible order:
143
+
144
+ 1. Product intro in plain language
145
+ 2. Intake — confirm preferred stack (`python` or `node/ts`) and confirm whether the agent is allowed to install/upgrade missing tools
146
+ 3. Environment check — verify runtime dependencies are installed
147
+ 4. Project-readiness checkpoint — use the CLI directly to verify and fix
148
+ 5. Vendor-path confirmation — **skip if the user has not mentioned BYOK, providers, or Studio Agent ID; defaults apply automatically**
149
+ 6. Vendor selection, only if the user asks for the current provider list or chooses a non-default path
150
+ 7. Studio Agent ID confirmation, only if the user wants to reuse an agent configured in Agora Studio
151
+ 8. Structured quickstart spec
152
+
153
+ ## Interaction Rules
154
+
155
+ - One decision group per turn. Do not ask credentials and vendor path in the same reply.
156
+ - Skip anything the user already answered.
157
+ - Resolve required values in this order: session memory, read-only workspace detection, then one focused question. Explicit user statements win over detected values, and the latest user statement wins on conflict. Do not re-ask for values the user already provided.
158
+ - **Auto-skip `vendor_defaults`**: if the user has not mentioned BYOK, vendor API keys, a specific provider, or a Studio Agent ID, skip the vendor gate entirely and use the defaults. Do not ask about providers when the user just wants the fastest path.
159
+ - Infer obvious context from the user's stack or repository description.
160
+ - Mirror the user's language.
161
+ - While quickstart source is unresolved, do **not** generate `/join` payloads, SDK code, custom file structures, clone commands, or repo adaptation plans from memory.
162
+ - While quickstart is unresolved, read only this file and [README.md](README.md).
163
+ - If the user asks to use the CLI to speed up onboarding, keep the request inside this quickstart flow. The CLI is already the default readiness path, so continue normally.
164
+ - Unless the user explicitly asks for BYOK (bring your own key) or a different provider stack, anchor on the defaults first — no vendor API keys needed.
165
+ - For non-default provider selection, fetch the official current provider docs before confirming support or generating config details.
166
+ - If the user already has an **Agora Studio Agent ID** from `https://console.agora.io/studio/agents`, treat that as a separate quickstart branch. Do not re-ask STT/LLM/TTS provider choices unless the user explicitly wants to replace the Studio-managed config.
167
+ - If stack preference is unknown, ask one short intake question before selecting the baseline sample.
168
+ - If stack preference is still unspecified after intake, default to `agent-quickstart-python`.
169
+ - When starting from scratch, customize the cloned quickstart's agent prompt, greeting, persona, scenario details, or documented join/config fields to match the user's requested agent. Keep architecture, env names, token flow, lifecycle, and documented commands intact.
170
+
171
+ ## Industry-Standard Execution Policy
172
+
173
+ Apply this policy for quickstart setup actions:
174
+
175
+ 1. Detect first: run read-only checks and report what is installed.
176
+ 2. Recommend second: propose the best baseline path from user preference + detected tools.
177
+ 3. Confirm scope before mutate: ask once for bounded quickstart setup approval.
178
+ 4. Execute exactly: once confirmed, run the documented command without substituting variants.
179
+ 5. Report clearly: summarize what changed and what remains blocked.
180
+
181
+ Guardrails:
182
+
183
+ - Never silently install or upgrade system tools.
184
+ - Never assume language/runtime preference when the user has already stated one.
185
+ - Prefer least-surprise behavior: explicit approval for machine changes, deterministic commands, and transparent outcomes.
186
+
187
+ Approved quickstart setup scope covers:
188
+
189
+ - installing or upgrading missing non-system setup tools needed for the selected baseline (`bun`, `pnpm`/`npm`, `agora`)
190
+ - running `agora login`
191
+ - selecting an existing suitable project
192
+ - enabling required Agora features on the selected project
193
+ - writing or updating the selected sample's expected env file
194
+ - updating the selected sample's documented agent prompt, greeting, persona, scenario details, or join/config fields requested by the user
195
+ - installing the selected sample's dependencies
196
+ - starting the selected sample
197
+
198
+ Ask again before:
199
+
200
+ - creating a new Agora project
201
+ - deleting files, uninstalling packages, or removing projects
202
+ - overwriting env files with `--overwrite`
203
+ - printing or exposing secrets in chat
204
+ - installing or upgrading system runtimes such as Node.js or Python
205
+ - changing files or settings outside the selected quickstart repo and selected Agora project
206
+
207
+ ## Known Non-Blocking Warnings
208
+
209
+ Exit code alone does not determine whether to proceed. Read command output and match it against known non-blocking patterns before treating a non-zero exit as failure requiring remediation.
210
+
211
+ ### Node/TS baseline (`agent-quickstart-nextjs`)
212
+
213
+ After `pnpm install`:
214
+
215
+ - **`[ERR_PNPM_IGNORED_BUILDS]`** is not a blocking error. The sample's dev script uses `next dev --webpack` explicitly — esbuild, sharp, and unrs-resolver build scripts are not required for the dev path. If packages were added and the only non-zero exit is this warning, proceed directly to `pnpm dev`.
216
+ - If `pnpm dev` re-runs an install check and prints the same ignored-builds warning, treat that as non-blocking too — run the README `pnpm dev` again or start the documented dev script from the quickstart directory. Do not stop before a dev server is listening.
217
+ - Do not run `pnpm approve-builds`, `pnpm config set onlyBuiltDependencies`, `pnpm dev --ignore-scripts`, edit `package.json` with pnpm config fields, create `pnpm.yaml`, or change global pnpm build-approval settings to resolve this warning during first-success setup.
218
+
219
+ ## Command Integrity Under Environment Restrictions
220
+
221
+ For the first-success gate, treat the sample README commands as exact.
222
+
223
+ If a documented command fails because of sandbox, permission, port-binding, filesystem, or network restrictions:
224
+
225
+ 1. Do **not** replace the command with an equivalent variant.
226
+ 2. Do **not** add flags, env vars, host overrides, alternate entrypoints, or custom wrappers.
227
+ 3. Re-run the exact documented command with required escalation or approval if available.
228
+ 4. If escalation is unavailable or denied, stop and report that the baseline is blocked by the execution environment, not by the sample itself.
229
+ 5. Do **not** continue to customization until the sample has been validated with the documented command.
230
+
231
+ Forbidden substitutions include:
232
+
233
+ - `pnpm dev` → `pnpm exec next dev ...`
234
+ - `npm run dev` → `next dev ...`
235
+ - README clone/start commands → custom shell variants that change the command semantics
236
+
237
+ ## Failure Attribution
238
+
239
+ If the documented sample command fails before app code runs and the error indicates a local execution restriction, classify it as an environment constraint.
240
+
241
+ Typical signals include:
242
+
243
+ - `EPERM`
244
+ - `EACCES`
245
+ - blocked `listen` / `bind`
246
+ - blocked `chmod` / filesystem permission errors
247
+ - sandbox-denied network or local resource access
248
+
249
+ Do **not** reinterpret these failures as sample misconfiguration and do **not** change the command to work around them.
250
+
251
+ ### Install warnings (Node/TS baseline)
252
+
253
+ When `pnpm install` exits non-zero:
254
+
255
+ - If the output is caused solely by `[ERR_PNPM_IGNORED_BUILDS]`, classify it as a **warning**, not a failure. Continue to the next documented command (`pnpm dev`). Do not attempt to resolve it before starting the app.
256
+ - Do not treat this warning as sample misconfiguration or as proof that dependencies failed to install.
257
+
258
+ ## First-Success Readiness Layers
259
+
260
+ Use three readiness layers during quickstart:
261
+
262
+ - **Control-plane ready** — login works, the project resolves, App ID exists, App Certificate can be exported through the verified CLI surface, required features are enabled, and `agora project doctor` is not blocking.
263
+ - **Runtime ready** — services are actually usable. In practice, RTM enablement may lag behind control-plane state; after enablement, allow bounded wait/retry for up to about 5 minutes before deciding the project still needs intervention.
264
+ - **Sample ready** — the official sample installs, env is populated, the app starts, the browser can open, the user can press `Try it now`, the agent joins the RTC channel, and the frontend does not crash.
265
+
266
+ `agora project doctor` only proves **control-plane ready**. It does not prove runtime or sample readiness.
267
+
268
+ ## CLI-Driven Readiness Check
269
+
270
+ The project readiness step requires the agent to directly execute Agora CLI commands to verify and fix prerequisites. Do not ask the user to run CLI commands themselves and do not offer manual alternatives. The agent checks directly; mutating actions may proceed inside the approved quickstart setup scope.
271
+
272
+ The CLI covers:
273
+
274
+ - login / auth status
275
+ - current project selection
276
+ - project env export
277
+ - official quickstart cloning and repo-local binding
278
+ - template-aware quickstart env writing
279
+ - feature enablement
280
+ - App ID presence, App Certificate presence, and other basic project checks
281
+ - `agora project doctor` readiness checks
282
+
283
+ Use the CLI in this order:
284
+
285
+ 1. For a new official quickstart, prefer `agora init` when it can clone, bind the project, and write env safely.
286
+ 2. For an existing official quickstart, use `agora quickstart env write` to seed env files.
287
+ 3. Use `agora project env --with-secrets --json` only for manual mapping flows that need raw credential values.
288
+ 4. Use `project show --json` only for project metadata inspection.
289
+
290
+ Do **not** treat a healthy doctor result as a proven ConvoAI baseline.
291
+
292
+ For command details, route to the CLI references:
293
+
294
+ - [../cli/README.md](../cli/README.md)
295
+ - [../cli/quickstarts.md](../cli/quickstarts.md)
296
+ - [../cli/env.md](../cli/env.md)
297
+ - [../cli/projects.md](../cli/projects.md)
298
+ - [../cli/doctor.md](../cli/doctor.md)
299
+
300
+ After the CLI readiness step is resolved, return to this quickstart and continue from the same readiness checkpoint.
301
+
302
+ ## First-Success Baseline Selection
303
+
304
+ Select the baseline sample from user preference first, then installed tools:
305
+
306
+ - If user explicitly wants Python (or has no preference): use `agent-quickstart-python`.
307
+ - If user explicitly wants Node/TypeScript and has Node 22+ plus pnpm 8+ (preferred) or npm fallback: use `agent-quickstart-nextjs`.
308
+ - If user asks for Go as the final backend, still complete one official quickstart baseline first, then route to [go-sdk.md](go-sdk.md) for backend implementation.
309
+
310
+ If no stack preference is provided, default to:
311
+
312
+ - **Repo:** <https://github.com/AgoraIO-Conversational-AI/agent-quickstart-python> _(Python server + React frontend)_
313
+
314
+ 1. Runtime prerequisites
315
+ 1.1 Python baseline: Bun (package manager & script runner) + Python 3.8+
316
+ 1.2 Node/TS baseline: Node.js 22+ + pnpm 8+ preferred; fallback to npm when pnpm is unavailable and the sample supports npm
317
+ 2. CLI preflight
318
+ 2.1 Complete [CLI readiness](../cli/README.md#cli-readiness-agents) — block if below `0.1.7` or PATH resolves an old binary
319
+ 2.2 Log in: `agora login`
320
+ 2.3 Verify CLI version with `agora version` (minimum `0.2.1`, floor `0.1.7`)
321
+ 2.4 Prefer `agora init <name> --template <template> --json` where `<template>` matches the selected baseline (`python` or `nextjs`)
322
+ 2.5 For an existing official quickstart, use `agora quickstart env write <repo> --project <project>` — not `project env write`
323
+ 2.6 If decomposing the flow, prefer the current selected project only if it is directly usable for first-success
324
+ 2.7 Otherwise select another directly usable project, or ask before creating a new dedicated token-ready project
325
+ 2.8 Ensure `rtc`, `rtm`, and `convoai` are enabled for the first-success path
326
+ 2.9 Use `agora project env --with-secrets --json` only when direct raw credential values are explicitly needed outside `init` / `quickstart env write`
327
+ 2.10 Check `agora project doctor`
328
+ 2.11 If RTM was just enabled, allow bounded wait/retry before concluding runtime failure
329
+ 3. Official sample baseline
330
+ 3.1 Clone the selected official quickstart (`agent-quickstart-python`, `agent-quickstart-nextjs`, or `agent-quickstart-go`) directly or through `agora init`
331
+ 3.2 Install and start with the selected sample's documented commands:
332
+ - Python baseline: `bun install` then `bun run dev`
333
+ - Node/TS baseline: run `pnpm install` then `pnpm dev` when pnpm is available; otherwise fall back to `npm install` then `npm run dev` when the sample supports npm
334
+ 3.3 Ensure the expected env file is present:
335
+ - Python baseline: `server/.env` with `APP_ID` + `APP_CERTIFICATE`
336
+ - Node/TS baseline: `.env.local` with `NEXT_PUBLIC_AGORA_APP_ID` + `NEXT_AGORA_APP_CERTIFICATE`
337
+ - Go baseline: `server-go/.env` with `APP_ID` + `APP_CERTIFICATE`
338
+ (`agora quickstart env write` is the default seeding path)
339
+ 3.4 Do not rename the sample's env variables during first success
340
+ 4. Success gate
341
+ 4.1 App loads at the sample's documented local URL
342
+ 4.2 User can start a conversation from the UI
343
+ 4.3 Agent joins the RTC channel
344
+ 4.4 User can speak to the agent and hear TTS back
345
+ 4.5 Only after this counts as a working baseline
346
+
347
+ ## First-Success Vendor Defaults
348
+
349
+ The official `agent-quickstart-nextjs` sample works out of the box with just Agora credentials.
350
+ Vendor API calls (STT, LLM, TTS) go through Agora by default — no vendor API keys needed.
351
+
352
+ Default pipeline:
353
+
354
+ - **STT:** Deepgram nova-3
355
+ - **LLM:** OpenAI gpt-4o-mini
356
+ - **TTS:** MiniMax speech_2_6_turbo
357
+
358
+ BYOK (Bring Your Own Key) is supported but optional. The sample includes commented-out
359
+ BYOK blocks for Deepgram, OpenAI, and ElevenLabs. Users who want to use their own vendor
360
+ API keys can uncomment those blocks and provide them.
361
+
362
+ BYOK provider families visible in the current sample and SDK docs:
363
+
364
+ - **STT:** Deepgram (BYOK)
365
+ - **LLM:** OpenAI (BYOK)
366
+ - **TTS:** ElevenLabs (BYOK), Microsoft
367
+ - **MLLM:** OpenAI Realtime, Google Gemini Live
368
+
369
+ Use this rule during quickstart:
370
+
371
+ - For the first end-to-end success path, prefer the **default pipeline** (no vendor keys).
372
+ - Only switch to BYOK during quickstart if the user explicitly asks for it or names a specific vendor key they want to use.
373
+ - Only switch away from the default cascading pipeline if the user explicitly asks for MLLM.
374
+ - For the current provider matrix or vendor-specific configs, fetch the official live docs before claiming support or listing parameters.
375
+
376
+ ## Env Name Policy
377
+
378
+ ### Default sample path (`agent-quickstart-python`)
379
+
380
+ Keep the official sample's env names as the source of truth.
381
+
382
+ Default (no vendor keys needed):
383
+
384
+ ```bash
385
+ APP_ID=
386
+ APP_CERTIFICATE=
387
+ PORT=8000
388
+ ```
389
+
390
+ Do **not** prompt for vendor API keys unless the user explicitly asks for BYOK.
391
+ Do **not** rename these env vars to a different custom scheme during quickstart.
392
+
393
+ ### Custom-code path
394
+
395
+ If the user is no longer sample-aligned and needs provider-specific config layout, fetch the current official ConvoAI provider docs and use those as the source of truth.
396
+
397
+ ## Agent Prompt and Join Details
398
+
399
+ When starting from scratch in an official quickstart, update the user-controlled agent details the user actually cares about before first run when they have provided them.
400
+
401
+ Allowed quickstart edits:
402
+
403
+ - agent/system prompt or instructions
404
+ - greeting or first message
405
+ - persona, role, language, tone, and scenario details
406
+ - documented agent name, channel naming, or join/config fields already present in the sample
407
+
408
+ Do not rewrite the join lifecycle, token generation, env loading, or provider schema by hand. If the requested change touches vendor-specific model/config fields not already clear in the sample, fetch the current official docs before editing those fields.
409
+
410
+ ## Baseline Path
411
+
412
+ Default baseline is `agent-quickstart-python` unless the user explicitly chooses Node/TypeScript and the required Node plus package-manager runtime is available.
413
+
414
+ After first success, the user can explore other demos:
415
+
416
+ | Demo | Description | Reference |
417
+ | ------------------------- | ----------------------------------------------- | ------------------------------------ |
418
+ | `agent-quickstart-nextjs` | Full-stack Next.js (single app with API routes) | [See below](#other-demo-references) |
419
+ | `agent-samples` | Decomposed backend + multiple client apps | [agent-samples.md](agent-samples.md) |
420
+
421
+ ## State Machine
422
+
423
+ The quickstart is a blocking state machine for source alignment and runtime proof. While a state is unresolved, the next action must stay inside the current gate. For integration mode, read-only workspace detection and quickstart source inspection are allowed when directed by [integration-from-quickstart.md](integration-from-quickstart.md).
424
+
425
+ | State | Allowed | Forbidden | Next prompt | Advance when |
426
+ | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------- | -------------------------- | ----------------------------------------------------------------------------------- |
427
+ | `intro` | Give a short plain-language intro to what ConvoAI is | Code, repo plans, framework recommendations | Product intro text | Intro delivered |
428
+ | `intake` | Confirm preferred stack (`python` or `node/ts`) and get scoped quickstart setup approval; in integration mode, use read-only detection before asking | Code generation, custom scaffolding, implementation | Intake prompt | Stack preference + setup scope are resolved or inferred |
429
+ | `environment_check` | Check Node.js, Bun, Python, Agora CLI versions. Recommend and run installs/upgrades only after user confirmation. | Code, repo inspection, implementation | Environment check commands | Required dependencies for selected baseline are installed and meet minimum versions |
430
+ | `project_readiness` | Execute CLI commands directly to verify auth, project, App ID, App Certificate, feature activation, and fix missing prerequisites inside the approved setup scope. Extract credentials from CLI env output. | Code, repo inspection, implementation | Readiness prompt | Control-plane readiness confirmed and credentials captured |
431
+ | `vendor_defaults` | Ask whether to use the defaults (no vendor keys), BYOK, show the current official provider list, choose a non-default cascading / MLLM path, or reuse a Studio Agent ID. **Skip this gate entirely if the user has not mentioned BYOK, providers, or Studio Agent ID — defaults apply automatically.** | Code, implementation | Vendor-defaults prompt | User picks or gate is auto-skipped |
432
+ | `vendor_selection` | Collect only provider-mode and provider choices after checking the official current provider docs | Code, implementation, secret collection | Custom-provider prompt | Provider mode and provider names are resolved |
433
+ | `studio_agent_id` | Collect the Agora Studio Agent ID and confirm the user wants Studio to remain the source of truth for agent config | Code, re-asking provider setup from scratch | Studio-Agent-ID prompt | The Studio Agent ID path is resolved |
434
+ | `complete` | Emit structured spec and continue to execution | Re-open resolved gates | None | Spec emitted |
435
+
436
+ ### Pre-Action Self-Check
437
+
438
+ Before every tool call or user-visible reply:
439
+
440
+ 1. What is the current state?
441
+ 2. Is the intended action allowed in that state?
442
+ 3. If not, send the state prompt instead.
443
+
444
+ ### Failure Branches
445
+
446
+ - If the user says they cloned a repo but never got an agent running, stay in quickstart.
447
+ - If the user asks for code before quickstart resolves, answer with the next gate instead of generating code.
448
+ - If a reply only partially resolves the current gate, ask a narrow follow-up for the missing field only.
449
+ - If the user asks for the fastest onboarding path or mentions setup during the readiness gate, proceed directly with the CLI verification sequence and then return to the quickstart once readiness is confirmed.
450
+ - If the user asks for the full fastest onboarding flow and has not stated a stack preference, use `agent-quickstart-python`.
451
+ - If the user names a provider that is not in the current official provider docs, say this clearly: it is **not currently documented as supported in the official Agora ConvoAI provider docs**, so do not proceed as if it is supported. Offer the documented default combo or a live-doc verification path.
452
+ - If the user asks to see the provider list, fetch the current official provider docs and stay in the vendor gate until they accept the default combo or choose a documented alternative.
453
+ - If the user says they already have an Agora Studio Agent ID, switch to the `studio_agent_id` state and stop re-asking provider-vendor questions unless they explicitly say they want to replace the Studio-managed config.
454
+
455
+ ## Prompt Templates
456
+
457
+ ### Product Intro
458
+
459
+ Keep it short. Explain that ConvoAI is a server-managed voice agent that joins an RTC channel, speaks through TTS, and usually pairs an RTC client with a backend that starts the agent.
460
+
461
+ Use a natural transition into quickstart. Preferred tone:
462
+
463
+ - Avoid saying "run the baseline flow" or "anchor on a proven baseline" to the user.
464
+ - Prefer "let's first use the official sample to get the whole link working once" language.
465
+
466
+ Suggested transition line:
467
+
468
+ ```text
469
+ Before we jump into custom code, let's first use the official sample to get the whole flow working once. Once the agent can join the channel and finish one real conversation, we can turn that working version into your demo.
470
+ ```
471
+
472
+ ### Intake
473
+
474
+ Ask this right after intro when stack preference or install policy is still unknown:
475
+
476
+ ```text
477
+ Before we run setup, which baseline do you want first: Python or Node/TypeScript?
478
+ I can check your environment and handle normal quickstart setup in one approved scope. I will ask again before creating a new Agora project, overwriting files, exposing secrets, installing Node/Python, or changing anything outside this quickstart.
479
+ ```
480
+
481
+ ### Environment Check
482
+
483
+ Before starting the CLI readiness flow, complete [CLI readiness](../cli/README.md#cli-readiness-agents) and verify runtime dependencies. Run read-only checks first, then use the approved setup scope for non-system quickstart tools.
484
+
485
+ | Dependency | Check command | Minimum version | Install if missing |
486
+ | ------------------------------ | ------------------------------------------------ | --------------------------------------- | -------------------------------------------------------------------------------- |
487
+ | Node.js (Node/TS baseline) | `node --version` | 22+ | Direct the user to https://nodejs.org or use `nvm install 22` |
488
+ | pnpm or npm (Node/TS baseline) | `pnpm --version`, then `npm --version` if needed | pnpm 8+ preferred; npm fallback allowed | Use npm if pnpm is unavailable and the sample supports it |
489
+ | Bun (Python baseline) | `bun --version` | 1.0+ | `npm install -g bun` |
490
+ | Python (Python baseline) | `python3 --version` | 3.8+ | Direct the user to https://python.org |
491
+ | Agora CLI (all baselines) | `agora version` | Verified `0.2.1`; block if below `0.1.7` | Follow [CLI readiness](../cli/README.md#cli-readiness-agents): curl install first, npm alternate |
492
+
493
+ Execution rules:
494
+
495
+ - Check only the selected baseline's dependencies plus Agora CLI.
496
+ - Install or update non-system tools only inside the approved setup scope; otherwise stop with clear next steps.
497
+ - For Node.js and Python, if they are not installed, tell the user what to install and wait — do not attempt to install system-level runtimes.
498
+ - For Python baseline, install Bun only when covered by the approved setup scope.
499
+ - For Node/TS baseline, use pnpm if available; otherwise use npm if the sample supports it. Do not install pnpm just because it is preferred.
500
+ - For Agora CLI below minimum, follow [CLI readiness](../cli/README.md#cli-readiness-agents) — curl installer first, `npm install -g agoraio-cli` as alternate, then re-verify `agora version` and `which -a agora`. Do not use `--add-to-path` or invented `--force` flags.
501
+ - If Agora CLI is installed but outdated, use `agora upgrade --check --json` for channel-specific guidance or re-run the curl installer.
502
+ - Only proceed to project readiness after all required checks for the selected baseline pass.
503
+
504
+ ### Project Readiness
505
+
506
+ Check readiness directly with the Agora CLI. Do not ask the user to self-report it. Mutating fixes may run inside the approved setup scope; ask again for out-of-scope actions.
507
+
508
+ Tell the user what you are about to check, then execute the commands yourself:
509
+
510
+ ```text
511
+ I will check Agora login, project, App ID, App Certificate, and ConvoAI activation with the CLI. Read-only checks come first; setup fixes stay inside the approved scope.
512
+ ```
513
+
514
+ #### Agent execution sequence
515
+
516
+ Run these commands in order. Use `--json` where available so you can parse the output programmatically.
517
+
518
+ 1. **Auth check** — `agora auth status --json`
519
+ - If not logged in → run `agora login` and wait for the user to complete the browser OAuth flow.
520
+
521
+ 2. **Current project suitability** — check the currently selected project first.
522
+ - Inspect the selected project with `agora project show --json`.
523
+ - Treat it as directly usable only if the project resolves, App ID exists, App Certificate is exportable, and the required first-success features are present.
524
+ - If the current project is directly usable → keep it.
525
+ - If the current project is not directly usable → continue to project discovery.
526
+
527
+ 3. **Project discovery and selection**
528
+ - If the user explicitly named a project, inspect that exact project first and try to repair it with documented CLI commands.
529
+ - If the user did **not** name a project and the current selected project is not directly usable, inspect existing projects and look for a directly usable candidate.
530
+ - If a directly usable candidate is found, select it and explicitly tell the user which project was chosen before continuing.
531
+ - If no directly usable candidate exists, ask before creating a new dedicated first-success project with the required features already enabled.
532
+
533
+ 4. **Credential export / env write** — use `agora quickstart env write` as the default for official quickstarts.
534
+ - If this fully seeds the sample env file, do not run `agora project env --with-secrets`.
535
+ - Use `agora project env --with-secrets --json` only when direct raw values are explicitly needed for manual mapping.
536
+ - If `--with-secrets` is used, do not echo secret values in chat output.
537
+ - If `--with-secrets` fails because the project is still not token-ready, treat that as a project-readiness failure; repair within the approved setup scope or ask before replacing the project.
538
+
539
+ 5. **Doctor** — `agora project doctor --json`
540
+ - If `healthy` or `warning` → control-plane readiness is confirmed, not runtime/sample readiness.
541
+ - If `not_ready` → read the reported issues and remediate within the approved setup scope:
542
+ - ConvoAI not enabled → run `agora project feature enable convoai`, then re-run doctor.
543
+ - RTM or related service just enabled → allow bounded wait/retry for up to about 5 minutes before concluding the project still needs intervention.
544
+ - Other issues → run the matching in-scope recovery command (see [doctor.md](../cli/doctor.md)), then re-run doctor. Ask before out-of-scope recovery.
545
+ - Repeat until doctor passes at the control-plane layer.
546
+
547
+ 6. **Auto-populate env** — once control-plane readiness passes, seed the official quickstart env with `agora quickstart env write` when possible.
548
+ - Python quickstart target: `server/.env` with `APP_ID` and `APP_CERTIFICATE`.
549
+ - Node/TS quickstart target: `.env.local` with `NEXT_PUBLIC_AGORA_APP_ID` and `NEXT_AGORA_APP_CERTIFICATE`.
550
+ - Go quickstart target: `server-go/.env` with `APP_ID` and `APP_CERTIFICATE`.
551
+ No manual copy-paste needed when template-aware write succeeds.
552
+ - When `AGORA_APP_ID` and `AGORA_APP_CERTIFICATE` are already exported in the shell (common in CI and local setups), the env file must contain **resolved literal values**, not unexpanded placeholders. Wrong: `NEXT_PUBLIC_AGORA_APP_ID=$AGORA_APP_ID` written as text. Right: expand variables when writing (e.g. `agora quickstart env write`, or a heredoc/`printf` that substitutes current env values). Verify the file has non-empty values before starting the dev server.
553
+
554
+ 7. **Sample-ready gate**
555
+ - Install dependencies and start the official sample using the documented commands.
556
+ - If `pnpm install` exits non-zero with only `[ERR_PNPM_IGNORED_BUILDS]`, treat install as complete and continue to `pnpm dev` — see [Known Non-Blocking Warnings](#known-non-blocking-warnings).
557
+ - The quickstart is only fully ready when the app opens, the user can press `Try it now`, the agent joins, and the frontend stays up.
558
+ - If a failure is localized to the official sample itself rather than the environment or project readiness, a minimal upstream-shaped workaround is allowed. Do not replace the sample with a self-built implementation.
559
+
560
+ For CLI command details, route to:
561
+
562
+ - [../cli/README.md](../cli/README.md)
563
+ - [../cli/quickstarts.md](../cli/quickstarts.md)
564
+ - [../cli/env.md](../cli/env.md)
565
+ - [../cli/projects.md](../cli/projects.md)
566
+ - [../cli/doctor.md](../cli/doctor.md)
567
+
568
+ ### Vendor Defaults
569
+
570
+ Use this only if the user has mentioned BYOK, vendor API keys, a specific provider, or a Studio Agent ID. If none of these were mentioned, skip this prompt entirely and use the defaults.
571
+
572
+ ```text
573
+ The official quickstart works out of the box with just Agora credentials — no vendor API keys needed.
574
+
575
+ Default pipeline:
576
+ - STT: Deepgram nova-3
577
+ - LLM: OpenAI gpt-4o-mini
578
+ - TTS: MiniMax speech_2_6_turbo
579
+
580
+ A. Use the defaults (no vendor keys needed — fastest path)
581
+ B. I want to use my own vendor API keys (BYOK)
582
+ C. Show me the current official provider list first
583
+ D. I want to choose a non-default cascading or MLLM path
584
+ E. I already have an Agora Studio Agent ID and want to reuse that Studio-managed agent
585
+ ```
586
+
587
+ ### Custom Provider Prompt
588
+
589
+ Use only after the user picks `C` or directly asks for non-default providers.
590
+
591
+ ```text
592
+ First check the current official ConvoAI provider docs, then choose from the documented provider modes:
593
+ - Cascading path: STT + LLM + TTS
594
+ - MLLM path: OpenAI Realtime or Google Gemini Live
595
+
596
+ Then choose the documented providers for that mode using the current official docs as the source of truth.
597
+
598
+ Reply in one line, for example:
599
+ - `TTS: Microsoft`
600
+ - `MLLM: OpenAI Realtime`
601
+ - `STT: Deepgram, LLM: OpenAI, TTS: Microsoft`
602
+ ```
603
+
604
+ ### Studio Agent ID Prompt
605
+
606
+ Use only when the user picks `D` or directly says they already have an Agora Studio Agent ID.
607
+
608
+ ```text
609
+ If you already configured the agent in Agora Studio, we can treat Studio as the source of truth for the agent configuration instead of rebuilding the provider stack here.
610
+
611
+ Open `https://console.agora.io/studio/agents`, find the agent you want to reuse, and copy its **Agent ID**.
612
+
613
+ Important:
614
+ - This **Studio Agent ID** is different from the runtime `agent_id` returned by `/join`.
615
+ - The Studio Agent ID identifies the Studio-managed agent configuration and maps to the request field `pipeline_id`.
616
+ - The runtime `agent_id` identifies a live started session.
617
+
618
+ Reply with one of these:
619
+ A. I have the Studio Agent ID — here it is: `<agent-id>`
620
+ B. I need to look it up in Studio first
621
+ C. Go back — I want to use the default/provider path instead
622
+ ```
623
+
624
+ ### Unsupported Provider Prompt
625
+
626
+ Use this when the user names a provider that is not in the current official provider docs.
627
+
628
+ ```text
629
+ That provider is not in the current official Agora ConvoAI provider docs, so I should not proceed as if it is supported.
630
+
631
+ You can choose one of these paths:
632
+ A. Use the documented default combo to get the first demo working
633
+ B. Show the current official provider list first
634
+ C. Re-check the latest official docs to verify whether that provider is supported now
635
+ ```
636
+
637
+ ## Output: Structured Quickstart Spec
638
+
639
+ After all gates are resolved, normalize the result into a short spec and continue within the approved setup scope. Ask before any unapproved mutating action.
640
+
641
+ ```yaml
642
+ use_case: [text]
643
+ mode: quickstart
644
+ proven_working_baseline: yes
645
+ baseline_gate:
646
+ quickstart_repo_cloned: true
647
+ official_start_command_run: true
648
+ agent_join_verified: true
649
+ rtc_client_connected: true
650
+ project_readiness:
651
+ app_id: [ready | missing | unknown]
652
+ app_certificate: [ready | missing | unknown]
653
+ convoai_activation: [ready | missing | unknown]
654
+ key_mode: [default | byok | unknown]
655
+ providers:
656
+ pipeline: [cascading | mllm | unknown]
657
+ stt: [deepgram | user-specified-supported | unknown]
658
+ llm: [openai | user-specified-supported | unknown]
659
+ tts: [minimax | elevenlabs | microsoft | user-specified-supported | unknown]
660
+ mode: [default | byok-default | user-specified-cascading | mllm | unknown]
661
+ studio_agent:
662
+ use_existing_agent_id: [yes | no | unknown]
663
+ agent_id: [text | missing | unknown]
664
+ ```
665
+
666
+ Notes:
667
+
668
+ - `stt` is the SDK-facing name in this quickstart spec. Platform docs may call the same stage `ASR`.
669
+ - `studio_agent.agent_id` means the **Agora Studio Agent ID** from `https://console.agora.io/studio/agents`, not the runtime `agent_id` returned by `/join`.
670
+ - When this Studio path is used, that Studio Agent ID maps to the request field `pipeline_id`.
671
+
672
+ ## After Collection
673
+
674
+ Execute the selected quickstart baseline (clone the chosen official sample, configure, run, verify first success).
675
+
676
+ After first success, route by user's next request:
677
+
678
+ - existing Agora Studio Agent ID → use [conversational-ai-studio.md](conversational-ai-studio.md)
679
+ - provider selection or parameter confirmation → fetch the current official ConvoAI provider docs
680
+ - custom LLM backend → [server-custom-llm.md](server-custom-llm.md)
681
+ - direct REST API (non-SDK languages) → [auth-flow.md](auth-flow.md)
682
+ - other demos → see "After the Baseline Works" section below
683
+
684
+ ## Other Demo References
685
+
686
+ These are available after the first success baseline is proven. Do not use these as the default quickstart path.
687
+
688
+ ### Full-Stack Next.js (`agent-quickstart-nextjs`)
689
+
690
+ **Repo:** <https://github.com/AgoraIO-Conversational-AI/agent-quickstart-nextjs>
691
+
692
+ Single Next.js app with built-in API routes for token generation and agent lifecycle. Includes React UI with live transcription. Requires Node.js 22+ and a supported package manager; prefer pnpm 8+ and fall back to npm when pnpm is unavailable and the sample supports npm. See the repo README for setup.
693
+
694
+ ### Decomposed Samples (`agent-samples`)
695
+
696
+ Multiple backend + client combinations. See [agent-samples.md](agent-samples.md).
697
+
698
+ ## After the Baseline Works
699
+
700
+ Once the first end-to-end ConvoAI session works, route by task:
701
+
702
+ | Next step | Reference |
703
+ | ------------------------------------------------------ | --------------------------------------------------------------------------- |
704
+ | Customize LLM, TTS, ASR vendor or model | Fetch `https://docs-md.agora.io/en/conversational-ai/develop/custom-llm.md` |
705
+ | Add transcript rendering or agent state to a custom UI | [agent-toolkit.md](agent-toolkit.md) |
706
+ | Use React hooks (`useTranscript`, `useAgentState`) | [agent-client-toolkit-react.md](agent-client-toolkit-react.md) |
707
+ | Swap in pre-built React UI components | [agent-ui-kit.md](agent-ui-kit.md) |
708
+ | Add a custom LLM backend (RAG, tool calling) | [server-custom-llm.md](server-custom-llm.md) |
709
+ | Production token generation | [../server/tokens.md](../server/tokens.md) |
710
+ | Full REST API reference | [README.md](README.md#rest-api-endpoints) |