Conversation Context
When starting a new conversation session with the Voice Agent, you can provide historical context about previous conversations using the agent.context
parameter. This allows the agent to maintain awareness of prior conversations, enabling more coherent and contextual conversations.
Purpose
Conversation history is particularly useful when:
- Resuming a conversation from a previous session
- Providing context about what has already been discussed
- Maintaining personality and conversation style consistency
- Enabling the agent to reference previous statements or topics
Message Schema
Conversation context is included in the conversation history using the History
message type with content
fields. Each message represents either a user statement or an assistant response from previous interactions.
Conversation history can be disabled by setting settings.flags.history
to false
in the agent configuration. History is enabled by default.
Multiple Message Types
Conversation history works seamlessly with Function Call Context history to provide complete context. You can mix conversation messages and function call messages in the same context array.
Conversation Context History Structure
Each conversation history entry contains the following fields:
Benefits of Conversation Context History
Natural Flow
Maintain chronological order of conversation messages to preserve dialogue flow.
Complete Context
Include both user and assistant messages to provide balanced conversational context.
Relevant History Only
Include only conversation history that’s relevant to the current session to avoid overwhelming the context.
Accurate Content
Ensure the content accurately represents what was actually said for consistency.
Best Practices
Relevant Context Only
Include only conversation history that’s relevant to the current session to avoid overwhelming the context window.
Balanced History
Include both user and assistant messages to provide complete conversational context rather than just one side of the exchange.
Natural Transitions
When resuming conversations, ensure the history provides enough context for natural continuation without jarring transitions.
Content Accuracy
Ensure the content accurately represents what was actually said to maintain trust and consistency in the agent’s understanding.