Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions agents/build/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
- `low` (**Hard to interrupt** in the Builder): The agent stops only for a firm, worded interjection, talking through background noise and short acknowledgements.
- `balanced` (default): Interrupts on normal speech.
- `high` (**Easy to interrupt**): The agent stops on the caller's first word.
- `conversation.interruption_ignore_phrases` (up to 50 entries of 40 characters): Backchannels such as `"uh-huh"` or `"okay"` that never interrupt the agent when the caller says only them. Matching ignores case and punctuation. Send `[]` to clear the list.

Check warning on line 62 in agents/build/configuration.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/build/configuration.mdx#L62

Did you really mean 'Backchannels'?

### Echo guard

Expand Down Expand Up @@ -93,7 +93,15 @@

`conversation.timezone` is the default IANA timezone (like `Asia/Tokyo`) the agent uses for dates and times in conversation. Leave it empty for **automatic**: each session follows the caller's device or phone number, falling back to UTC. Set one when your agent serves a single region regardless of who calls. A per-session `timezone` on the [session request](/agents/build/time-timezone) overrides this. See [Time & timezone](/agents/build/time-timezone) for the full resolution order.

## Context

The `context` section holds the facts the platform tells your agent on its own, one switch each. Guardrails constrain what the agent does, context switches add to what it knows.

### Current date and time

`context.current_time` (default `false`) tells the agent today's date when a session starts and the current time before every reply, in the agent's [timezone](#timezone). In the Builder this is the **Current date & time** toggle under the time zone. Turn it on for scheduling, reminders, or any prompt that says "tomorrow" or "next Tuesday". Leave it off when the prompt states its own date, for example a role-play set on a fictional day. Agents created before the switch existed have it on, which was their behavior. A session request's `context.current_time` overrides the agent's setting in either direction. See [Time & timezone](/agents/build/time-timezone).

## Autosave and publishing

Check warning on line 104 in agents/build/configuration.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/build/configuration.mdx#L104

Did you really mean 'Autosave'?

There is no Save button. Each change is written to the agent's draft moments after you stop editing, and the **Saving… / Saved** indicator at the bottom-left of the page shows the current state. If a save fails, the Builder tells you and keeps your pending edits so nothing is lost.

Expand Down Expand Up @@ -122,7 +130,7 @@
"voice_id": "802e3bc2b27e49c2995d23ef70e6ac89",
"speaking_language": "en"
},
"asr": {

Check warning on line 133 in agents/build/configuration.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/build/configuration.mdx#L133

Did you really mean 'asr'?
"model": "deepgram:nova-3",
"multilingual": false,
"strict_language": false,
Expand All @@ -139,6 +147,9 @@
"echo_guard": null,
"speculative_response": true,
"timezone": ""
},
"context": {
"current_time": false
}
}
```
Expand Down Expand Up @@ -167,8 +178,9 @@
|---|---|---|
| `prompt` | System prompt and first-message settings | This page |
| `voice` | Voice profile, text-to-speech model, speaking language, and expressive mode | [Voice & language](/agents/build/voice-language) |
| `asr` | Speech recognition model, multilingual recognition, strict language, and recognition keyterms | [Voice & language](/agents/build/voice-language#speech-recognition-model) |

Check warning on line 181 in agents/build/configuration.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/build/configuration.mdx#L181

Did you really mean 'keyterms'?
| `conversation` | Call duration, turn-taking, interruption behavior, timezone, and storage | This page; storage in [Conversation history](/agents/monitor/conversation-history#what-gets-stored) |
| `context` | Facts the platform tells the agent on its own, currently the current date and time | This page |
| `tools` | Attached webhook tools and system tool switches | [Tools](/agents/build/tools) |
| `knowledge_base` | Attached knowledge sources | [Knowledge base](/agents/build/knowledge-base) |
| `analysis` | Post-call summary, data fields, and success criteria | [Post-call analysis](/agents/monitor/post-call-analysis) |
Expand Down
10 changes: 5 additions & 5 deletions agents/build/dynamic-variables.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
and they are on the {{plan}} plan. Greet them by name.
```

