Skip to main content

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.
1

Import the Agent class

Start by importing the Agent class from the swarms package:
2

Initialize your agent

Create a new agent with basic configuration:
Key Parameters:
  • model_name: The language model to use (e.g., “gpt-5.4”, “claude-sonnet-4-5”)
  • max_loops: Number of reasoning iterations (“auto” for automatic determination)
  • interactive: Enable real-time feedback and conversation
3

Run your agent

Execute a task with your agent:

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.
1

Import required classes

Import both Agent and SequentialWorkflow:
2

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.
3

Create a sequential workflow

Connect the agents in a pipeline where the researcher’s output feeds into the writer’s input:
4

Run the workflow

Execute the workflow with a task:
The workflow will:
  1. Send the task to the Researcher agent
  2. The Researcher analyzes the topic and provides a summary
  3. The Writer receives the research and creates a blog post
  4. The final blog post is returned

Understanding the Workflow

The SequentialWorkflow 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

Make sure your API keys are properly configured in your .env file. Check the environment setup guide for details.
Verify that you’re using a valid model name. See the Model Providers documentation for supported models.
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:
  1. Customize your agents with specific system prompts and configurations
  2. Add tools to extend agent capabilities
  3. Explore different workflows like HierarchicalSwarm and MixtureOfAgents
  4. Build production applications with advanced features
Join our Discord community to get help, share your projects, and connect with other Swarms developers!