Conversational agents
Context
Providing agents with context to make better decisions
The most important part of building a great agent is giving it the right context. In practice, we’ve found that preloading context—before a conversation begins—is the single highest-leverage way to improve agent performance.
Preload hooks
You can preload context in a few different ways:
- API trigger: If you’re starting a conversation via the API, include a
context
object in your request.- This does not work for inbound calls, since they are initiated by the customer and not by you.
- CRM integration: If you’re using a supported CRM, we will automatically look up the customer based on identifiers like phone number or email. The agent will receive basic personalization context such as:
- Name
- Location
- Company
- Webhook: Configure a webhook to dynamically provide context.
- Before every conversation, the agent sends a
conversation.setup
event to your webhook endpoint. - Your server responds with the context you want to inject into the agent.
- Before every conversation, the agent sends a
How the context is used
Context provided via the API or webhook is used in two ways:
- It’s injected into the agent’s runtime context
- It’s available for prompt templating. You can define template variables in the Advanced tab and reference them in the prompt using
$variable_name
Examples
- Trucking/logistics: Current load assignments, vehicle status, recent and upcoming jobs, etc.
- Customer support: Account details, open support tickets, purchase history, recently closed tickets, etc.
- Healthcare: Appointment history, insurance information, previous visits, etc.