Overview
Fast Agent provides a flexible agent architecture that enables you to create sophisticated AI agents with minimal configuration. Agents are the core building blocks that interact with LLMs, execute tools, and manage conversation state.Agent Types
Fast Agent supports multiple agent types to handle different use cases:Basic Agent
Simple agents with tool calling and conversation management
Smart Agent
Enhanced agents with built-in command support and advanced features
Workflow Agents
Specialized agents for orchestrating complex workflows
Custom Agents
Extensible agents for specialized use cases
Agent Type Enumeration
The framework defines the following agent types:Agent Configuration
Every agent is configured using theAgentConfig dataclass:
Key Configuration Options
instruction
instruction
The system prompt that defines the agent’s behavior and capabilities. This can include template variables like
{{agentSkills}} for dynamic content.servers
servers
List of MCP server names to attach to this agent. Servers provide tools, resources, and prompts.
use_history
use_history
Whether the agent maintains conversation history across turns. Set to
false for stateless agents.human_input
human_input
Enables the agent to request input from users during task execution.
shell
shell
Enables shell command execution capabilities for the agent.
Agent Lifecycle
Fast Agent uses an async context manager pattern for agent lifecycle management:Lifecycle Stages
- Creation: Agent configuration is registered via decorator
- Initialization: MCP servers are connected, tools are loaded
- Execution: Agent processes messages and executes tools
- Shutdown: Connections are closed, resources are cleaned up
The
async with fast.run() pattern ensures proper initialization and cleanup of all agents and their MCP server connections.Creating Agents
Decorator Syntax
The simplest way to create an agent:Programmatic Creation
For dynamic agent creation:Agent Communication
Agents support multiple ways to interact:Direct Messaging
Interactive Sessions
With Resources
MCP Integration
Agents seamlessly integrate with MCP (Model Context Protocol) servers:Server Attachment
Runtime Server Management
See the MCP Integration page for detailed information about the Model Context Protocol support.
Agent Capabilities
Tool Execution
Agents can execute tools from attached MCP servers:Prompt Templates
Apply MCP prompt templates:Resource Access
Access resources from MCP servers:State Management
Conversation History
Agents maintain conversation history based on theuse_history setting:
Clearing History
Advanced Features
Shell Runtime
Enable shell command execution:Skills Integration
Agents can load and use skills:Human Input
Enable agents to request human input:Best Practices
Instruction Design
Write clear, specific instructions that define the agent’s role, capabilities, and constraints. Use template variables for dynamic content.
History Management
Enable history for conversational agents, disable for task-specific agents to reduce token usage.
Server Selection
Only attach MCP servers that the agent needs. Use tool filters to limit which tools are exposed.
Error Handling
Always use the context manager pattern to ensure proper cleanup of resources and connections.
Next Steps
Workflows
Learn about workflow patterns for complex agent orchestration
MCP Integration
Deep dive into Model Context Protocol integration
Configuration
Configure agents and MCP servers
Examples
See practical examples of agent patterns
