Overview
Fast Agent provides several built-in agent types, each optimized for different use cases. Agents can be created using decorators or loaded from AgentCard files.
Agent Type Reference
Basic Agent
A standard agent with core LLM capabilities, tool access, and conversation history.
Decorator: @fast.agent()
Type: AgentType.BASIC
Capabilities:
- LLM-powered conversations
- MCP server tool access
- Conversation history
- Function tools
- Agents-as-Tools support
Use Cases:
- General-purpose assistants
- Task-specific agents
- Tool-using agents
from fast_agent import FastAgent
fast = FastAgent("my-app")
@fast.agent(
name="support",
instruction="You are a customer support agent.",
servers=["crm", "tickets"],
use_history=True
)
async def support():
pass
async with fast.run() as app:
response = await app.support.send("Find ticket #12345")
print(response.text)
Smart Agent
An enhanced agent with extended reasoning capabilities and optimized system instructions.
Decorator: @fast.smart()
Type: AgentType.SMART
Capabilities:
- All Basic Agent features
- Extended reasoning instructions
- Optimized for complex problem-solving
- Better at multi-step tasks
Use Cases:
- Complex analysis tasks
- Research and investigation
- Multi-step problem solving
- Advanced reasoning scenarios
@fast.smart(
name="analyst",
instruction="Analyze data and provide detailed insights.",
servers=["database", "analytics"]
)
async def analyst():
pass
async with fast.run() as app:
response = await app.analyst.send("Analyze Q4 sales trends")
Custom Agent
An agent using a custom implementation class that extends or replaces default behavior.
Decorator: @fast.custom(cls)
Type: AgentType.CUSTOM
Capabilities:
- Full control over agent logic
- Custom send() implementation
- Access to MCP servers
- Custom state management
Use Cases:
- Specialized agent behaviors
- Integration with external systems
- Custom processing pipelines
- Domain-specific logic
from fast_agent.interfaces import AgentProtocol
from fast_agent import Context
class DatabaseAgent(AgentProtocol):
def __init__(self, context: Context):
self.context = context
self.db_client = setup_database()
async def send(self, message: str, **kwargs):
# Custom implementation
result = await self.db_client.query(message)
return {"text": str(result)}
@fast.custom(
DatabaseAgent,
name="db_agent",
instruction="Execute database queries safely."
)
async def db_agent():
pass
Orchestrator
An agent that creates execution plans and delegates tasks to child agents.
Decorator: @fast.orchestrator()
Type: AgentType.ORCHESTRATOR
Capabilities:
- Task decomposition
- Plan generation
- Child agent delegation
- Result aggregation
- Two planning modes: full and iterative
Use Cases:
- Complex multi-step workflows
- Dynamic task delegation
- Coordinating specialist agents
- Adaptive problem solving
@fast.agent(name="researcher")
async def researcher(): pass
@fast.agent(name="writer")
async def writer(): pass
@fast.agent(name="editor")
async def editor(): pass
@fast.orchestrator(
name="content_coordinator",
agents=["researcher", "writer", "editor"],
plan_type="iterative",
plan_iterations=10
)
async def content_coordinator():
pass
async with fast.run() as app:
response = await app.content_coordinator.send(
"Create a comprehensive article about AI safety"
)
Iterative Planner
A specialized planner agent that executes tasks step-by-step with continuous refinement.
Decorator: @fast.iterative_planner()
Type: AgentType.ITERATIVE_PLANNER
Capabilities:
- Step-by-step planning
- Dynamic plan adjustment
- Unlimited iterations (configurable)
- Adaptive task execution
Use Cases:
- Open-ended research tasks
- Exploratory problem solving
- Tasks requiring adaptive planning
- Long-running investigations
@fast.iterative_planner(
name="research_planner",
agents=["searcher", "analyzer", "synthesizer"],
plan_iterations=-1 # Unlimited
)
async def research_planner():
pass
Router
An agent that analyzes requests and routes them to the appropriate child agent.
Decorator: @fast.router()
Type: AgentType.ROUTER
Capabilities:
- Request classification
- Intelligent routing
- Single agent selection
- Context-aware delegation
Use Cases:
- Request triage
- Departmental routing
- Skill-based delegation
- Topic classification
@fast.agent(name="support_agent")
async def support(): pass
@fast.agent(name="sales_agent")
async def sales(): pass
@fast.agent(name="technical_agent")
async def technical(): pass
@fast.router(
name="request_router",
agents=["support_agent", "sales_agent", "technical_agent"]
)
async def request_router():
pass
async with fast.run() as app:
# Automatically routes to appropriate agent
response = await app.request_router.send(
"I need help with my billing"
)
Chain
An agent that executes child agents in a fixed sequence, passing results forward.
Decorator: @fast.chain()
Type: AgentType.CHAIN
Capabilities:
- Sequential execution
- Result passing between agents
- Cumulative or incremental mode
- Deterministic workflow
Use Cases:
- Pipeline processing
- Multi-stage workflows
- Sequential refinement
- Assembly line patterns
@fast.chain(
name="content_pipeline",
sequence=["researcher", "writer", "editor", "publisher"],
cumulative=True # Each agent sees all previous outputs
)
async def content_pipeline():
pass
async with fast.run() as app:
response = await app.content_pipeline.send(
"Topic: Climate Change Solutions"
)
Parallel
An agent that executes multiple child agents simultaneously and optionally aggregates results.
Decorator: @fast.parallel()
Type: AgentType.PARALLEL
Capabilities:
- Concurrent execution
- Result aggregation
- Fan-out/fan-in pattern
- Parallel processing
Use Cases:
- Multi-perspective analysis
- Parallel data processing
- Consensus building
- Simultaneous evaluations
@fast.parallel(
name="multi_analyzer",
fan_out=["sentiment_analyzer", "topic_classifier", "entity_extractor"],
fan_in="result_aggregator",
include_request=True
)
async def multi_analyzer():
pass
async with fast.run() as app:
response = await app.multi_analyzer.send(
"Analyze this customer feedback..."
)
Evaluator-Optimizer
An agent that iteratively generates and refines responses based on quality evaluation.
Decorator: @fast.evaluator_optimizer()
Type: AgentType.EVALUATOR_OPTIMIZER
Capabilities:
- Iterative refinement
- Quality evaluation
- Automatic improvement
- Configurable quality thresholds
Use Cases:
- High-quality content generation
- Code refinement
- Iterative improvement
- Quality-critical outputs
@fast.agent(name="draft_writer")
async def draft_writer(): pass
@fast.agent(name="content_critic")
async def content_critic(): pass
@fast.evaluator_optimizer(
name="quality_writer",
generator="draft_writer",
evaluator="content_critic",
min_rating="EXCELLENT",
max_refinements=5
)
async def quality_writer():
pass
async with fast.run() as app:
response = await app.quality_writer.send(
"Write a professional email to stakeholders"
)
MAKER
An agent that uses statistical voting across multiple samples for high-reliability outputs.
Decorator: @fast.maker()
Type: AgentType.MAKER
Capabilities:
- Statistical error correction
- K-voting consensus
- Multiple sample generation
- Reliability optimization
Use Cases:
- High-stakes decisions
- Error-critical outputs
- Verification tasks
- Quality assurance
Based on the paper “Solving a Million-Step LLM Task with Zero Errors” (arXiv:2511.09030). Trades compute for reliability by sampling multiple responses and using voting consensus.
@fast.agent(
name="calculator",
instruction="Return only the numeric result of the calculation."
)
async def calculator():
pass
@fast.maker(
name="reliable_calc",
worker="calculator",
k=3, # Require 3-vote margin
max_samples=50,
match_strategy="normalized"
)
async def reliable_calc():
pass
async with fast.run() as app:
# Gets high-confidence result via statistical consensus
response = await app.reliable_calc.send("What is 17 * 23?")
print(response.text)
Agent Configuration
AgentConfig
All agents are configured using the AgentConfig dataclass:
from fast_agent.agents.agent_types import AgentConfig
config = AgentConfig(
name="my_agent",
instruction="Agent instruction",
servers=["server1", "server2"],
tools={"server1": ["tool1", "tool2"]},
resources={"server1": ["resource1"]},
prompts={"server1": ["prompt1"]},
model="anthropic:claude-3-5-sonnet-20241022",
use_history=True,
human_input=False,
default=False,
function_tools=["tools.py:my_function"],
default_request_params={
"temperature": 0.7,
"max_tokens": 2000
}
)
Agent Composition
Basic and Smart agents support attaching child agents as tools:
@fast.agent(
name="coordinator",
agents=["specialist1", "specialist2", "specialist3"]
)
async def coordinator():
pass
# Or attach dynamically
fast.attach_agent_tools(
parent_name="coordinator",
child_names=["specialist4"]
)
Workflow Nesting
Workflow agents can use other workflow agents:
# Chain of chains
@fast.chain(
name="pipeline1",
sequence=["step1", "step2"]
)
async def pipeline1(): pass
@fast.chain(
name="pipeline2",
sequence=["step3", "step4"]
)
async def pipeline2(): pass
@fast.chain(
name="meta_pipeline",
sequence=["pipeline1", "pipeline2"]
)
async def meta_pipeline(): pass
Agent Lifecycle
Initialization
Agents are initialized when entering the fast.run() context:
fast = FastAgent("my-app")
@fast.agent(name="agent1")
async def agent1(): pass
# Agents are created here
async with fast.run() as app:
# Now agents are initialized and ready
response = await app.agent1.send("Hello")
Cleanup
Agents are automatically cleaned up when exiting the context:
async with fast.run() as app:
# Use agents
pass
# Agents are cleaned up here
See Also