{"client_messages":{"$defs":{"AudioFormat":{"additionalProperties":false,"properties":{"input_sample_rate":{"default":16000,"title":"Input Sample Rate","type":"integer"},"output_sample_rate":{"default":16000,"title":"Output Sample Rate","type":"integer"}},"title":"AudioFormat","type":"object"},"ContextAdd":{"additionalProperties":false,"properties":{"type":{"const":"context.add","title":"Type","type":"string"},"text":{"maxLength":4000,"minLength":1,"title":"Text","type":"string"}},"required":["type","text"],"title":"ContextAdd","type":"object"},"InputText":{"additionalProperties":false,"properties":{"type":{"const":"input.text","title":"Type","type":"string"},"text":{"maxLength":4000,"minLength":1,"title":"Text","type":"string"}},"required":["type","text"],"title":"InputText","type":"object"},"SessionEnd":{"additionalProperties":false,"properties":{"type":{"const":"session.end","title":"Type","type":"string"}},"required":["type"],"title":"SessionEnd","type":"object"},"SessionOverrides":{"additionalProperties":false,"properties":{"instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Appended to the agent's instructions for this session","title":"Instructions"},"greeting":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Greeting"},"kb_ids":{"anyOf":[{"items":{"format":"uuid","type":"string"},"type":"array"},{"type":"null"}],"default":null,"description":"Replace the agent's knowledge bases (same tenant)","title":"Kb Ids"},"context":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"description":"Facts about the caller from your systems, e.g. {name, plan}. Given to the agent.","title":"Context"}},"title":"SessionOverrides","type":"object"},"SessionStart":{"additionalProperties":false,"properties":{"type":{"const":"session.start","title":"Type","type":"string"},"agent_id":{"format":"uuid","title":"Agent Id","type":"string"},"overrides":{"$ref":"#/$defs/SessionOverrides","default":{"instructions":null,"greeting":null,"kb_ids":null,"context":null}},"audio":{"$ref":"#/$defs/AudioFormat","default":{"input_sample_rate":16000,"output_sample_rate":16000}},"barge_in":{"default":true,"description":"Let the caller interrupt the agent. Turn off without echo cancellation.","title":"Barge In","type":"boolean"},"echo_cancelled":{"default":false,"description":"The caller's audio is already echo-cancelled (phone networks, softphones): skip the audio echo check, which can mistake a caller talking over the agent for echo. Transcripts that repeat the agent's own words are still dropped.","title":"Echo Cancelled","type":"boolean"},"metadata":{"additionalProperties":true,"default":{},"description":"Stored with the session; not shown to the agent","title":"Metadata","type":"object"}},"required":["type","agent_id"],"title":"SessionStart","type":"object"},"ToolResult":{"additionalProperties":false,"properties":{"type":{"const":"tool.result","title":"Type","type":"string"},"call_id":{"title":"Call Id","type":"string"},"result":{"default":null,"title":"Result"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Error"}},"required":["type","call_id"],"title":"ToolResult","type":"object"}},"discriminator":{"mapping":{"context.add":"#/$defs/ContextAdd","input.text":"#/$defs/InputText","session.end":"#/$defs/SessionEnd","session.start":"#/$defs/SessionStart","tool.result":"#/$defs/ToolResult"},"propertyName":"type"},"oneOf":[{"$ref":"#/$defs/SessionStart"},{"$ref":"#/$defs/InputText"},{"$ref":"#/$defs/ContextAdd"},{"$ref":"#/$defs/ToolResult"},{"$ref":"#/$defs/SessionEnd"}]},"server_messages":{"$defs":{"AgentInterrupted":{"additionalProperties":false,"description":"The caller interrupted: discard any agent audio you have queued for playback.","properties":{"type":{"const":"agent.interrupted","default":"agent.interrupted","title":"Type","type":"string"}},"title":"AgentInterrupted","type":"object"},"AgentThinking":{"additionalProperties":false,"properties":{"type":{"const":"agent.thinking","default":"agent.thinking","title":"Type","type":"string"}},"title":"AgentThinking","type":"object"},"AudioFormat":{"additionalProperties":false,"properties":{"input_sample_rate":{"default":16000,"title":"Input Sample Rate","type":"integer"},"output_sample_rate":{"default":16000,"title":"Output Sample Rate","type":"integer"}},"title":"AudioFormat","type":"object"},"Error":{"additionalProperties":false,"properties":{"type":{"const":"error","default":"error","title":"Type","type":"string"},"code":{"title":"Code","type":"string"},"message":{"title":"Message","type":"string"},"fatal":{"default":false,"title":"Fatal","type":"boolean"}},"required":["code","message"],"title":"Error","type":"object"},"Metrics":{"additionalProperties":false,"properties":{"type":{"const":"metrics","default":"metrics","title":"Type","type":"string"},"stt":{"anyOf":[{"type":"number"},{"type":"null"}],"default":null,"title":"Stt"},"llm":{"anyOf":[{"type":"number"},{"type":"null"}],"default":null,"title":"Llm"},"tts":{"anyOf":[{"type":"number"},{"type":"null"}],"default":null,"title":"Tts"}},"title":"Metrics","type":"object"},"RagHit":{"additionalProperties":false,"properties":{"kb_id":{"title":"Kb Id","type":"string"},"source":{"title":"Source","type":"string"},"section":{"title":"Section","type":"string"},"score":{"title":"Score","type":"number"},"text":{"title":"Text","type":"string"}},"required":["kb_id","source","section","score","text"],"title":"RagHit","type":"object"},"RagResults":{"additionalProperties":false,"properties":{"type":{"const":"rag.results","default":"rag.results","title":"Type","type":"string"},"via":{"enum":["auto","tool"],"title":"Via","type":"string"},"query":{"title":"Query","type":"string"},"hits":{"items":{"$ref":"#/$defs/RagHit"},"title":"Hits","type":"array"}},"required":["via","query","hits"],"title":"RagResults","type":"object"},"SessionEnded":{"additionalProperties":false,"properties":{"type":{"const":"session.ended","default":"session.ended","title":"Type","type":"string"},"session_id":{"title":"Session Id","type":"string"},"reason":{"title":"Reason","type":"string"},"duration_secs":{"title":"Duration Secs","type":"number"},"transcript":{"items":{"additionalProperties":{"type":"string"},"type":"object"},"title":"Transcript","type":"array"}},"required":["session_id","reason","duration_secs","transcript"],"title":"SessionEnded","type":"object"},"SessionStarted":{"additionalProperties":false,"properties":{"type":{"const":"session.started","default":"session.started","title":"Type","type":"string"},"session_id":{"title":"Session Id","type":"string"},"agent":{"additionalProperties":{"type":"string"},"title":"Agent","type":"object"},"audio":{"$ref":"#/$defs/AudioFormat"}},"required":["session_id","agent","audio"],"title":"SessionStarted","type":"object"},"Speech":{"additionalProperties":false,"properties":{"type":{"enum":["caller.speech","agent.speech"],"title":"Type","type":"string"},"state":{"enum":["started","stopped"],"title":"State","type":"string"},"latency":{"anyOf":[{"type":"number"},{"type":"null"}],"default":null,"description":"On agent.speech started: seconds from the end of the caller's turn to the agent's first audio","title":"Latency"}},"required":["type","state"],"title":"Speech","type":"object"},"ToolCall":{"additionalProperties":false,"properties":{"type":{"const":"tool.call","default":"tool.call","title":"Type","type":"string"},"call_id":{"title":"Call Id","type":"string"},"name":{"title":"Name","type":"string"},"arguments":{"additionalProperties":true,"title":"Arguments","type":"object"}},"required":["call_id","name","arguments"],"title":"ToolCall","type":"object"},"Transcript":{"additionalProperties":false,"description":"Caller text streams live: `final: false` messages carry the words so far and are replaced\nby the next one; `final: true` is the settled text for that stretch of speech. Agent lines\nare always final, sent as each sentence is spoken.","properties":{"type":{"const":"transcript","default":"transcript","title":"Type","type":"string"},"role":{"enum":["caller","agent"],"title":"Role","type":"string"},"text":{"title":"Text","type":"string"},"final":{"default":true,"title":"Final","type":"boolean"}},"required":["role","text"],"title":"Transcript","type":"object"}},"discriminator":{"mapping":{"agent.interrupted":"#/$defs/AgentInterrupted","agent.speech":"#/$defs/Speech","agent.thinking":"#/$defs/AgentThinking","caller.speech":"#/$defs/Speech","error":"#/$defs/Error","metrics":"#/$defs/Metrics","rag.results":"#/$defs/RagResults","session.ended":"#/$defs/SessionEnded","session.started":"#/$defs/SessionStarted","tool.call":"#/$defs/ToolCall","transcript":"#/$defs/Transcript"},"propertyName":"type"},"oneOf":[{"$ref":"#/$defs/SessionStarted"},{"$ref":"#/$defs/Transcript"},{"$ref":"#/$defs/Speech"},{"$ref":"#/$defs/AgentThinking"},{"$ref":"#/$defs/AgentInterrupted"},{"$ref":"#/$defs/ToolCall"},{"$ref":"#/$defs/RagResults"},{"$ref":"#/$defs/Metrics"},{"$ref":"#/$defs/Error"},{"$ref":"#/$defs/SessionEnded"}]},"audio":"Binary frames: PCM s16le mono at the negotiated sample rates; 20 ms chunks recommended.","close_codes":{"4401":"missing or invalid API key / ticket","4400":"invalid or missing session.start","4404":"agent or knowledge base not found","4429":"tenant concurrent-session limit reached","4503":"this service instance is at capacity"}}