Import
AgentRouter
TheAgentRouter class provides a FastAPI router that serves agents or agent registries with REST endpoints.
Constructor
Parameters
Agent | AgentRegistry
required
Either a single Agent instance or an AgentRegistry for multi-agent routing.
Any
Additional keyword arguments passed to FastAPI’s
APIRouter.Raises
ImportError: If FastAPI is not installed.
Endpoints
Single Agent Routes
POST /chat- Chat with the agentPOST /invoke- RPC method callsGET /state- Get agent statePOST /- Generic request handler
Registry Routes (with agent_id parameter)
POST /{agent_id}/chat- Chat with specific agentPOST /{agent_id}/invoke- RPC calls to specific agentGET /{agent_id}/state- Get state of specific agentPOST /{agent_id}- Generic request to specific agent