Skip to main content

An educational multi-agent orchestration framework

Project description

AgentSys Logo

AgentSys (experimental, educational)

License: MIT

AgentSys is currently an experimental sample framework intended to explore ergonomic interfaces for multi-agent systems. It is not intended to be used in production, and therefore has no official support. (This also means we will not be reviewing PRs or issues!)

The primary goal of AgentSys is to showcase the handoff & routines patterns explored in the Orchestrating Agents: Handoffs & Routines cookbook. It is not meant as a standalone library, and is primarily for educational purposes.

Installation

SSH

pip install git+ssh://git@github.com/lifsys/agentsys.git

HTTPS

pip install git+https://github.com/lifsys/agentsys.git

Project Structure

The project is organized into several key modules:

  • agentsys.orchestration: Core orchestration functionality
    • Swarm: Main orchestration class for managing agent interactions
    • Agent: Base class for defining agents
  • agentsys.models: Model interfaces and implementations
    • BaseModel: Abstract base class for model implementations
    • OpenAIModel: OpenAI model implementation
  • agentsys.config: Configuration management
    • Settings: Configuration settings and utilities
  • agentsys.types: Type definitions and data structures
  • agentsys.util: Utility functions and helpers

Basic Usage

from agentsys import Swarm, Agent

client = Swarm()
agent = Agent(
    name="test",
    instructions="You are a helpful assistant.",
    model="gpt-4",
)

messages = [{"role": "user", "content": "Hello!"}]
response = client.run(agent, messages)
print(response.messages[-1]["content"])

Function Calling

AgentSys supports function calling with both OpenAI's function calling and tool calling APIs:

def get_weather(location: str) -> str:
    """Get the weather for a location."""
    return f"The weather in {location} is sunny!"

agent = Agent(
    name="weather",
    instructions="You can help users check the weather.",
    model="gpt-4",
    functions=[get_weather],
)

messages = [{"role": "user", "content": "What's the weather in San Francisco?"}]
response = client.run(agent, messages)
print(response.messages[-1]["content"])

Configuration

You can configure AgentSys using environment variables or by passing a config object:

from agentsys import Settings

settings = Settings(
    openai_api_key="your-api-key",
    temperature=0.7,
)

Swarm Client

The Swarm class is the main entry point for interacting with agents. It handles:

  • Message routing
  • Function calling
  • Response streaming
  • Error handling

Contributing

This is an experimental project and we are not accepting contributions at this time.

License

MIT

Project details


Download files

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

Source Distribution

agentsys-0.6.0.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

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

agentsys-0.6.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file agentsys-0.6.0.tar.gz.

File metadata

  • Download URL: agentsys-0.6.0.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.8

File hashes

Hashes for agentsys-0.6.0.tar.gz
Algorithm Hash digest
SHA256 9e9cd57e1ad119f6efc04a128a8aff4d08d3bd30afe72b1296836093d39a2c15
MD5 e487e399f0b1b6f96cd70cb19b9eb3b0
BLAKE2b-256 e568a4b8537cf95499a1fef1dba19de51b6111e86f098857f78ae2b00658dfa9

See more details on using hashes here.

File details

Details for the file agentsys-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: agentsys-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.8

File hashes

Hashes for agentsys-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 89e793cc0143eb85e6a151b66b05fbc03c4390f88285d1bf96818f3e305a4cd3
MD5 809d521e9939692afc260c14aa6f5cef
BLAKE2b-256 98e744bb305ac877b214b8cea208f5db444fcac39419bff63a1422c8728dd8e1

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