SDK reference

The complete AgentRoute Python SDK surface — every public class, function, and exception, organized by module.


The AgentRoute SDK is one import away. Everything you need to build, run, and reason about an agent lives under the top-level agentroute package, so you can pull symbols straight from the namespace:

from agentroute import Agent, tool, Context, Memory, Result

This is the reference for the public API as of __version__ == "1.1.0". Each page below documents one module of the SDK with exact signatures, defaults, return types, and runnable examples. If you are new here, start with the Agent page, or read the concepts guide for the bigger picture before diving into signatures.

Reference pages

Every export, by page

The agentroute package exports 24 public symbols. Here is each one and the reference page that documents it.

SymbolKindDocumented on
AgentclassAgent
toolfunctionTools
TooldataclassTools
ContextdataclassContext & Usage
UsagedataclassContext & Usage
MemoryclassMemory
MemorySQLiteclassMemory
HistoryprotocolHistory
HistorySlidingWindowclassHistory
HistoryTruncateclassHistory
HistorySummarizeclassHistory
ModelprotocolModels
resolve_modelfunctionModels
MessagedataclassModels
LLMRequestdataclassModels
LLMResponsedataclassModels
ResultdataclassResults
EventdataclassResults
ResultDeploydataclassResults
ErrorAgentexceptionExceptions
ErrorMaxTurnsexceptionExceptions
ErrorBudgetexceptionExceptions
RetryexceptionExceptions
One import to rule them all

Every symbol in the table is re-exported from the package root, so from agentroute import Agent, MemorySQLite, ErrorMaxTurns always works. You never need to reach into submodules like agentroute.memory.history.

A complete example

Here is a minimal agent that wires together symbols from several pages — a tool, structured output, and a typed Result:

from agentroute import Agent
from pydantic import BaseModel
 
 
class Weather(BaseModel):
    city: str
    summary: str
 
 
agent = Agent(name="forecaster", model="claude-sonnet-4", output=Weather)
 
 
@agent.tool
def get_temp(city: str) -> int:
    """Return the current temperature in Celsius for a city."""
    return 21
 
 
result = agent.run("What's the weather in Berlin?")
print(result.output.summary)  # -> a Weather instance
print(result.usage.total_cost_usd)  # -> accumulated cost for the run

From here, pick a page above to see the full surface of each module.

Source: agentroute/init.py