#injectUserMessage in Voice Agent does not start speaking when larger messages are injected.
1 messages · Page 1 of 1 (latest)
Hi @gloomy tree. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
Based on the available Deepgram documentation, the InjectUserMessage is designed to send a text-based message to the agent, simulating user speech and prompting the agent to respond as if the user had spoken the message aloud. The expected flow is that after injecting a user message, the agent should process it and respond accordingly, with events such as ConversationText and agent speech output following the UserStartedSpeaking event Inject User Message.
However, the documentation does not specify a maximum payload size for InjectUserMessage, nor does it describe behavior when very large messages (such as file contents) are injected. There is also no mention of a specific error or warning event for oversized injected user messages. The only related warning described is for prompts that are too long (PROMPT_TOO_LONG), but this applies to the agent's prompt configuration, not user-injected messages Agent Warnings.
Given your observation that injecting a large message results in only a UserStartedSpeaking event and then a freeze, it is possible that:
- There may be an undocumented size or complexity limit for InjectUserMessage payloads.
- The agent may be unable to process or respond to very large or non-conversational text, causing it to hang.
- No explicit error or warning is returned to the client in this scenario.
Recommended actions:
- Try injecting a shorter message to confirm that the agent responds as expected.
- Gradually increase the message size to identify if/when the issue occurs.
- Avoid injecting file contents or very large text blocks as user messages; these are likely outside the intended use case for conversational input.
- Monitor for any Warning or Error events from the server, as these may provide additional clues.
If you require the agent to process large text or file content, consider alternative approaches, such as summarizing or chunking the content before injection.
Summary:
The knowledge sources do not explicitly document a size limit or error handling for large InjectUserMessage payloads, but your described behavior suggests there may be an implicit limit or processing constraint. For best results, keep injected user messages concise and conversational Inject User Message Agent Warnings.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@gloomy tree Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@river moat can i inject message in the context without the agent replying and without disconnecting the agent?
Let me check the knowledge base for you again. One moment! :books:
You cannot inject a message into the agent's context during an active session without triggering a reply from the agent using the standard client messages. The available mechanisms for interacting with the agent in real time are:
- InjectUserMessage: This simulates user speech and always prompts the agent to respond Inject User Message.
- InjectAgentMessage: This immediately triggers an agent statement, i.e., the agent speaks the injected message Inject Agent Message.
The only way to provide context (such as conversation or function call history) without triggering a reply is at session start, by including it in the agent context via the Settings message. This context is used to inform the agent but does not cause an immediate response Agent Context.
There is no documented method to update the agent's context mid-session without causing a reply or disconnecting the agent. The knowledge sources do not mention a way to silently inject context during an ongoing session.
Summary:
You can only inject context/history at session start. All real-time injection methods will trigger a reply from the agent. There is no supported way to silently update the agent's context during an active session without a reply or disconnect Agent Context Inject User Message.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@gloomy tree Kapa.ai is still learning and improving, please let me know how I did by reacting below.
You should provide an ability update agent context in mid session
@river moat
Let me check the knowledge base for you again. One moment! :books: