conv.log to write structured logs that appear in Conversation review → Diagnosis and using the Conversations API.
In the Agent Studio UI, functions are found under Build > Tools in the sidebar. Functions are a type of tool alongside other integrations. The special start function and end function retain their original names.
Subpages
- How to set up a function: Learn how to set up a function, including naming conventions, parameter definitions, and writing Python code.
- How to import libraries: Understand how to use standard and non-standard libraries within your function, enabling external API integrations.
-
How to start a function:
Discover the role of the
start_functionin initializing conversation context and preparing data before user interactions. - Understanding return values: Explore how to use string and dictionary return values to dynamically guide the agent’s behavior.
-
Using the
convobject: Reference theconvobject to manage conversation states, flows, and telephony-related attributes effectively. - Working with variables: Learn how to define, update, and persist variables across turns using the conversation state.
- Invoking functions in the knowledge base: Discover methods for integrating functions into the knowledge base and testing their usage effectively.
- The delay controls interface: Keep the conversation on track in high-latency functions by adding delay phrases.
- Logging from functions (conv.log): Record structured diagnostics and PII-scoped entries for review in Diagnosis and export using the API.
- Conversation utilities (conv.utils): Use built-in helpers to extract and validate structured data like addresses and cities from user input.
- Agent memory: Store and retrieve persistent data about users across conversations for repeat-caller logic and personalization.
Best practices
- Use descriptive names – Action-oriented names like
book_reservationorsend_notificationhelp 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 names –
reservation_dateis clearer thanr_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.logentries 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.