Pass values as a flat object of strings, numbers, or booleans. Variable names must match `[A-Za-z][A-Za-z0-9_]*` (no hyphens or dots; the dotted `system.*` names are reserved for [system variables](#system-variables)), string values are capped at 100,000 characters, and a request can carry at most 500 variables totaling 1 MiB as UTF-8 JSON. Violations reject session creation with `422`:

Check warning on line 36 in agents/build/dynamic-variables.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/build/dynamic-variables.mdx#L36

Did you really mean 'booleans'?

<CodeGroup>
```bash API (curl)
Expand Down Expand Up @@ -121,7 +121,7 @@
```

<Tip>
In `agentId` mode, values arrive from the end user's browser. Treat them as untrusted input, and use `sessionToken` mode when personalization must come from data only your backend knows.

Check warning on line 124 in agents/build/dynamic-variables.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/build/dynamic-variables.mdx#L124

Did you really mean 'untrusted'?
</Tip>

### Custom variables in webhook tools
Expand All @@ -132,23 +132,23 @@
https://ehr.example.com/patients/{{patient_id}}/appointments?clinic={{clinic_id}}
```

- In the URL the value is URL-encoded, like argument values. In header values and the body template it is inserted as is. Numbers render as written, booleans as `true` or `false`.

Check warning on line 135 in agents/build/dynamic-variables.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/build/dynamic-variables.mdx#L135

Did you really mean 'booleans'?
- When the tool declares an argument with the same name as a custom variable, the argument wins: that placeholder is filled from what the agent supplies.
- A placeholder with no value renders as an empty string in the request, unlike in the prompt, where it stays visible.

<Warning>
On a [public agent](/agents/deploy/public-agents) the browser supplies custom values, so anyone can start a session with any `patient_id`. When a templated value identifies a person, don't let it authorize access to their data on its own: create sessions from your backend (`sessionToken` mode), or let the inbound call webhook supply it on phone calls.

Check warning on line 140 in agents/build/dynamic-variables.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/build/dynamic-variables.mdx#L140

Did you really mean 'templated'?
</Warning>

## System variables

The platform fills a handful of `{{system.*}}` placeholders itself, on every session. You cannot supply or override them: the names you pass in `dynamic_variables` cannot contain a dot, so the two namespaces never collide.

Check warning on line 145 in agents/build/dynamic-variables.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/build/dynamic-variables.mdx#L145

Did you really mean 'namespaces'?

| Variable | Value | Notes |
|---|---|---|
| `system.channel` | `phone_inbound`, `phone_outbound`, or `web_voice` | Web SDK, API, preview, and Single Turn and Tool test sessions are `web_voice`. A Simulation test uses its [channel](/agents/test/agent-tests#channel). |
| `system.timezone` | The session's resolved IANA timezone, for example `Asia/Tokyo` | `UTC` when nothing resolves. Always equals the session's `timezone` field; see [which timezone a session uses](/agents/build/time-timezone#which-timezone-a-session-uses). |
| `system.today` | Today's date in that timezone, ISO 8601 `YYYY-MM-DD` | The calendar date at session creation. There is no `system.now`; see [World context](#world-context). |
| `system.today` | Today's date in that timezone, ISO 8601 `YYYY-MM-DD` | The calendar date at session creation. There is no `system.now`; see [Current date and time](#current-date-and-time). |
| `system.language` | The session language code, one of the [52 supported languages](/agents/build/voice-language#speaking-language) | The `language` [override](/agents/deploy/authenticated-sessions#overrides) when the request carries one, otherwise the agent's [speaking language](/agents/build/voice-language#speaking-language). |
| `system.caller_number` | The human party's number, E.164 | Inbound: the caller (empty if withheld or not a valid E.164 number). Outbound: the number you dialed. Empty on non-phone sessions. |
| `system.caller_number_spoken` | The same number written for speech, for example `+1; 4 1 5; 5 5 5; 0 1 2 3` | Use it wherever the agent should say the number out loud; see [Reading a number out loud](#reading-a-number-out-loud). Empty whenever `system.caller_number` is empty. |
Expand Down Expand Up @@ -183,7 +183,7 @@

### Date and timezone

`system.today` is always ISO formatted, whatever the session language: in the system prompt the model reads it and speaks it in the session's language, while a fixed first message containing `{{system.today}}` is spoken verbatim as `2026-08-21`. A session that runs past midnight keeps its opening date. Template it, and `system.timezone`, when a request needs them explicitly, for example a webhook tool's query string; for the agent's own sense of time no variable is needed, see [World context](#world-context).
`system.today` is always ISO formatted, whatever the session language: in the system prompt the model reads it and speaks it in the session's language, while a fixed first message containing `{{system.today}}` is spoken verbatim as `2026-08-21`. A session that runs past midnight keeps its opening date. Template it, and `system.timezone`, when a request needs them explicitly, for example a webhook tool's query string; for the agent's own sense of time, turn on the agent's `context.current_time` switch instead of templating, see [Current date and time](#current-date-and-time).

### In webhook tools

Expand All @@ -197,11 +197,11 @@

A reference to a system variable that does not exist (`{{system.foo}}`) is rejected with `422` when you save the configuration or the tool, and when you send it in session overrides. The error lists the available names.

## World context
## Current date and time

The agent knows the current date and time without any variable. The platform states the date and the session's timezone at the start of every session and refreshes the time on every turn, so "tomorrow morning" or "next Tuesday" resolve correctly even in a long conversation. You don't need a custom `{{today}}` or `{{now}}`, and there is no `system.now`: variables render once, when the session is created, so a templated time would be stale from the first reply onward. When you want the date or timezone as text in a template, for example in a webhook tool URL, use the [`system.today` and `system.timezone`](#system-variables) system variables.
With the agent's `context.current_time` switch on, the agent knows the current date and time without any variable: the platform states the date and the session's timezone at the start of every session and refreshes the time on every turn, so "tomorrow morning" or "next Tuesday" resolve correctly even in a long conversation. You don't need a custom `{{today}}` or `{{now}}`, and there is no `system.now`: variables render once, when the session is created, so a templated time would be stale from the first reply onward. When you want the date or timezone as text in a template, for example in a webhook tool URL, use the [`system.today` and `system.timezone`](#system-variables) system variables, which work whether the switch is on or off.

Check warning on line 202 in agents/build/dynamic-variables.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/build/dynamic-variables.mdx#L202

Did you really mean 'templated'?

See [Time & timezone](/agents/build/time-timezone) for how the timezone is resolved and how to turn the injection off for a session (`world_context: false`).
See [Time & timezone](/agents/build/time-timezone) for how the timezone is resolved and how the switch works per agent and per session.

## Going further

Expand Down
22 changes: 12 additions & 10 deletions agents/build/time-timezone.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
title: "Time & Timezone"
description: "Your agent knows the current date and time by default: how the timezone is chosen and how to opt out"
description: "Let your agent know the current date and time: the switch, how the timezone is chosen, and per-session overrides"
icon: "clock"
---

Agents are time-aware out of the box: every session knows today's date and the current time in the session's timezone. You don't reference a variable or add anything to your prompt: "tomorrow morning" and "next Tuesday" ground correctly from the first turn, on every channel (voice, text, and phone).
An agent can know today's date and the current time in the session's timezone without you adding anything to the prompt. The switch is `context.current_time` in the agent's [configuration](/agents/build/configuration#current-date-and-time), the **Current date & time** toggle under the time zone in the Builder. It is off for new agents and on for agents created before the switch existed. With it on, "tomorrow morning" and "next Tuesday" ground correctly from the first turn, on every channel (voice, text, and phone).

<Note>
The default timezone is **UTC**. Change it for the agent in its
Expand All @@ -15,7 +15,7 @@

## What the agent knows

Fish Audio injects two pieces of world context server-side:
With the switch on, Fish Audio injects two lines server-side:

| When | What | Example |
| ------------------ | ---------------------------- | ------------------------------------------------------------------ |
Expand All @@ -29,7 +29,7 @@
system prompt's character limit.
</Note>

Both facts also exist as [system variables](/agents/build/dynamic-variables#system-variables) for the cases where you want to template them yourself, for example into a webhook tool's URL: `{{system.today}}` is the date at session creation as ISO `YYYY-MM-DD`, and `{{system.timezone}}` is the resolved IANA name (`UTC` when nothing resolves). There is no `{{system.now}}`: variables render once, when the session is created, so a templated clock would freeze at the opening. The per-turn time above is the one to rely on.
Both facts also exist as [system variables](/agents/build/dynamic-variables#system-variables), available whether the switch is on or off, for the cases where you want to template them yourself, for example into a webhook tool's URL: `{{system.today}}` is the date at session creation as ISO `YYYY-MM-DD`, and `{{system.timezone}}` is the resolved IANA name (`UTC` when nothing resolves). There is no `{{system.now}}`: variables render once, when the session is created, so a templated clock would freeze at the opening. The per-turn time above is the one to rely on.

Check warning on line 32 in agents/build/time-timezone.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/build/time-timezone.mdx#L32

Did you really mean 'templated'?

## Which timezone a session uses

Expand Down Expand Up @@ -61,9 +61,11 @@
agent's timezone for those. Calls that resolve nothing run in UTC.
</Note>

## Turn it off
## Turn it on or off

Time awareness is on by default. To withhold both the date and the per-turn time from a session (for example a role-play agent set on a fictional date, or a test that must be reproducible), set `world_context: false` when creating the session:
**For the whole agent**, switch **Current date & time** in the Builder (**Configuration**, under the time zone) or set `context.current_time` through the [config API](/agents/build/configuration#current-date-and-time). This is the default for every session of the agent on every channel, and the only switch for phone calls, which the platform creates without a session request. Publish the agent for the change to reach live traffic. Turn it off again when the agent must not know the real date and time: a role-play agent set on a fictional date, a prompt that states its own date, or a test that must be reproducible.

**For one session**, send `context.current_time` when creating it. An explicit value overrides the agent's setting in either direction: `false` withholds the date and time from an agent that has them on, `true` injects them for one session of an agent that has them off. The older `world_context` field (`worldContext` in the SDK) is still accepted as an alias.

<CodeGroup>
```bash API (curl)
Expand All @@ -72,17 +74,17 @@
--header "Content-Type: application/json" \
--data '{
"agent_id": "YOUR_AGENT_ID",
"world_context": false
"context": { "current_time": false }
}'
```

```javascript JavaScript SDK
import { AgentSession } from "@fishaudio/agent-client";

// Public agent: the SDK forwards the opt-out in its creation request.
// Public agent: the SDK forwards the override in its creation request.
const session = await AgentSession.start({
agentId: "YOUR_AGENT_ID",
worldContext: false,
context: { currentTime: false },
});
```
</CodeGroup>
Expand All @@ -95,7 +97,7 @@
icon="server"
href="/agents/deploy/authenticated-sessions"
>
All session-creation parameters, including `timezone` and `world_context`.
All session-creation parameters, including `timezone` and `context`.
</Card>
<Card
title="Dynamic variables"
Expand Down
4 changes: 2 additions & 2 deletions agents/deploy/authenticated-sessions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Check warning on line 21 in agents/deploy/authenticated-sessions.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/deploy/authenticated-sessions.mdx#L21

Did you really mean 'allowlist'?
</Note>

## Create a token on your backend
Expand Down Expand Up @@ -115,7 +115,7 @@

<Note>
`overrides`, `dynamic_variables`, `tool_events`, `timezone`, and
`world_context` belong in your backend's creation request. The SDK forwards
`context` belong in your backend's creation request. The SDK forwards

Check warning on line 118 in agents/deploy/authenticated-sessions.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/deploy/authenticated-sessions.mdx#L118

Did you really mean 'backend's'?
these options (and its `language` shorthand for `overrides.language`) only in
[public agent](/agents/deploy/public-agents) mode.
</Note>
Expand All @@ -125,17 +125,17 @@
| 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`. |

Check warning on line 128 in agents/deploy/authenticated-sessions.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/deploy/authenticated-sessions.mdx#L128

Did you really mean 'keyless'?
| `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, up to 256 characters. Stored on the session, returned on [session queries](/agents/monitor/conversation-history) where you can also filter by it, and echoed in [webhook](/agents/monitor/webhooks) payloads and [custom LLM](/agents/build/custom-llm) requests. |
| `metadata` | object, optional | Your own key-value namespace. Stored and returned verbatim on session queries and webhooks, never read or interpreted by the platform. |

Check warning on line 133 in agents/deploy/authenticated-sessions.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/deploy/authenticated-sessions.mdx#L133

Did you really mean 'namespace'?
| `llm_extra_body` | object, optional | JSON object (at most 16 KB) forwarded verbatim to your [custom LLM](/agents/build/custom-llm) endpoint on every request as `fishaudio_extra_body`, for example the chat or thread the user is in. Not stored or returned on session reads; ignored when the agent uses a platform model. |
| `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; omit it to use the agent's configuration. |
| `timezone` | string, optional | IANA timezone (like `Asia/Tokyo`) 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 device timezone as an IANA name. A hint, not a demand: it applies only when neither `timezone` nor the agent's configured timezone is set, and invalid values are ignored. The SDK fills it automatically in public-agent mode. From your backend, forward the value from your client. See the [resolution order](/agents/build/time-timezone). |
| `world_context` | boolean, optional | Whether the agent knows the current date and time. Default `true`; set `false` to withhold both from this session. |
| `context` | object, optional | Per-session overrides of the agent's [context switches](/agents/build/configuration#context). `{ "current_time": false }` withholds the current date and time from this session, `true` injects them even when the agent has them off; omit a switch to follow the agent. `world_context` is a deprecated alias of `context.current_time`. |

Unknown fields (top-level or inside `overrides`) are rejected with `422`.

Expand All @@ -158,7 +158,7 @@
"agent_id": "YOUR_AGENT_ID",
"overrides": {
"first_message": "Welcome back, {{name}}, picking up where we left off.",
"voice_id": "802e3bc2b27e49c2995d23ef70e6ac89",

Check warning on line 161 in agents/deploy/authenticated-sessions.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/deploy/authenticated-sessions.mdx#L161

Did you really mean 'voice_id'?
"language": "ja"
}
}
Expand Down Expand Up @@ -223,7 +223,7 @@

