Conversation Context

Provide conversation context as part of the conversation history when starting a new Voice Agent session.
Voice Agent

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.

JSON
1{
2 "type": "Settings",
3 "settings": {
4 "flags": {
5 "history": true // true by default, set to false to disable
6 }
7 },
8 "agent": {
9 "context": {
10 "messages": [
11 {
12 "type": "History",
13 "role": "user",
14 "content": "Hello, I'm looking for help with my account."
15 },
16 {
17 "type": "History",
18 "role": "assistant",
19 "content": "Hello! I'd be happy to help you with your account. What specific issue are you experiencing?"
20 },
21 {
22 "type": "History",
23 "role": "user",
24 "content": "I can't remember my username."
25 },
26 {
27 "type": "History",
28 "role": "assistant",
29 "content": "I can help you recover your username. I'll need to verify a few details first. Could you provide the email address associated with your account?"
30 }
31 ]
32 },
33 "think": {
34 "provider": {
35 "type": "open_ai",
36 "model": "gpt-4o-mini"
37 }
38 }
39 }
40}

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:

FieldTypeDescription
typeStringMust be “History” to identify this as a history message
roleStringEither “user” (human statements) or “assistant” (agent responses)
contentStringThe actual text content of what was said

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.