Skip to main content
This section requires Python familiarity. If you are a non-technical operator, share this page with your developer. For no-code alternatives, see Managed Topics (actions) or no-code flows.
Use functions when your agent needs to do something the LLM cannot do on its own — look up a booking, call an API, validate input, or write to a CRM. Without functions, your agent can only talk; with them, it can act. Functions are the bridge between conversation and your business systems.
If you are looking for a function that only exists inside a single flow, visit the transition functions page.
Functions are Python scripts for deterministic logic and API integrations. Use conv.log to write logs visible in Conversation reviewDiagnosis. For detailed guides, explore the subpages below:

Guides

Create a function

Set up a function with naming conventions, parameters, and Python code

Libraries

Standard and non-standard libraries available in your functions

Start function

Initialize conversation context before the greeting plays

End function

Run post-call processing after a conversation ends

Return values

Control agent behavior with string and dictionary returns

Variables

Define, update, and persist values across turns

Using tools in topics

Integrate functions into Managed Topics

Delay control

Add filler phrases to avoid silence during slow functions

Reference

conv object

Conversation states, flows, and telephony attributes

conv.log

Structured diagnostics and PII-scoped logging

conv.utils

Built-in helpers for addresses, cities, and structured data

conv.api

Call configured API integrations

ASR biasing

Dynamic speech recognition biasing from functions

History

Access conversation turn history

Voice

Configure TTS voices programmatically

Tool classes

VoiceWeighting, TTSVoice, and provider classes

Agent memory

Persistent data across conversations for repeat callers
If you are looking to use functions to enable multi-site configuration — for example, handling enquiries for multiple store or branch locations — visit the variant management feature page.

Best practices

  • Use descriptive names – Action-oriented names like book_reservation or send_notification help the LLM understand when to call the function.
  • Write clear descriptions – Explain what the function does, its parameters, and when it should be triggered.
  • Use meaningful parameter namesreservation_date is clearer than r_date.
  • Control triggering – Define specific rules to prevent over-triggering or under-triggering.
  • Test thoroughly – Use Test Cases and Test Sets to validate function behavior across scenarios.

Troubleshooting

  • Function not triggering – Check Conversation review → Diagnosis to see if the function was considered. Refine your function description or add clearer rules.
  • Wrong parameters – Review conv.log entries to see what the LLM extracted. Adjust parameter descriptions or add validation.
  • Unexpected behavior – Simplify function logic and test in isolation before integrating with the agent.
Last modified on March 22, 2026