AgentServer
AgentServer hosts multiple AgentBase instances
on a single FastAPI process. Each agent registers at its own URL route, and the server provides
unified health monitoring, SIP-based routing, and static file serving. Use AgentServer when you
have several related agents (sales, support, billing) that share the same deployment environment.
For a single agent, use AgentBase.serve()
or AgentBase.run() instead.
Properties
app
The underlying FastAPI application. Use this to add custom routes, middleware, or to run the server with an external ASGI server like gunicorn.
agents
Dictionary mapping route strings to registered AgentBase instances.
host
The host address the server binds to.
port
The port the server listens on.
log_level
The logging level for the server.
Methods
Retrieve a specific registered agent by its route.
Return all registered agents as a list of route/agent tuples.
Register an agent at a URL route on the server.
Register a routing callback across all agents for custom request routing.
Start the multi-agent server with automatic environment detection.
Serve static files from a directory alongside agent routes.
Configure SIP-based routing to direct calls to specific agents by username.
Remove an agent from the server’s registry by route.
Example
After starting, agents are available at: