Skip to main content
Call variables are provided as a convenient way to pass per-call data (patient name, account ID, etc.) between agent handlers. Variables can be seeded when the call starts and read or updated at any point during the call.
signature

Valid variable values

Variable values must be JSON-serializable: strings, numbers, booleans, None, and dicts/lists composed of those types.

Seeding variables at call start

For the following types of calls, variables can be seeded at the start.
  • Outbound calls — pass a variables dict to call_phone()
  • Campaigns — each contact’s data dict becomes that contact’s variables

Other ways to store call state

As an alternative to call variables, you can keep per-call state in an in-process dictionary keyed by call.id. That said, we only recommend this for simple use cases. If your process restarts, any in-memory state will be lost. For durable per-call state, use Redis or another session store keyed by call.id.

Example

example.py