Skip to main content
Run multiple independent agent instances on a single server. Each client connects to their own isolated agent via URL path—perfect for per-user assistants, task workers, or multi-tenant AI services.

Quick Start

Use Cases

Per-User Assistants

Each user gets their own AI with isolated state and history

Task Workers

Spawn independent agents for parallel task execution

Multi-Tenant APIs

Isolate AI state per customer or organization

Session Agents

Create agents for specific workflows or sessions

Architecture

The Agent Server uses an Agent Registry to route requests between local and remote agents.
  1. Request: POST /agent/user-123/chat
  2. Registry: Matches user-123 to registered target (Agent class or Transport).
  3. Execution:
    • Local: Instantiates agent and executes locally
    • Remote: Delegates to transport (HTTP, WebSocket, etc.)
For detailed API reference, see AgentServer API Reference and AgentRegistry API Reference.

Configuration

Basic (Single Agent Type)

The simplest way is to pass a single Agent class (or instance) to the server. This maps all IDs to that agent type.

Advanced (Multi-Agent Registry)

Use AgentRegistry to serve different types of agents from the same server.
Now requests are routed dynamically:
  • /agent/admin -> AdminAgent("admin")
  • /agent/chat-123 -> ChatBot("chat-123")
  • /agent/worker-abc -> TaskWorker("worker-abc")

Server Configuration

Control lifecycle and security with AgentServerConfig.

Endpoints

Client Examples

The recommended way to interact with the server.

Lifecycle Management

Idle Timeout

Agents with no connections are automatically evicted after idle_timeout seconds:

Max Agents Limit

Reject new agents when limit is reached (returns 429 Too Many Requests):

Lifecycle Hooks

Override hooks on AgentServer for custom logic:

Custom Routes

Add your own endpoints alongside the agent routes using create_app().