Code Tools
Upload a custom Python file (for example, tools.py) to define custom functions and tools that go beyond the standard API and data tools.
The Python file you upload needs to be built using the Sarvam Conv AI SDK.
This is an enterprise only feature. Contact us to get access to it.
Access Code Tools
When to use a code tool
An HTTP tool makes one request and hands the response back to the agent. That covers most lookups.
A code tool runs your Python inside the call, with access to a context object that holds the live interaction. It can call several services, decide what to do with what comes back, and change how the rest of the conversation goes.
Reach for a code tool when the work is more than one request, or when the tool needs to affect the conversation itself.
Example: order status with a fallback
The agent needs to answer “where is my order”. The order service holds the order, a separate courier service holds the tracking. The tool calls both, and still answers usefully if the courier is down.
What an HTTP tool could not do here: skip the second call when the order has not shipped, recover from the courier timing out, or collapse two responses into one sentence for the model.


