Get Started in Minutes
This guide will walk you through creating your first autonomous agent and multi-agent swarm using Swarms. By the end of this tutorial, you’ll have a working agent and understand how to orchestrate multiple agents to work together.Before you begin, make sure you’ve installed Swarms and configured your environment.
Your First Agent
An Agent is the fundamental building block of a swarm—an autonomous entity powered by an LLM + Tools + Memory.Initialize your agent
Create a new agent with basic configuration:Key Parameters:
model_name: The language model to use (e.g., “gpt-4o-mini”, “claude-sonnet-4-5”)max_loops: Number of reasoning iterations (“auto” for automatic determination)interactive: Enable real-time feedback and conversation
Complete code example
Complete code example
Your First Swarm: Multi-Agent Collaboration
A Swarm consists of multiple agents working together. Let’s create a two-agent workflow for researching and writing a blog post.Create specialized agents
Define two agents with specific roles:
The
system_prompt defines each agent’s role and responsibilities. Be specific about what you want each agent to do.Create a sequential workflow
Connect the agents in a pipeline where the researcher’s output feeds into the writer’s input:
Complete swarm example
Complete swarm example
Understanding the Workflow
TheSequentialWorkflow executes agents in order, creating a pipeline where each agent builds upon the work of the previous one. This is ideal for:
- Research → Analysis → Writing workflows
- Data Collection → Processing → Reporting pipelines
- Planning → Execution → Review processes
- Any task with clear sequential dependencies
Want to run agents in parallel instead? Check out ConcurrentWorkflow for simultaneous execution.
What You Can Do Next
Add Tools to Your Agent
Extend your agent’s capabilities with external tools and APIs
Explore Multi-Agent Architectures
Learn about HierarchicalSwarm, ConcurrentWorkflow, MixtureOfAgents, and more
Use Different Model Providers
Connect to OpenAI, Anthropic, Groq, Cohere, and other LLM providers
Build Production Applications
Deploy agents as distributed services with Agent Orchestration Protocol
Common Use Cases
Single Agent Examples
Multi-Agent Examples
Troubleshooting
Agent not responding
Agent not responding
Make sure your API keys are properly configured in your
.env file. Check the environment setup guide for details.Model not found error
Model not found error
Verify that you’re using a valid model name. See the Model Providers documentation for supported models.
Rate limit errors
Rate limit errors
Consider using
max_loops=1 to reduce API calls, or implement retry logic with exponential backoff.Next Steps
Now that you’ve created your first agent and swarm, you’re ready to:- Customize your agents with specific system prompts and configurations
- Add tools to extend agent capabilities
- Explore different workflows like HierarchicalSwarm and MixtureOfAgents
- Build production applications with advanced features
Join our Discord community to get help, share your projects, and connect with other Swarms developers!