?? Fast-agent: Build Sophisticated AI Agents and Workflows in Minutes ????
Fast-agent is a powerful framework that enables developers to quickly build and interact with sophisticated agents and multi-model workflows. Its simple and declarative syntax allows you to focus on composing prompts and configuring MCP servers to create effective agents. Whether you're building a research assistant or an AI-powered chatbot, fast-agent makes it easy to get started!
?? Key Features of fast-agent
1. Declarative Syntax
Easily define agents: With minimal boilerplate, you can define agent applications and workflows using a simple and declarative syntax. Focus on what your agent should do, not on complex configurations.
2. Multi-Model Workflows
Select the best model: Choose different models for different tasks within the same workflow. For example, you can combine OpenAI, Claude, and local models for specialized tasks, making your agent more efficient.
3. Simple Agent Management
Store agents in simple files: Prompts and configurations that define your agent are stored in minimal files, making it easy to manage and version-control your agents.
4. Real-time Interaction
Interactive communication: Chat with individual agents and components during and after workflow execution. Agents can even request human input to get additional context for task completion.
5. Simplified Model and MCP Server Interaction
Seamless model switching: You can quickly evaluate and test how different models interact with MCP servers, and then easily build workflows that combine the best of both.
?? Getting Started with fast-agent
1?? Install fast-agent
Start by installing the uv package manager for Python, then run:
uv pip install fast-agent-mcp # Install fast-agent
2?? Set Up an Example Agent
Create a sample agent and configuration files by running:
fast-agent setup # Set up an example agent and config files
3?? Run Your First Agent
To run your first agent, simply execute:
uv run agent.py # Run your agent
You can also specify a model for the agent with:
uv run agent.py --model=o3-mini.low # Specify a model
4?? Create Effective Agents Using Bootstrapping
To create workflows and examples for building agents, use:
fast-agent bootstrap workflow # Create "building effective agents" examples
This will generate agents like a Researcher Agent or a Data Analysis Agent, demonstrating MCP Roots support.
???? Defining and Interacting with Agents
Creating a basic agent is easy with the @fast.agent decorator. Here’s a simple example:
@fast.agent(
instruction="Given an object, respond only with an estimate of its size."
)
You can then send messages to the agent and get responses, like this:
async with fast.run() as agent:
moon_size = await agent("the moon")
print(moon_size)
Or start an interactive chat with the agent:
async with fast.run() as agent:
await agent()
?? Complete Agent Application Example (sizer.py)
Here’s a complete example of defining an agent and running it:
import asyncio
from mcp_agent.core.fastagent import FastAgent
# Create the application
fast = FastAgent("Agent Example")
@fast.agent(
instruction="Given an object, respond only with an estimate of its size."
)
async def main():
async with fast.run() as agent:
await agent()
if __name__ == "__main__":
asyncio.run(main())
Run the Agent
To run this agent, use the following command:
uv run sizer.py # Run the agent
If you want to specify a model for this agent, use:
uv run sizer.py --model sonnet # Run with the 'sonnet' model
? Why Choose fast-agent?
?? Start Building Agents Today
Ready to dive into the world of AI-powered agents? With fast-agent, you can easily create sophisticated agents and workflows for any use case. Whether you're looking to build a research assistant, a conversational agent, or a data processing tool, fast-agent provides the framework to get started in minutes.
?? Start building now and experiment with different models and MCP server integrations to create highly effective AI solutions.
#FastAgent #AI #MachineLearning #WorkflowAutomation #OpenSource #AIAgents #Python #MCP #Automation