Skip to main content
Agentor simplifies the tool use process by automatically generating the tool schema from the function definition, parsing the function signature, and calling the function when required. To create an Agent with access to external tools or APIs, you need to define a function and decorate it with the @function_tool decorator.
from agentor import Agentor, function_tool

@function_tool
def get_weather(city: str) -> str:
    """Get the weather of a city"""
    return f"Weather in {city} is sunny"

agent = Agentor(name="Weather Agent", tools=[get_weather])
result = agent.run("What is the weather in London?")
print(result)
The result will be the weather in London.
RunResult:
- Last agent: Agent(name="Weather Agent", ...)
- Final output (str):
    London weather: sunny right now. Would you like the temperature or a short forecast?
In the next section, we will learn about how to build and use MCP Servers with Agentor.