When starting a new conversation session with the Voice Agent, you can provide historical context about previous function calls using the agent.context parameter. This allows the agent to maintain awareness of past function executions, enabling more coherent and contextual conversations.
Function call context is particularly useful when:
Function call context is included in the conversation history using the History message type with a function_calls array. Each function call entry contains complete information about the execution, including arguments and results.
Function call context can be disabled by setting settings.flags.history to false in the agent configuration. History is enabled by default.
Function call history works seamlessly with Conversation Context to provide complete context. You can mix conversation messages and function call messages in the same context array.
Each function call in the history includes the following fields:
Including function call history in your agent context provides several advantages:
The agent understands what functions were previously called and their results, enabling natural conversation flow across sessions.
The agent can reference previous function results instead of making redundant calls for the same information.
The agent can make informed decisions based on the complete interaction history, including both conversations and actions taken.
Users can refer to previous actions (“like we did before”) and the agent will understand the context.
In most cases the LLM will assign ids. If the LLM does not assign ids, Deepgram will assign ids to the function calls.
Include both the arguments passed to the function and the complete response received.
Maintain the chronological order of function calls and conversations in your history.
Include only the function call history that’s relevant to the current conversation to avoid overwhelming the context.