Inject Agent Message
Send a message to immediately trigger an Agent statement.
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?")
What is the InjectAgentMessage
InjectAgentMessage
TheInjectAgentMessage
message is a JSON command you can send to immediately trigger an agent statement. If the injection request arrives while the user is speaking, or while the server is in the middle of sending audio for an agent response, then the request will be ignored and the server will reply with anInjectionRefused
. The client should only try to inject agent messages during silent portions of the conversation.
Sending InjectAgentMessage
InjectAgentMessage
To send the InjectAgentMessage
message, you need to send the following JSON message to the server:
{
"type": "InjectAgentMessage",
"message": "" // The statement the agent should say
}
InjectAgentMessage
Confirmation
InjectAgentMessage
Confirmation{
"type": "AgentAudioDone"
}
InjectAgentMessage
Rejection
InjectAgentMessage
Rejection{
"type": "InjectionRefused"
}
Conclusion
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.
Updated about 5 hours ago