Skip to main content
Tools are externally defined functions or services that an agent can call to extend its capabilities beyond pure language-model reasoning. Tools allow the agent to perform actions like looking things up on the web, getting the current time, querying APIs, or any arbitrary logic you build. They bridge the gap between what the model “knows” inherently and what it can do: you provide defined interfaces as either Python functions or MCP servers that the agent can use when needed, enabling more accurate, up-to-date, and actionable responses.

Python Functions as Tools

You can build your own custom tools in Python for your agents to call when needed. This feature allows unlimited tool possibilities because you can build a tool to do whatever you’d like.

How the Example Works

The example defines a simple Python function current_iso8601_utc_time() that returns the current UTC time in ISO-8601 format. That function is wrapped as a Tool, then given to the agent (“Henry”) as part of its configuration. Because the tool is included, the agent can invoke it when asked for the current time. The setup shows two modes: purely local tools (Python functions) and tools via MCP (Model Context Protocol) servers. For example, “Henry” can use both the current_iso8601_utc_time Python tool and a web-search tool plugged in via MCP (e.g. McpTool("brave_search", "brave_web_search")). The example also shows how to configure the infrastructure: specifying the agent, model, tools list; how to start the node; how to wire up MCP clients so that external tool servers can be used.
You can find all the code for this example on Github.
images/main/main.py
from autonomy import Agent, Model, Node, Tool
from datetime import datetime, UTC


def current_iso8601_utc_time():
  """
  Returns the current UTC time in ISO 8601 format.
  """
  return datetime.now(UTC).isoformat() + "Z"


async def main(node):
  await Agent.start(
    node=node,
    name="henry",
    instructions="You are Henry, an expert legal assistant",
    model=Model("claude-sonnet-4-v1"),
    tools=[Tool(current_iso8601_utc_time)],
  )


Node.start(main)
images/main/Dockerfile
FROM ghcr.io/build-trust/autonomy-python
COPY . .
ENTRYPOINT ["python", "main.py"]
autonomy.yaml
name: example003
pods:
  - name: main-pod
    public: true
    containers:
      - name: main
        image: main
http POST \
"https://25df35de87aa441b88f22a6c2a830a17-example003.cluster.autonomy.computer/agents/henry" \
message="what is the current time"

Tools provided by MCP Servers

autonomy.yaml
name: example006
pods:
  - name: main-pod
    public: true
    containers:
      - name: main
        image: main

      - name: mcp
        image: ghcr.io/build-trust/mcp-proxy
        env:
          - BRAVE_API_KEY: secrets.BRAVE_API_KEY
        args:
          ["--sse-port", "8001", "--pass-environment", "--",
           "npx", "-y", "@modelcontextprotocol/server-brave-search"]
secrets.yaml
BRAVE_API_KEY: "YOUR KEY HERE"
images/main/Dockerfile
FROM ghcr.io/build-trust/autonomy-python:latest
COPY . .
ENTRYPOINT ["python", "main.py"]
images/main/main.py
from datetime import datetime
from autonomy import Agent, Model, Node, McpTool, McpClient, Tool


def current_iso8601_utc_time():
  """
  Returns the current UTC time in ISO 8601 format.
  """
  return datetime.utcnow().isoformat() + "Z"


async def main(node):
  await Agent.start(
    node=node,
    name="henry",
    instructions="""
      You are Henry, an expert legal assistant.

      When you are given a question, decide if your response can be better
      with a web search. If so, use the web search tool to improve your response.
    """,
    model=Model("claude-3-7-sonnet-v1"),
    tools=[
      McpTool("brave_search", "brave_web_search"),
      Tool(current_iso8601_utc_time),
    ],
  )


Node.start(
  main,
  mcp_clients=[
    McpClient(name="brave_search", address="http://localhost:8001/sse"),
  ],
)
http POST \
"https://25df35de87aa441b88f22a6c2a830a17-example006.cluster.autonomy.computer/agents/henry" \
message="Find links to cases currently in the US Supreme Court"
I