Build, deploy, and scale autonomous AI agent swarms with unprecedented control and efficiency using our comprehensive suite of tools and frameworks.
Build powerful multi-agent systems with our enterprise-grade frameworks available in multiple languages.
The flagship enterprise-grade production-ready multi-agent orchestration framework in Python. Build complex agent systems with sequential workflows, parallel processing, and mixture architectures.
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.
pip install -U swarms swarms-memory
cargo add swarm-rs
import 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))
use 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(())
}
Swarms provides everything you need to build powerful multi-agent systems for production use.
Start building with Swarms today and join the revolution in enterprise AI orchestration.