Skip to main content

Swarms - Pytorch

Project description

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

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

  • Reliable Structure that provides LLMS autonomy
  • Extremely Customizeable with stopping conditions, interactivity, dynamical temperature, loop intervals, and so much more
  • Enterprise Grade + Production Grade: Flow is designed and optimized for automating real-world tasks at scale!
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

  • A Sequential swarm of autonomous agents where each agent's outputs are fed into the next agent
  • Save and Restore Workflow states!
  • Integrate Flow's with various LLMs and Multi-Modality Models
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

Community

License

MIT

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

swarms-2.2.6.tar.gz (204.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swarms-2.2.6-py3-none-any.whl (255.4 kB view details)

Uploaded Python 3

File details

Details for the file swarms-2.2.6.tar.gz.

File metadata

  • Download URL: swarms-2.2.6.tar.gz
  • Upload date:
  • Size: 204.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.0 Darwin/22.4.0

File hashes

Hashes for swarms-2.2.6.tar.gz
Algorithm Hash digest
SHA256 7215771a5d65c4e0cb429a681a012f548a3845fa52368aab9b0022bba12a8a39
MD5 a7cdbf10887614c63247731e4f639527
BLAKE2b-256 6a6498731daf107d8ad14175305d878cd15dfa8ef1b7e9ce4986495166c60508

See more details on using hashes here.

File details

Details for the file swarms-2.2.6-py3-none-any.whl.

File metadata

  • Download URL: swarms-2.2.6-py3-none-any.whl
  • Upload date:
  • Size: 255.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.0 Darwin/22.4.0

File hashes

Hashes for swarms-2.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 7395a7ce63c58249d7862e4064888c83b89bf50ec9b6df27fcd7c7c2119ecd10
MD5 b8d5debcf96d9b01021b7d053cc3d89e
BLAKE2b-256 86a4b027ffc233bc9b7cb49f1030a038b66e952e1f3a948925326f0349d88b1b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page