For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Ask AIPlaygroundLoginFree API Key
HomeAPI ReferenceVoice AgentSpeech-to-TextText-to-SpeechIntelligenceSelf-Hosted Deployments
HomeAPI ReferenceVoice AgentSpeech-to-TextText-to-SpeechIntelligenceSelf-Hosted Deployments
  • Get Started
    • Overview
    • Build a Voice Agent
    • Feature Overview
    • Template Apps
  • Configure
    • Overview
    • STT Models
    • LLM Models
    • TTS Models
    • Media Inputs & Outputs
    • Prompting Voice Agents
    • Multilingual Voice Agents
    • Maintaining Context
    • Reusable Agent Configurations
  • Build
    • Multi-Agent Architecture
  • Connect
  • Controls
      • Overview
      • Settings
      • Update Speak
      • Update Think
      • Update Prompt
      • Inject Agent
      • Inject User
      • Agent Keep Alive
  • Optimize
    • Voice Agent TTS Controls
    • Message Flow
    • Audio & Playback
    • Audio Preprocessing & Barge-In
    • Adaptive Echo Cancellation
  • Resources
    • SDKs
    • UI Components
    • API Reference
LogoLogo
Ask AIPlaygroundLoginFree API Key
On this page
  • Purpose
  • Fields
  • behavior values
  • Example Payloads
  • default: wait for silence
  • queue: append after any current ConversationText
  • Responses
  • InjectionRefused
  • Use Cases
  • When to use default
  • When to use queue
ControlsInputs: Client Messages

Inject Agent

Send a message to immediately trigger an Agent statement.
Was this page helpful?
Previous

Inject User

Send a text based message to the agent.
Next
Built with
Voice Agent

The InjectAgentMessage message is a JSON message you can send to immediately trigger an agent statement.

Purpose

InjectAgentMessage lets your server put words in the agent’s mouth mid-conversation. The optional behavior field controls how the message interacts with any ongoing user or agent turn: wait for silence, or queue within the current turn.

Fields

FieldTypeRequiredDescription
typestringYesMust be "InjectAgentMessage".
messagestringYesThe statement the agent should say.
behaviorstringNoHow the injection interacts with the current turn: "default" or "queue". Uses "default" if omitted.

behavior values

  • default: the agent speaks only if neither the user nor the agent is mid-turn. If a turn is in progress, the server rejects the request and replies with InjectionRefused. This matches the original InjectAgentMessage behavior.
  • queue: the server appends the message after any ConversationText that is already queued, without interrupting the current agent turn or the in-flight think response. If nothing is queued, the agent speaks the message immediately.

Example Payloads

default: wait for silence

JSON
1{
2 "type": "InjectAgentMessage",
3 "behavior": "default",
4 "message": "Are you still on the line?"
5}

queue: append after any current ConversationText

JSON
1{
2 "type": "InjectAgentMessage",
3 "behavior": "queue",
4 "message": "Thanks for your patience, the system is still loading."
5}

Responses

The server sends an AgentAudioDone message after the last InjectAgentMessage is spoken.

JSON
1{
2 "type": "AgentAudioDone"
3}

InjectionRefused

When behavior is default or queue and the request arrives while the user is mid-turn, the server ignores the request and replies with InjectionRefused. If the agent is mid-turn, the server returns InjectionRefused only when behavior is default.

JSON
1{
2 "type": "InjectionRefused"
3}

Use Cases

Pick the behavior value that matches what you want to happen to the current turn.

When to use default

Use default when the injection is only appropriate during silence and you would rather drop it than step on the conversation.

  • Prompting the user to continue if they have been silent for a while (“Are you still on the line?”).
  • Optional nudges where being ignored is acceptable if the caller is already talking.

When to use queue

Use queue when you want the agent to say something after whatever it is currently saying, without stepping on it. This is the right choice for filler during function calls, where the model has already emitted pre-function narration and you want to extend it rather than replace it.

  • Filling silence during a long-running function call (“One moment while I pull that up”) without cutting off the model’s current response.
  • Chaining a follow-up sentence after the agent finishes its current turn (“…and I’ve also emailed you a copy.”).
  • Streaming progress updates from a backend job so the caller hears them in order.