| Status | Meaning |
| ------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `400` | A keyless (public-agent) request sent an override [public sessions don't accept](#overrides), or a `name`. |

Check warning on line 226 in agents/deploy/authenticated-sessions.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/deploy/authenticated-sessions.mdx#L226

Did you really mean 'keyless'?
| `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. |
Expand Down
2 changes: 1 addition & 1 deletion agents/deploy/web-sdk.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
title: "Web SDK"
description: "Voice sessions in the browser with @fishaudio/agent-client: options, events, transcripts, text input, audio controls, client tools, and errors"
icon: "js"

Check warning on line 4 in agents/deploy/web-sdk.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/deploy/web-sdk.mdx#L4

Did you really mean 'js'?
---

`@fishaudio/agent-client` runs a live voice conversation with your agent from any web page: open the microphone, stream audio both ways, and react to typed events for transcripts, agent state, and tool calls. The SDK handles the realtime transport (WebRTC) internally.

Check warning on line 7 in agents/deploy/web-sdk.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/deploy/web-sdk.mdx#L7

Did you really mean 'realtime'?

Using React? [`@fishaudio/agent-react`](/agents/deploy/react-sdk) wraps this SDK in hooks and a provider.

Expand Down Expand Up @@ -55,7 +55,7 @@

</CodeGroup>

`start()` resolves once the realtime connection is up and rejects with a [`FishAgentError`](#errors) if session creation, the microphone permission, or the connection fails. Call it from a user gesture (a click handler): browsers only grant the microphone and audio playback inside one.

Check warning on line 58 in agents/deploy/web-sdk.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/deploy/web-sdk.mdx#L58

Did you really mean 'realtime'?

### Options

Expand All @@ -65,16 +65,16 @@
| `serverUrl` | `string` | API base used in `agentId` mode. Default `https://api.fish.audio` |
| `clientTools` | `Record<string, ClientToolHandler>` | Handlers for [client tools](/agents/build/client-tools) declared on the agent |
| `clientToolTimeoutMs` | `number` | Per-handler timeout for client tools, in milliseconds. Default `15000` |
| `overrides` | `SessionOverrides` | Per-session config [overrides](/agents/deploy/authenticated-sessions#overrides) (`agentId` mode only; with `sessionToken`, your backend sends them when creating the session). Keyless sessions accept only `voice_id` and `language`; the prompt-shaping fields are rejected with `400` |

Check warning on line 68 in agents/deploy/web-sdk.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/deploy/web-sdk.mdx#L68

Did you really mean 'Keyless'?
| `dynamicVariables` | `Record<string, string \| number \| boolean>` | Values for `{{placeholders}}` in the agent config; see [Dynamic variables](/agents/build/dynamic-variables) (`agentId` mode only) |
| `language` | `SessionLanguage`, the code of one of the [52 supported languages](/agents/build/voice-language#speaking-language) | Shorthand
for `overrides.language` (`agentId` mode only). Omit it to use the agent's configured [speaking language](/agents/build/voice-language#speaking-language); any other value is rejected with `422` |
| `toolEvents` | `boolean` | Whether tool lifecycle events reach this client (default `true`; `agentId` mode only, with `sessionToken` your backend sets `tool_events`) |
| `timezone` | `string` | IANA timezone for the agent's sense of local time: the top of the [resolution order](/agents/build/time-timezone), overriding the agent's configured timezone. When omitted, the SDK still sends the browser timezone as a lower-priority hint (`client_timezone`), which applies only if the agent has no timezone configured |
| `worldContext` | `boolean` | Whether the agent knows the current date and time (default `true`; `agentId` mode only, with `sessionToken` your backend sets `world_context`) |
| `context` | `{ currentTime?: boolean }` | Per-session overrides of the agent's [context switches](/agents/build/configuration#context): `currentTime: false` withholds the current date and time, `true` injects them even when the agent has them off, omit it to follow the agent (`agentId` mode only, with `sessionToken` your backend sets `context`). `worldContext` is a deprecated alias of `context.currentTime` |
| `endUserId` | `string` | Your identifier for the end user, stored on the session and echoed in [webhooks](/agents/monitor/webhooks) (`agentId` mode only; with `sessionToken` your backend sets `end_user_id`) |
| `metadata` | `object` | Your own key-values, stored on the session record and returned verbatim (`agentId` mode only; with `sessionToken` your backend sets `metadata`) |
| `microphone` | `boolean` | Capture the microphone on start (default `true`). `false` joins muted with no permission prompt, for text-first UIs; the first `setMicMuted(false)` captures it, so call that from a user gesture |

Check warning on line 77 in agents/deploy/web-sdk.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/deploy/web-sdk.mdx#L77

Did you really mean 'UIs'?
| `audio` | `{ inputDeviceId?, outputDeviceId? }` | Pick specific microphone and output devices. `start()` rejects with `device_change_failed` if the output device cannot be selected |
| `wakeLock` | `boolean` | Hold a screen wake lock while the session is live, so long calls survive the phone trying to sleep (default `true`). A denied or unsupported wake lock is silent |
| `callbacks` | `Partial<AgentSessionCallbacks>` | Shorthand for `.on()`: each `onXxx` key subscribes the `xxx` [event](#events), so `onUserTranscript` subscribes `userTranscript`. From 0.2.1, a key that is not a known event name throws a `TypeError` |
Expand All @@ -101,7 +101,7 @@
└───────────(failure)───────────→ ended
```

`start()` resolves once the realtime connection is up; the agent itself joins moments later. If it has not joined within 15 seconds, the session emits a `connection_failed` error and ends with reason `connection_lost` instead of idling on a dead call.

Check warning on line 104 in agents/deploy/web-sdk.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/deploy/web-sdk.mdx#L104

Did you really mean 'realtime'?

When the session ends, `disconnect` fires with a reason (also available as `session.endReason`):

Expand Down Expand Up @@ -163,7 +163,7 @@

Transcripts on both sides arrive as **segments**, one segment per utterance or response, identified by `segmentId`:

- **User segments**: interim results **replace the entire segment text** (they never append). Render by upserting on `segmentId`; `final: true` marks the segment as finalized.

Check warning on line 166 in agents/deploy/web-sdk.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/deploy/web-sdk.mdx#L166

Did you really mean 'upserting'?
- **Agent segments**: text streams in sync with audio playback: what you display matches what the user has actually heard. If the agent is interrupted, the segment finalizes containing only the words that were spoken. A reply that spans several speech segments (for example around a tool call) arrives as several segments.
- The `message` event delivers only finalized messages from both sides, in order. Use it when you want a simple transcript list without handling interim updates.

Expand Down Expand Up @@ -212,7 +212,7 @@

| Method / property | Description |
| ------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `setMicMuted(muted)` / `micMuted` | Mute or unmute the microphone. After a `microphone: false` start, the first unmute captures the microphone (permission prompt, so call it from a user gesture) and rejects with `mic_permission_denied` if refused |

Check warning on line 215 in agents/deploy/web-sdk.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/deploy/web-sdk.mdx#L215

Did you really mean 'unmute'?

Check warning on line 215 in agents/deploy/web-sdk.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/deploy/web-sdk.mdx#L215

Did you really mean 'unmute'?
| `setOutputVolume(v)` | Set playback volume, `0`–`1` |
| `getInputVolume()` / `getOutputVolume()` | Current mic / agent volume, `0`–`1`; poll per frame |
| `getInputFrequencyData()` / `getOutputFrequencyData()` | FFT data as `Uint8Array`, for visualizers |
Expand Down Expand Up @@ -267,7 +267,7 @@
| `unsupported_transport` | The session token uses a transport this SDK version doesn't know; upgrade the SDK |
| `mic_permission_denied` | The user denied microphone access; the SDK ends the session |
| `device_change_failed` | A requested audio device could not be activated, or the browser doesn't support selecting it (output selection is unsupported on some mobile browsers). Thrown from `start()` with `audio.outputDeviceId` set, or from device-switching calls |
| `connection_failed` | The realtime connection could not be established or recovered, a message to the agent could not be sent, the agent never joined (15 s), or the microphone could not be toggled |

Check warning on line 270 in agents/deploy/web-sdk.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

agents/deploy/web-sdk.mdx#L270

Did you really mean 'realtime'?
| `session_expired` | The session token's join deadline passed before connecting |
| `tool_failed` / `tool_timeout` | A client tool handler threw, was not registered, or its result could not be delivered / a handler exceeded `clientToolTimeoutMs` |
| `provider_error` / `internal_error` | The session failed server-side: upstream model/voice provider vs. platform runtime. Emitted on `error`; the session may recover |
Expand Down
Loading
Loading