Orchestrate Swarms of Agents From Any Framework Like OpenAI, Langchain, and Etc for Real World Workflow Automation. Join our Community: https://discord.gg/DbjBMJTSWD
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Go to file
Kye fe19f21bce
clean up
1 year ago
.github expanded permissions to allow welcome action run 1 year ago
demos clean up 1 year ago
docs docs for misral and groupchat 1 year ago
images swarmfest 1 year ago
playground code quality + new verison + fuyu fixes 1 year ago
swarms clean up 1 year ago
tests removed open interpreter, clean uped docs, added add messages to flow + utils 1 year ago
.env.example feat: Add examples,docs 1 year ago
.gitignore tests 1 year ago
.pre-commit-config.yaml stacked pre commit 1 year ago
.readthedocs.yml docs setups 1 year ago
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md 1 year ago
CONTRIBUTING.md clean up 1 year ago
LICENSE clean up 2 years ago
README.md swarms 1 year ago
SECURITY.md security md 1 year ago
code_quality.sh clean up 1 year ago
example.py clean up 1 year ago
groupchat.py clean up of useless code, code, no more worker, etc 1 year ago
mkdocs.yml docs for misral and groupchat 1 year ago
pyproject.toml clean up 1 year ago
requirements.txt code quality + new verison + fuyu fixes 1 year ago
sequential_workflow_example.py GPT4Vision + Dalle3 -> modules + tests + documentation 1 year ago

README.md

Swarming banner icon

Swarms is a modular framework that enables reliable and useful multi-agent collaboration at scale to automate real-world tasks.

GitHub issues GitHub forks GitHub stars GitHub licenseGitHub star chartDependency Status Downloads

Share on Social Media

Join the Agora discordShare on Twitter Share on Facebook Share on LinkedIn

Share on Reddit Share on Hacker News Share on Pinterest Share on WhatsApp

Swarm Fest

Vision

At Swarms, we're transforming the landscape of AI from siloed AI agents to a unified 'swarm' of intelligence. Through relentless iteration and the power of collective insight from our 1500+ Agora researchers, we're developing a groundbreaking framework for AI collaboration. Our mission is to catalyze a paradigm shift, advancing Humanity with the power of unified autonomous AI agent swarms.


🤝 Schedule a 1-on-1 Session

Book a 1-on-1 Session with Kye, the Creator, to discuss any issues, provide feedback, or explore how we can improve Swarms for you.


Installation

pip3 install --upgrade swarms


Usage

We have a small gallery of examples to run here, for more check out the docs to build your own agent and or swarms!

Flow Example

  • The Flow is a superior iteratioin of the LLMChain from Langchain, our intent with Flow is to create the most reliable loop structure that gives the agents their "autonomy" through 3 main methods of interaction, one through user specified loops, then dynamic where the agent parses a token, and or an interactive human input verison, or a mix of all 3.

from swarms.models import OpenAIChat
from swarms.structs import Flow

api_key = ""

# Initialize the language model, this model can be swapped out with Anthropic, ETC, Huggingface Models like Mistral, ETC
llm = OpenAIChat(
    # model_name="gpt-4"
    openai_api_key=api_key,
    temperature=0.5,
    # max_tokens=100,
)

## Initialize the workflow
flow = Flow(
    llm=llm,
    max_loops=2,
    dashboard=True,
    # stopping_condition=None,  # You can define a stopping condition as needed.
    # loop_interval=1,
    # retry_attempts=3,
    # retry_interval=1,
    # interactive=False,  # Set to 'True' for interactive mode.
    # dynamic_temperature=False,  # Set to 'True' for dynamic temperature handling.
)

# out = flow.load_state("flow_state.json")
# temp = flow.dynamic_temperature()
# filter = flow.add_response_filter("Trump")
out = flow.run("Generate a 10,000 word blog on health and wellness.")
# out = flow.validate_response(out)
# out = flow.analyze_feedback(out)
# out = flow.print_history_and_memory()
# # out = flow.save_state("flow_state.json")
# print(out)




SequentialWorkflow

  • Execute tasks step by step by passing in an LLM and the task description!
  • Pass in flows with various LLMs
  • Save and restore Workflow states!
from swarms.models import OpenAIChat
from swarms.structs import Flow
from swarms.structs.sequential_workflow import SequentialWorkflow

# Example usage
api_key = (
    ""  # Your actual API key here
)

# Initialize the language flow
llm = OpenAIChat(
    openai_api_key=api_key,
    temperature=0.5,
    max_tokens=3000,
)

# Initialize the Flow with the language flow
flow1 = Flow(llm=llm, max_loops=1, dashboard=False)

# Create another Flow for a different task
flow2 = Flow(llm=llm, max_loops=1, dashboard=False)

# Create the workflow
workflow = SequentialWorkflow(max_loops=1)

# Add tasks to the workflow
workflow.add("Generate a 10,000 word blog on health and wellness.", flow1)

# Suppose the next task takes the output of the first task as input
workflow.add("Summarize the generated blog", flow2)

# Run the workflow
workflow.run()

# Output the results
for task in workflow.tasks:
    print(f"Task: {task.description}, Result: {task.result}")


Documentation

Contribute

License

MIT