Using Context with Bolna Voice AI Agents
Learn how to effectively use context in Bolna Voice AI agents to create dynamic, personalized, and meaningful interactions
Injecting current time
By default, the conversation has information about the current date and time in the users’s timezone.
Bolna agents automatically attempt to inject the appropriate timezone during calls. However, for improved accuracy, it is recommended to explicitly pass the timezone, as the automatic detection may not always be precise.
name | description |
---|---|
timezone | Name of the timezone as per the tz database |
Default variables and context
By default, the following variables and information are always available in the conversation context.
name | description |
---|---|
agent_id | This is the id of the agent |
execution_id | This is the unique id of the bolna conversation or the call |
call_sid | This is the unique id of the phone call belonging to telephony providers like Twilio , Plivo , Vonage , etc. |
You may use the above information to pass useful info into your systems or use them in the function calls or prompts.
Example using default variables
For example, adding the below content in the prompt using the above default variables will automatically fill in their values.
The above prompt content computes to and is fed as:
Custom variables and context
Apart from the default variables, you can write your own variables and pass it into the prompt.
Any content written between {}
in the prompt becomes a variable.
For example, adding the below content in the prompt will dynamically fill in the values.
Example using custom variables
You can now pass these values while placing the call:
The above prompt content computes to and is fed as (call_sid
being the default variable gets injected automatically by default):