Python Functions as Tools
Wrap Python functions to create tools. Any function becomes a tool that your agent invokes.images/main/main.py
images/main/Dockerfile
autonomy.yaml
Tool() wrapper converts your function into a tool specification. Docstrings become tool descriptions that help the model understand when to use the tool. Type hints define parameter types (converted to JSON schema). Both sync and async functions are supported.
MCP Tools
Model Context Protocol (MCP) provides agents with tools from external servers. MCP servers expose standardized interfaces to services like web search, databases, and APIs.Configure MCP Server
Define MCP servers in yourautonomy.yaml:
autonomy.yaml
secrets.yaml:
secrets.yaml
Use MCP Tools
Reference MCP server tools usingMcpTool():
images/main/main.py
images/main/Dockerfile
brave_web_search tool to find current information and incorporate it into its response.
Built-in Tools
Agents have access to several built-in tools:Time Tools
Always available without configuration:get_current_time_utc- Get current time in UTC timezoneget_current_time- Get current time in a specific timezone (e.g., “America/New_York”)
Human-in-the-Loop
Agents pause and request user input during interactive conversations. See Human-in-the-loop for complete documentation on theask_user_for_input tool.
Additional Built-in Tools
- Filesystem tools - Read, write, and search files. See Filesystem Tools.
- Subagent tools - Delegate work to specialized sub-agents. See Subagents.
Tool Factories (Advanced)
Tool Factories create scope-aware tools that are instantiated per-user, per-conversation, or per-agent. This is essential for multi-tenant applications where tools need isolated resources.When to Use Tool Factories
Use tool factories when:- Tools need per-user or per-conversation state
- Tools access user-specific resources (databases, files, APIs)
- Tools require tenant isolation for security
- Static tool instances can’t be shared safely
Implement ToolFactory Protocol
Create a class that implements thecreate_tools() method:
ToolFactory. For each conversation, the framework calls create_tools(scope, conversation, agent_name). You create tools with proper isolation based on the provided context. Each user/conversation gets their own tool instances with isolated resources.
Factory vs Static Tools
Static tools (usingTool(func)):
- Same instance shared across all users and conversations
- Suitable for stateless operations (time, calculations, read-only APIs)
- Simple and efficient
ToolFactory):
- New instances created per-user/per-conversation
- Suitable for stateful operations (databases, filesystems, user-specific APIs)
- Provides tenant isolation and security
How Tools Work
Tool Specification
Tools are described to models using JSON schema format:Tool() wrapper automatically generates this specification from:
- Function name → tool name
- Docstring → description
- Type hints → parameter types
- Required vs optional parameters
Type Coercion
The framework coerces JSON values to match Python type hints:str→int,float,bool- String booleans: “true”/“false”, “yes”/“no”, “1”/“0”
- Numbers to strings
- Empty/null handling
Error Handling
Tool errors are captured and returned as strings to the model:Size Limits
- JSON arguments: 1MB maximum
- Tool responses: No hard limit, but keep responses concise for model context efficiency

