Build a fresh Agent, Team, or Workflow for each incoming request. A factory is a callable that AgentOS invokes per request, so tools, instructions, model, and database scope can depend on who’s calling.Documentation Index
Fetch the complete documentation index at: https://docs.agno.com/llms.txt
Use this file to discover all available pages before exploring further.
tenant_factory.py
POST /agents/tenant-agent/runs and the factory is invoked with a RequestContext for that request.
id and db are required on AgentFactory. The factory’s id overrides any id set on the Agent returned by the callable.When to Use a Factory
Use a plainAgent / Team / Workflow when the component is shared across all callers. Reach for a factory when construction depends on the request.
| Use Case | Pattern |
|---|---|
| Tools or model vary per caller role | AgentFactory reading ctx.trusted.claims |
| Members vary per tenant | TeamFactory returning a Team with tenant-specific agents |
| Pipeline shape varies per request | WorkflowFactory returning a different step graph |
| Client picks persona, depth, or style | Factory with input_schema reading ctx.input |
GET /agents/{id}, GET /teams/{id}, and GET /workflows/{id} (the component-detail endpoints) return the factory’s metadata without invoking it. See the Factories reference for per-endpoint behavior and discovery payload shape.Learn How To
AgentFactory
Produce a fresh Agent per request from verified claims or client input.
TeamFactory
Compose a fresh Team and its members for each request.
WorkflowFactory
Compose pipelines whose step graph depends on the request.
RequestContext
Fields, sources, and identity precedence.
JWT Middleware
Populate
ctx.trusted.claims from verified JWTs.Factories Reference
Class signatures, parameters, and exceptions.