Skip to content

A fork of OpenAI Swarm that supports Groq and Anthropic

License

Notifications You must be signed in to change notification settings

ajerni/microagent

 
 

Repository files navigation

Microagent Logo

Andi's changes to use Swarm with Groq in a Jupyter notebook:

  • clone the repo: git clone https://github.com/ajerni/microagent.git
  • cd into the main folder: cd microagent

Then:

  • Create a new virtual environment: python -m venv venv
  • Activate the virtual environment with
    • On a Mac: source venv/bin/activate for deactivation use: deactivate
    • On a PC: venv\Scripts\activate
  • Run pip install -r requirements.txt
  • Create a file called .env in the project root directory and add any private API keys (GROQ_API_KEY=your_api_key)
    • nano .env
      • Save the file:
        • Control + O
        • Enter (to confirm save the file)
        • Control + X to exit the editor

Then:

  • run the Jupyter notebook: jupyter lab

Microagent Framework

Microagent is a lightweight framework for orchestrating multi-agent systems, inspired by and forked from OpenAI's Swarm project.

It adds support for Groq and Anthropic LLMs while retaining the same agent semantics.

Overview

Microagent focuses on providing a simple yet powerful interface for creating and managing networks of AI agents. It leverages the core concepts introduced in Swarm, such as agent coordination and handoffs, while introducing its own enhancements and modifications.

Note: Microagent is a separate project from OpenAI's Swarm. Because Swarm is positioned as an experimental framework with no intention to maintain it, Microagent looks to pick up the torch and build on it. While it shares some foundational concepts, it has its own development trajectory and feature set and has already deviated quite a bit.

Key Features

  • Lightweight Agent Orchestration: Create and manage networks of AI agents with ease.
  • Flexible Handoffs: Seamlessly transfer control between agents during execution.
  • Function Integration: Easily integrate Python functions as tools for your agents.
  • Context Management: Maintain and update context variables across agent interactions.
  • Streaming Support: Real-time streaming of agent responses for interactive applications.

Installation

pip install git+https://github.com/chrislatimer/microagent.git

Quick Start

from microagent import Microagent, Agent

client = Microagent(llm_type='openai')

agent_a = Agent(
    name="Agent A",
    instructions="You are a helpful agent.",
    model="gpt-3.5-turbo",
)

agent_b = Agent(
    name="Agent B",
    instructions="You specialize in concise responses.",
    model="gpt-3.5-turbo",
)

def transfer_to_concise_agent():
    """Transfer spanish speaking users immediately."""
    return agent_b

agent_a.functions.append(transfer_to_concise_agent)

response = client.run(
    agent=agent_a,
    messages=[{"role": "user", "content": "I need a brief answer."}],
)

print(response.messages[-1]["content"])

Acknowledgments

Microagent builds upon the innovative work done by OpenAI in their Swarm project. We are grateful for their contributions to the field of multi-agent systems and open-source AI development.

License

Microagent is released under the MIT License. See the LICENSE file for details.


Microagent: Empowering developers to build sophisticated multi-agent systems with ease.

Thanks to the creators of Swarm:

About

A fork of OpenAI Swarm that supports Groq and Anthropic

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 57.4%
  • Jupyter Notebook 42.6%