@function_tool that let an agent perform actions and call external services during a conversation. The LLM decides when to invoke them. Tools may be synchronous or asynchronous, suitable for I/O like HTTP requests.
External Tools
External tools are standalone functions passed into the agent’s constructor via thetools parameter. Use this to share common tools across multiple agents.
Internal Tools
Internal tools are methods defined inside your agent class and decorated with@function_tool. Use this for logic specific to the agent that needs its internal state via self.
Tool Chaining and Parallel Calls
Agents can chain tools in a turn: call a tool, pass its result back to the LLM, and repeat until a final text reply. Some LLMs (Anthropic Claude, OpenAI GPT‑4o) may request multiple tool calls in one response; those run concurrently usingasyncio.gather. Google Gemini issues one tool call at a time.
To cap how many tool calls a single turn may make, set max_tool_calls_per_turn on the Context Window config of the Pipeline. It defaults to 10 and acts as a safety limit against infinite tool-call loops.
Updating Tools at Runtime
You can change an agent’s tools while a session is running withAgent.update_tools(...). This adds, removes, or replaces tools without restarting the session.
Agent.update_tools(tools)updates the agent’s tool list. It is synchronous.- Every entry must be a valid tool. Invalid entries raise an error when the tools are registered.
on_enter, where the live session is available:
Sarvam AI LLM: When using Sarvam AI as the LLM option, function tool calls and MCP tools will not work. Consider using alternative LLM providers if you need function tool support.
What’s Next
MCP
Auto-discover tools from an MCP server instead of writing them by hand.
RAG
Ground answers in a knowledge base with custom retrieval.
Run Your Agent
Run the agent with its tools in a live session.