Build, deploy, and scale autonomous AI agent swarms with a comprehensive stack of frameworks, interfaces, and cloud services.
The flagship enterprise-grade production-ready multi-agent orchestration framework in Python. Build complex agent systems with sequential workflows, parallel processing, and mixture architectures.
Install and start using Swarms Python with a minimal setup.
pip install -U swarms swarms-memoryimport os
from dotenv import load_dotenv
from swarm_models import OpenAIChat
from swarms import Agent, GroupChat, expertise_based
if __name__ == "__main__":
load_dotenv()
# Get the OpenAI API key from the environment variable
api_key = os.getenv("OPENAI_API_KEY")
# Create an instance of the OpenAIChat class
model = OpenAIChat(
openai_api_key=api_key,
model_name="gpt-4o-mini",
temperature=0.1,
)
# Example agents
agent1 = Agent(
agent_name="Financial-Analysis-Agent",
system_prompt="You are a financial analyst specializing in investment strategies.",
llm=model,
max_loops=1,
autosave=False,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=True,
user_name="swarms_corp",
retry_attempts=1,
context_length=200000,
output_type="string",
streaming_on=False,
)
agent2 = Agent(
agent_name="Tax-Adviser-Agent",
system_prompt="You are a tax adviser who provides clear and concise guidance on tax-related queries.",
llm=model,
max_loops=1,
autosave=False,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=True,
user_name="swarms_corp",
retry_attempts=1,
context_length=200000,
output_type="string",
streaming_on=False,
)
agents = [agent1, agent2]
chat = GroupChat(
name="Investment Advisory",
description="Financial and tax analysis group",
agents=agents,
speaker_fn=expertise_based,
)
history = chat.run(
"How to optimize tax strategy for investments?"
)
print(history.model_dump_json(indent=2))A high-performance implementation of the Swarms framework in Rust, designed for maximum efficiency and safety. Perfect for systems requiring blazing-fast performance and minimal resource usage.
Install and start using Swarms Rust with a minimal setup.
cargo add swarm-rsuse std::env;
use anyhow::Result;
use swarms_rs::llm::provider::openai::OpenAI;
use swarms_rs::structs::concurrent_workflow::ConcurrentWorkflow;
#[tokio::main]
async fn main() -> Result<()> {
dotenv::dotenv().ok();
let subscriber = tracing_subscriber::fmt::Subscriber::builder()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.with_line_number(true)
.with_file(true)
.finish();
tracing::subscriber::set_global_default(subscriber)?;
let base_url = env::var("DEEPSEEK_BASE_URL").unwrap();
let api_key = env::var("DEEPSEEK_API_KEY").unwrap();
let client = OpenAI::from_url(base_url, api_key).set_model("deepseek-chat");
let agent_1 = client
.agent_builder()
.agent_name("Agent 1")
.system_prompt("You are Agent 1, responsible for planning.")
.user_name("M4n5ter")
.max_loops(1)
.temperature(0.3)
.enable_autosave()
.save_state_dir("./temp")
.add_stop_word("<DONE>")
.build();
let agent_2 = client
.agent_builder()
.agent_name("Agent 2")
.system_prompt("You are Agent 2, responsible for solving the problem.")
.user_name("M4n5ter")
.max_loops(1)
.temperature(0.3)
.enable_autosave()
.save_state_dir("./temp")
.add_stop_word("<DONE>")
.build();
let agents = vec![agent_1, agent_2]
.into_iter()
.map(|a| Box::new(a) as _)
.collect::<Vec<_>>();
let workflow = ConcurrentWorkflow::builder()
.name("ConcurrentWorkflow")
.metadata_output_dir("./temp/concurrent_workflow/metadata")
.description("A Workflow to solve a problem with two agents.")
.agents(agents)
.build();
let result = workflow.run("How to learn Rust?").await?;
println!("{}", serde_json::to_string_pretty(&result)?);
Ok(())
}Enterprise-grade Agent Swarm Management API for deploying and orchestrating sophisticated AI agent workflows in the cloud without managing infrastructure.
Install and start using Swarms API with a minimal setup.
import requests
API_KEY = "your-api-key"
BASE_URL = "https://api.swarms.world"
headers = {"x-api-key": API_KEY, "Content-Type": "application/json"}
payload = {
"name": "Financial Analysis Swarm",
"agents": [
{
"agent_name": "Market Analyst",
"description": "Analyzes market trends",
"system_prompt": "You are a financial analyst expert.",
"model_name": "gpt-4o",
"role": "worker"
},
{
"agent_name": "Economic Forecaster",
"description": "Predicts economic trends",
"system_prompt": "You are an expert in economic forecasting.",
"model_name": "gpt-4o",
"role": "worker"
}
],
"swarm_type": "HierarchicalSwarm",
"task": "What are the best ETFs for AI and tech?"
}
response = requests.post(
f"{BASE_URL}/v1/swarm/completions",
headers=headers,
json=payload
)
print(response.json())
A no-code interface to interact with your swarm through natural language. Build, test, and deploy conversational agent systems without writing a single line of code.
Custom deployment options with dedicated infrastructure, enhanced security features, and SLAs for enterprise customers with mission-critical requirements.
Swarms provides everything you need to build powerful multi-agent systems for production use.