History

Provide conversation and function call 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 and function calls using the agent.context parameter. This allows the agent to maintain awareness of prior interactions, enabling more coherent and contextual conversations.

Purpose

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, topics, or function results
  • Providing background context about function calls already executed
  • Maintaining continuity in multi-session interactions

History can be disabled by setting settings.flags.history to false in the agent configuration. History is enabled by default.

Conversation Context History

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

Example Payload

Conversation History
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}

Function Call Context History

FieldTypeDescription
typeStringMust be “History” to identify this as a history message
function_callsArrayArray of function call objects with execution details

Each function call in the history includes:

FieldTypeDescription
idStringA unique identifier for the function call
nameStringThe name of the function that was called
client_sideBooleanIndicates if the function was executed client-side or server-side
argumentsStringJSON string containing the arguments passed to the function
responseStringThe response/result returned by the function

Example Payload

Function Call History
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": "What's the weather like in New York?"
15 },
16 {
17 "type": "History",
18 "function_calls": [
19 {
20 "id": "fc_weather_12345",
21 "name": "get_weather",
22 "client_side": true,
23 "arguments": "{\"location\": \"New York\"}",
24 "response": "The current weather in New York is partly cloudy with a temperature of 295.15°K."
25 }
26 ]
27 },
28 {
29 "type": "History",
30 "role": "assistant",
31 "content": "The weather in New York is partly cloudy with a temperature of about 72°F (295.15°K)."
32 }
33 ]
34 },
35 "think": {
36 "provider": {
37 "type": "open_ai",
38 "model": "gpt-4o-mini"
39 },
40 "functions": [
41 {
42 "name": "get_weather",
43 "description": "Get the current weather for a specific location",
44 "parameters": {
45 "type": "object",
46 "properties": {
47 "location": {
48 "type": "string",
49 "description": "The city or location to get weather for"
50 }
51 },
52 "required": ["location"]
53 }
54 }
55 ]
56 }
57 }
58}