Inject Agent
Send a message to immediately trigger an Agent statement.
TheInjectAgentMessage
message is a JSON message you can send to immediately trigger an agent statement.
Purpose
The InjectAgentMessage
message provides a way to immediately trigger an agent response during a conversation. However, it must be carefully timed, as the request will be ignored if the user is speaking or if the agent is already responding. To ensure successful injection, the client should only attempt it during silent moments, avoiding interruptions and potential InjectionRefused
errors.
The client should only try to inject agent messages during silent portions of the conversation.
Example Payloads
To send the InjectAgentMessage
message, you need to send the following JSON message to the server:
After completing the agent’s speech audio transmission, the server sends an AgentAudioDone
message.
The server will send an InjectionRefused
message when an InjectAgentMessage
request is ignored because it arrived while the user was speaking or while the server was sending audio for an agent response.
Use Cases
Some common ways to use the injectAgentMessage
are:
- Informing the user that the agent is working on a lengthy function call (“Hold on while I look that up for you”)
- Prompting the user to continue if the user hasn’t spoken for a while (“Are you still on the line?“)