-
Notifications
You must be signed in to change notification settings - Fork 21
docs: session overrides — field reference, voice_id rename, public cap #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -18,7 +18,7 @@ | |||||||||||||||||||||
| <Note> | ||||||||||||||||||||||
| No backend, and anyone may talk to the agent? A [public | ||||||||||||||||||||||
| agent](/agents/deploy/public-agents) lets the SDK create sessions with just an | ||||||||||||||||||||||
| `agentId` — no token involved, gated by an origin allowlist and rate limits. | ||||||||||||||||||||||
| </Note> | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## Create a token on your backend | ||||||||||||||||||||||
|
|
@@ -109,7 +109,7 @@ | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| <Note> | ||||||||||||||||||||||
| `overrides`, `dynamic_variables`, `language`, `tool_events`, `timezone`, and | ||||||||||||||||||||||
| `world_context` belong in your backend's creation request — the SDK forwards | ||||||||||||||||||||||
| these options only in [public agent](/agents/deploy/public-agents) mode. | ||||||||||||||||||||||
| </Note> | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
@@ -118,13 +118,12 @@ | |||||||||||||||||||||
| | Field | Type | Description | | ||||||||||||||||||||||
| | ------------------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||||||||||||||||||||||
| | `agent_id` | string, required | The agent to talk to. It must have a [published version](/agents/deploy/versions-publishing). | | ||||||||||||||||||||||
| | `name` | string, optional | Display name for this session in the console's Conversations list, up to 128 characters. Omit it to show the session's start time instead. API-key requests only — keyless (public) creation rejects it with `400`. | | ||||||||||||||||||||||
| | `language` | string, optional | Shorthand for `overrides.language`; subject to the same override allow-list. See [Voice & language](/agents/build/voice-language). | | ||||||||||||||||||||||
| | `overrides` | object, optional | Per-session config overrides. Each field must be enabled in the agent's override allow-list — unauthorized fields are rejected with `400`. | | ||||||||||||||||||||||
| | `overrides` | object, optional | Replace parts of the published configuration for this session — see [Overrides](#overrides). | | ||||||||||||||||||||||
| | `dynamic_variables` | object, optional | Up to 50 entries of string, number, or boolean values, substituted into `{{placeholders}}`. See [Dynamic variables](/agents/build/dynamic-variables). | | ||||||||||||||||||||||
| | `tool_events` | boolean, optional | Stream tool lifecycle events (`toolCallStarted` / `toolCallCompleted` / `toolCallFailed`) to the client. Default `true`; set `false` to keep tool inputs and outputs off the client. | | ||||||||||||||||||||||
| | `end_user_id` | string, optional | Your identifier for the end user, for attribution in [conversation history](/agents/monitor/conversation-history). | | ||||||||||||||||||||||
| | `metadata` | object, optional | Your own key-value namespace. Stored and returned verbatim on session queries and webhooks — never read or interpreted by the platform. | | ||||||||||||||||||||||
| | `record_audio` | boolean, optional | Whether to record this session's audio. Overrides the agent's [recording setting](/agents/monitor/conversation-history#what-gets-stored) for this session only — it never changes the agent; omit it to use the agent's configuration. | | ||||||||||||||||||||||
| | `timezone` | string, optional | IANA timezone (like `Asia/Shanghai`) for the agent's sense of local time. Invalid names are rejected with `422`. See [Time & timezone](/agents/build/time-timezone). | | ||||||||||||||||||||||
| | `client_timezone` | string, optional | The end user's browser timezone, filled automatically by the SDK in public-agent mode. A hint, not a demand: it applies only when neither `timezone` nor the agent's configured timezone is set, and invalid values are ignored. See the [resolution order](/agents/build/time-timezone). | | ||||||||||||||||||||||
|
|
@@ -132,6 +131,35 @@ | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| Unknown fields — top-level or inside `overrides` — are rejected with `422`. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## Overrides | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| `overrides` replaces parts of the agent's published configuration for one session — the agent itself never changes: | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| | Field | Type | Effect for this session | | ||||||||||||||||||||||
| | ---------------------- | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||||||||||||||||||||||
| | `first_message` | string, up to 10,000 characters | The agent opens with exactly this text, spoken verbatim — whatever first-message mode the configuration sets. `{{placeholders}}` render inside it. | | ||||||||||||||||||||||
| | `first_message_prompt` | string, up to 10,000 characters | Instructions the agent generates its opener from, replacing the configured first-message behavior. `{{placeholders}}` render inside it. Mutually exclusive with `first_message` — sending both is `422`. | | ||||||||||||||||||||||
| | `system_prompt` | string, up to 8,000 characters | Replaces the configured system prompt entirely. `{{placeholders}}` render inside it. | | ||||||||||||||||||||||
| | `voice_id` | string | The voice the agent speaks with — any [voice model id](/agents/build/voice-language#use-any-voice-model) from the Voice Library. Voices bias pronunciation toward their own language, so pair it with `language`. | | ||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Document the The OpenAPI schema limits 🤖 Prompt for AI AgentsSource: Coding guidelines |
||||||||||||||||||||||
| | `language` | `en`, `ja`, `zh`, `ko`, `es`, `fr`, `de` | Pins the conversation language, taking precedence over the configured [speaking language](/agents/build/voice-language#speaking-language) and automatic language detection. | | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ```json | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| "agent_id": "YOUR_AGENT_ID", | ||||||||||||||||||||||
| "overrides": { | ||||||||||||||||||||||
| "first_message": "Welcome back, {{name}} — picking up where we left off.", | ||||||||||||||||||||||
| "voice_id": "802e3bc2b27e49c2995d23ef70e6ac89", | ||||||||||||||||||||||
| "language": "ja" | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| ``` | ||||||||||||||||||||||
|
Comment on lines
+146
to
+155
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Make the override example self-contained. The example sends Add a matching variable or remove the placeholder. Proposed example update "first_message": "Welcome back, {{name}} — picking up where we left off.",
"voice_id": "802e3bc2b27e49c2995d23ef70e6ac89",
"language": "ja"
- }
+ },
+ "dynamic_variables": { "name": "Ada" }
}📝 Committable suggestion
Suggested change
🧰 Tools🪛 GitHub Check: Mintlify Validation (hanabiaiinc) - vale-spellcheck[warning] 151-151: agents/deploy/authenticated-sessions.mdx#L151 🤖 Prompt for AI AgentsSource: Coding guidelines |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| On [public agents](/agents/deploy/public-agents), keyless (browser-created) sessions may override only `language` and `voice_id` — the prompt-shaping fields are rejected with `400` regardless of the agent. Create the session from your backend to use them. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| The session record stores which overrides took effect. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Everything else on the request is not an override: `dynamic_variables`, `timezone`, `record_audio`, and `tool_events` are separate top-level fields. Session length is not settable per session — `max_duration_seconds` comes from the agent's [conversation configuration](/agents/build/configuration#call-duration). | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## Response | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ```json JSON | ||||||||||||||||||||||
|
|
@@ -187,7 +215,7 @@ | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| | Status | Meaning | | ||||||||||||||||||||||
| | ------ | --------------------------------------------------------------------------------------------------------------------------------------------- | | ||||||||||||||||||||||
| | `400` | An `overrides` field is not on the agent's override allow-list. | | ||||||||||||||||||||||
| | `400` | An `overrides` field is not enabled for this agent, or a keyless request sent an override [public sessions don't accept](#overrides). | | ||||||||||||||||||||||
| | `401` | Invalid API key. A request with no `Authorization` header at all is treated as a public-agent request instead. | | ||||||||||||||||||||||
| | `402` | Quota exceeded. | | ||||||||||||||||||||||
| | `403` | Public-agent request rejected: the agent is not public, or the page's `Origin` is not on the allow-list. | | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ | |
| icon: "globe" | ||
| --- | ||
|
|
||
| A public agent accepts sessions straight from the browser: the SDK calls the session endpoint with just an `agent_id` — no API key, no server of your own. The platform gates access with three controls: an agent-level public switch (off by default), a required origin allowlist, and rate limiting. | ||
|
|
||
| Use this mode for demos, marketing pages, and support bubbles where standing up a backend isn't worth it. For production apps with their own users, [authenticated sessions](/agents/deploy/authenticated-sessions) are usually the better fit — see [when to use session tokens instead](#when-to-use-session-tokens-instead). | ||
|
|
||
|
|
@@ -23,7 +23,7 @@ | |
| </Step> | ||
| <Step title="Add allowed origins"> | ||
| On the same page, list every web origin that may start sessions under | ||
| **Allowed origins** (`allowed_origins` in the API). The allowlist is | ||
| **required**: a request whose `Origin` doesn't match any entry is rejected | ||
| with `403`. | ||
| </Step> | ||
|
|
@@ -62,7 +62,7 @@ | |
|
|
||
| An entry matches only on **exact scheme + host + port**. The host is case-insensitive, and a trailing slash on an entry is tolerated — everything else must match exactly. | ||
|
|
||
| | Allowlist entry | Browser origin | Allowed | | ||
| | ------------------------- | ------------------------------ | ------------------------------ | | ||
| | `https://app.example.com` | `https://app.example.com` | Yes | | ||
| | `https://app.example.com` | `https://APP.example.com` | Yes — host is case-insensitive | | ||
|
|
@@ -90,11 +90,11 @@ | |
| backend becomes the gate, and the platform-side public limits no longer apply. | ||
| </Note> | ||
|
|
||
| ## Treat public input as untrusted | ||
|
|
||
| On the public path, the entire session request originates in the visitor's browser. The platform enforces its own guardrails — `overrides` are filtered against the agent's allowlist and unauthorized fields are rejected with `400` — but anything that passes through verbatim is attacker-controllable: | ||
| On the public path, the entire session request originates in the visitor's browser. The platform enforces its own guardrails — public sessions accept only the `language` and `voice_id` [overrides](/agents/deploy/authenticated-sessions#overrides), rejecting everything else with `400` — but anything that passes through verbatim is attacker-controllable: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Distinguish unknown fields from unsupported public overrides. The sentence says that every override other than Limit the 🤖 Prompt for AI AgentsSource: Coding guidelines |
||
|
|
||
| - **`metadata`** is stored and returned exactly as sent, never interpreted by the platform. When you read it back in [conversation history](/agents/monitor/conversation-history) or [webhooks](/agents/monitor/webhooks), treat it as untrusted data — never as proof of who the visitor is. | ||
| - **`dynamic_variables`** are chosen by the page that starts the session. Don't inject anything through them that the visitor shouldn't control. See [Dynamic variables](/agents/build/dynamic-variables). | ||
|
|
||
| For trusted attribution (a verified `end_user_id`, server-set metadata), create sessions from your backend instead. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Align all
languageguidance with the wire contract.Top-level
languageis an SDK/widget shorthand foroverrides.language. It is not a field in the backend session-creation payload, and it cannot modify a session that already exists behindsessionToken.agents/deploy/authenticated-sessions.mdx#L122-L122: Update the request guidance so backend callers sendoverrides.language, not top-levellanguage.agents/deploy/web-sdk.mdx#L64-L64: Qualify thelanguageoption asagentId-mode shorthand and directsessionTokencallers to configure it on the backend.📍 Affects 2 files
agents/deploy/authenticated-sessions.mdx#L122-L122(this comment)agents/deploy/web-sdk.mdx#L64-L64🤖 Prompt for AI Agents
Source: Coding guidelines