> ## Documentation Index
> Fetch the complete documentation index at: https://docs.poly.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Tools

> Add custom logic and API integrations using Python functions.

**This section requires Python familiarity.** If you are a non-technical operator, share this page with your developer. For no-code alternatives, see [FAQs](https://docs.poly.ai/knowledge/faqs/introduction.md) (actions) or [no-code flows](https://docs.poly.ai/flows/no-code/introduction.md).

Functions let your agent perform actions during a conversation — looking up a booking, calling an API, validating input, or writing to a CRM.

If you are looking for a function that only exists inside a single [flow](https://docs.poly.ai/flows/introduction.md), visit the [transition functions](https://docs.poly.ai/flows/transition-functions.md) page.

Functions are Python scripts for deterministic logic and API integrations. Use [`conv.log`](./classes/conv-log) to write logs visible in **[Conversation review](https://docs.poly.ai/analytics/conversations/review.md) → [Diagnosis](https://docs.poly.ai/analytics/conversations/diagnosis.md)**.

For detailed guides, explore the subpages below:

## Guides

> [card] [Create a function](https://docs.poly.ai/tools/how-to-setup.md)
>
> Set up a function with naming conventions, parameters, and Python code

> [card] [Libraries](https://docs.poly.ai/tools/import-library.md)
>
> Standard and non-standard libraries available in your functions

> [card] [Start tool](https://docs.poly.ai/tools/start-tool.md)
>
> Initialize conversation context before the greeting plays

> [card] [End tool](https://docs.poly.ai/tools/end-tool.md)
>
> Run post-call processing after a conversation ends

> [card] [Return values](https://docs.poly.ai/tools/return-values.md)
>
> Control agent behavior with string and dictionary returns

> [card] [Variables](https://docs.poly.ai/tools/variables.md)
>
> Define, update, and persist values across turns

> [card] [Using tools in topics](https://docs.poly.ai/tools/using-tools-in-knowledge-base.md)
>
> Integrate functions into FAQs

> [card] [Delay control](https://docs.poly.ai/tools/delay-control.md)
>
> Add filler phrases to avoid silence during slow functions

## Reference

> [card] [conv object](https://docs.poly.ai/tools/classes/conv-object.md)
>
> Conversation states, flows, and telephony attributes

> [card] [conv.log](https://docs.poly.ai/tools/classes/conv-log.md)
>
> Structured diagnostics and PII-scoped logging

> [card] [conv.utils](https://docs.poly.ai/tools/classes/conv-utils.md)
>
> Built-in helpers for addresses, cities, and structured data

> [card] [conv.api](https://docs.poly.ai/tools/classes/conv-api.md)
>
> Call configured API integrations

> [card] [ASR biasing](https://docs.poly.ai/tools/classes/asr-from-conv.md)
>
> Dynamic speech recognition biasing from functions

> [card] [History](https://docs.poly.ai/tools/classes/history.md)
>
> Access conversation turn history

> [card] [Voice](https://docs.poly.ai/tools/classes/voice.md)
>
> Configure TTS voices programmatically

> [card] [Tool classes](https://docs.poly.ai/tools/classes.md)
>
> VoiceWeighting, TTSVoice, and provider classes

> [card] [Agent memory](https://docs.poly.ai/tools/classes/agent-memory.md)
>
> 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 [Variants](https://docs.poly.ai/knowledge/variants/introduction.md) 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 names** – `reservation_date` is clearer than `r_date`.
* **Control triggering** – Define specific [rules](https://docs.poly.ai/behavior/general/rules.md) to prevent over-triggering or under-triggering.
* **Test thoroughly** – Use [Test Cases and Test Sets](https://docs.poly.ai/testing/simulation-tests.md) 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.
