Agent
Orchestrate a complete voice agent by creating a cascaded voice pipeline consisting of your choice of STT, LLM, TTS, VAD and turn-taking components.
The agent verb wires together three components — STT, LLM, and TTS — with integrated turn detection to create a complete voice AI agent. Unlike the llm verb (which connects to speech-to-speech APIs like OpenAI Realtime), the agent verb lets you mix and match separate vendors for each component.
The agent verb manages the full conversational turn cycle:
- User speaks → STT produces a transcript
- Turn detection decides the user is done speaking
- Transcript is sent to the LLM
- LLM response tokens stream to TTS
- TTS audio plays back to the caller
- If the user barges in, TTS stops and a new turn begins
For a comprehensive guide on building voice AI agents with the agent verb, see Voice Agents.
Parameters
A webhook invoked when the agent verb ends. The payload includes a completion_reason field indicating why it terminated.
Controls whether and how the user can interrupt the assistant while it is speaking.
Allow the user to interrupt the assistant while it is speaking.
Seconds of detected speech required before confirming an interruption. Prevents brief noises from cutting off the assistant.
If true, once the user interrupts, the assistant does not resume speaking the interrupted response.
Enable speculative LLM prompting before end-of-turn is confirmed. If the transcript matches when the turn ends, buffered tokens are released immediately — reducing response latency. Works with Krisp turn detection, Deepgram Flux and Speechmatics agent mode. With Deepgram Flux you must also set stt.deepgramOptions.eagerEotThreshold, or early generation never starts. Tool calls chosen by a speculative reply run only after the end of turn is confirmed. See Early Generation.
A webhook invoked for agent events. Receives event types: user_transcript, llm_response, user_interruption, turn_end, history_summarized, overlapping_speech, interrupt_prediction_ignored, no_response_timeout and llm_error. See eventHook Events below.
How the agent opens the call. true: the LLM generates a greeting before the user speaks. false: the agent waits silently for the user to speak first. A string: the agent speaks these exact words as its first turn, without calling the LLM; the user can interrupt it, and the conversation history records it as the agent’s first reply.
Declarative transfer-to-human configuration. When present, the runtime injects a
transfer_to_human tool into the LLM’s toolset and runs the packaged
transfer choreography when the model calls it. See
Transfer-to-human handoff.
Enable the built-in hangup tool. When present, the runtime injects a hangup tool into the LLM’s toolset; when the LLM calls it, the call is ended. See Built-in Hangup Tool below.
Default reason placed in the X-Reason SIP header on the outbound BYE. Used as a fallback when the LLM does not supply its own reason at call time.
An optional unique identifier for this verb instance.
LLM configuration. This is the only required property. See Bring Your Own LLM for the full list of supported vendors and per-vendor setup.
LLM vendor id. One of: anthropic, azure-openai, baseten, bedrock, deepseek, google, groq, huggingface, moonshot, openai, vertex-gemini, vertex-openai, xai, zai. See Bring Your Own LLM for setup of each.
Model name. Format is vendor-specific (e.g., gpt-4o-mini, claude-haiku-4-5-20251001, gemini-2.5-flash, llama-3.3-70b-versatile, meta-llama/Llama-3.3-70B-Instruct). For Azure OpenAI, this is your deployment name, not the model id.
Only needed when the account has more than one LLM credential for the same vendor — give each a distinct label in the portal at create time and reference it explicitly here. Most accounts have a single credential per vendor and should leave this unset.
Inline authentication credentials. Format depends on the vendor — see the per-vendor pages under Bring Your Own LLM. If not provided, jambonz looks up credentials by vendor (and label, if the rare multi-credential case applies) from the LLM Services configured in the portal.
LLM options including system prompt, tools, and generation parameters.
Initial conversation messages. Typically includes a system message with instructions: [{ role: 'system', content: '...' }].
System prompt for the LLM. Alternative to providing a system message in messages.
Tool/function definitions available to the LLM. Uses OpenAI function-calling format. See Tool Calling below.
Maximum number of tokens in the LLM response.
Vendor-specific request parameters that jambonz has no first-class option for, passed to the vendor as-is. For example, OpenRouter’s provider routing: { provider: { sort: 'latency' }, models: ['openai/gpt-4.1-mini'] } (see OpenRouter).
- Fields are added to the request body for OpenAI-compatible vendors (
openai,openrouter,groq,deepseek,xai,azure-openai, …) and to the generation config forgoogleandvertex-gemini.anthropicandbedrockignore it. - It can only add fields. Anything jambonz sets on the request wins:
model, messages and tools always, and max tokens and temperature when you setmaxTokensortemperature. - Commonly used parameters, tested by us: OpenAI, Google, DeepSeek, OpenRouter.
- jambonz does not validate the contents. A misspelled field, or one the vendor rejects, surfaces as a vendor error on the first turn.
External MCP servers that provide tools to the LLM. The agent verb connects to each server at startup, discovers available tools, and makes them callable by the LLM. Each entry requires a url property and optionally auth and roots.
Enable server-side noise isolation to reduce background noise. As a string, pass "krisp", "rnnoise" or "kugelaudio" for default settings. As an object: { mode: "krisp", level: 80, direction: "read" }. direction can be "read" (filter caller audio, default) or "write" (filter outbound audio). Krisp requires an API key on self-hosted systems. For "kugelaudio", the object also takes label (which KugelAudio speech credential to use) and auth ({apiKey, apiUri} on the verb instead of a credential); see KugelAudio Clarity.
Seconds to wait after the assistant finishes speaking before prompting the user to respond. When triggered, the LLM is prompted with a system cue to check if the user is still there. Set to 0 to disable.
End the agent after this many no-response prompts in a row get no reply. The actionHook then fires with completion_reason: "no_response", so your application decides what happens next, for example saying goodbye and hanging up. The count resets whenever the user speaks. 0 or unset: no limit. Added in 11.1.6.
Speech-to-text configuration. See recognizer for available properties. Key properties: vendor, language, hints, and vendor-specific options like deepgramOptions.
A webhook invoked when the LLM requests a tool/function call. The payload includes tool_call_id, name, and arguments (already parsed as an object). See Tool Calling below.
Text-to-speech configuration. See synthesizer for available properties. Key properties: vendor, voice, language, and vendor-specific options.
Turn detection strategy. Controls when the agent verb decides the user has finished speaking.
As a string:
"stt"— Uses the STT vendor’s native end-of-utterance signal. For most vendors this is silence-based. Vendors with smarter built-in turn detection (deepgramflux, assemblyai, speechmatics) always use their native detection regardless of this setting."krisp"— Uses the Krisp acoustic end-of-turn model, which analyzes speech patterns rather than just silence.
As an object (Krisp only):
mode—"krisp"(required)threshold— Confidence threshold 0.0–1.0. Lower values trigger earlier turn transitions. Default: 0.5.model— Optional Krisp model name override.
Krisp turn detection and noise isolation features require a Krisp API license key on self-hosted jambonz deployments. This license is not included with the jambonz software license and must be obtained separately from Krisp.
Contact support@jambonz.org for information on obtaining a Krisp license for your self-hosted deployment.
This requirement does not apply to jambonz.cloud customers — Krisp features are included with all jambonz.cloud plans.
Tool Calling
Define tools in llm.llmOptions.tools and handle calls via toolHook. The tool call payload includes tool_call_id, name, and arguments (already parsed — an object, not a JSON string).
In WebSocket mode, respond with session.sendToolOutput(tool_call_id, result):
In webhook mode, return the tool result as JSON in the HTTP response body.
Alternatively, connect external MCP servers to provide tools automatically without defining them inline.
MCP Servers
Instead of (or in addition to) defining tools inline, you can connect to external MCP servers. The agent verb connects to each server at startup via SSE or Streamable HTTP transport, discovers available tools, and makes them callable by the LLM.
When the LLM requests a tool call, the agent verb checks MCP servers first. If the tool name matches one discovered from an MCP server, the call is dispatched there directly. If no MCP server provides the tool, it falls through to the toolHook.
Transfer-to-human handoff
Add a handoff block to let the agent transfer the caller to a human. The runtime injects
a transfer_to_human tool into the LLM’s toolset — you don’t write a toolHook for it.
When the caller asks for a human and the model calls the tool, jambonz runs the packaged
transfer choreography to the configured destination.
The handoff block accepts every transfer option (mode,
target, blindMethod, disposition, confirm, etc.), plus:
Controls the spoken summary delivered to the human on a warm transfer. 'auto' lets the
LLM write the summary; 'none' sends no spoken brief (and keeps the injected tool
argument-free); { template: '...' } guides the LLM’s summary.
Optional voice/vendor (synthesizer object) for the spoken brief. Defaults to the session synthesizer.
Override the injected tool name.
Override the injected tool description shown to the LLM.
When the human leg bridges, the agent’s actionHook reports the transfer outcome (see the
transfer actionHook properties).
Built-in Hangup Tool
Set hangup to let the LLM end the call on its own. The runtime injects a hangup tool into the LLM’s toolset; you do not define it in llm.llmOptions.tools and you do not handle it in your toolHook — the runtime intercepts the call, hangs up, and ends the agent verb.
The injected tool accepts an optional reason argument that the LLM may fill in when it decides to end the call. The reason placed in the X-Reason SIP header on the outbound BYE is resolved as follows:
- The LLM-supplied
reasonargument, if present. - Otherwise the app-supplied
hangup.reasondefault, if configured. - Otherwise no
X-Reasonheader is sent.
Pass an empty object (hangup: {}) to enable the tool with no default reason.
When the LLM calls the hangup tool, the call is released immediately. The actionHook still fires (with completion_reason: "hangup"), but any follow-on verbs it returns are discarded because the call is already being torn down.
eventHook Events
The eventHook receives real-time events during the conversation. In WebSocket mode, listen with session.on('/your-event-hook', handler).
turn_end
Sent at the end of each conversational turn, including the agent’s greeting. The most useful event for observability.
The greeting’s turn_end has "greeting": true and an empty transcript.
Latency fields (all in milliseconds):
stt_ms— STT processing time (user stops talking → final transcript received)eot_ms— Additional wait for end-of-turn detection after transcriptllm_ms— Pure LLM thinking time (tool RTT subtracted)tool_ms— Total time spent in tool callstts_ms— TTS engine latency (text sent → first audio received)preflight— Early generation metrics:result(hit,miss, orpending) andtokensbuffered on a hit
Timing fields (epoch milliseconds, at the top level of the event):
caller_started_at— when the caller began speaking in this turn; absent when the caller did not speak (for example the greeting)agent_started_at— when the agent began speaking in this turn; absent when the agent did not speak
user_transcript
Sent when the user’s final transcript is available.
llm_response
Sent when the LLM finishes generating its response.
user_interruption
Sent when the user barges in while the assistant is speaking.
cause— what confirmed the barge-in:vad(speech still active afterbargeIn.minSpeechDuration),transcript(words from the recognizer) orinterrupt_prediction(the turn-taking model)probability— the interrupt prediction’s probability; only withinterrupt_predictionspoken_text— the part of the reply the caller heard; absent when not knownspoken_estimated—truewhenspoken_textis estimated from playout time because the TTS vendor reports no word alignment
Speech-to-speech engines send user_interruption with no other fields.
overlapping_speech
Sent when the caller speaks during the assistant’s reply and it is not treated as an interruption (barge-in off, or the interrupt prediction model judged it not an attempt to take the floor).
outcome—ignored: too short to be a turn (a backchannel such as “okay”), dropped.held: kept and added to the caller’s next turn.answered: the reply ended and the held speech became the caller’s turn;transcriptis then all the held speech.
interrupt_prediction_ignored
Sent when the interrupt prediction model fires before the assistant has started speaking. It is usually the tail of the utterance being answered, so it is not treated as an interruption.
state is thinking or awaiting_turn_gate.
no_response_timeout
Sent when the caller has said nothing for noResponseTimeout and the agent prompts them to check they are still there.
count is how many times in a row the agent has prompted the silent caller, this one included.
llm_error
Sent when a request to the LLM fails. Unless retrying is true, the agent verb then ends with completion reason llm_failure.
stage—prompt(the request for a reply),retry_without_tools(the retry of that request without tools) ortool_result(the request that follows a tool result)message— the vendor’s error message, at most 200 characters, with anything that looks like a key or token maskedretrying—truewhen the agent retries the request without tools
history_summarized
Sent when conversation history summarization completes (requires JAMBONES_PIPELINE_SUMMARIZE_TURNS environment variable).
Mid-conversation Updates
The agent verb supports asynchronous updates while a conversation is in progress. Updates can be sent via WebSocket (session.updateAgent(data)) or REST API.
update_instructions
Replace the LLM system prompt mid-conversation.
inject_context
Append messages to the LLM conversation history. System messages are routed to the system prompt for vendors that don’t support inline system messages.
update_tools
Replace the tool set available to the LLM.
generate_reply
Prompt the LLM to generate a new response. Use interrupt: true to cancel the current response and generate immediately.
Supported LLM Vendors
See Bring Your Own LLM for per-vendor credential setup, model recommendations, and known issues.
Example Applications
See the agent examples for runnable demos covering basic usage, tool calling, MCP servers, CRM injection, persona switching, and more.