A lightweight Python package for managing multi-agent orchestration. Easily define agents with custom instructions, tools, containers, and models, and orchestrate their interactions seamlessly. Perfect for building modular, collaborative AI systems.
Project description
Agents Manager
A lightweight Python package for managing multi-agent orchestration. Easily define agents with custom instructions, tools, and models, and orchestrate their interactions seamlessly. Perfect for building modular, collaborative AI systems.
Features
- Define agents with specific roles and instructions
- Assign models to agents (e.g., OpenAI models)
- Equip agents with tools and containers for performing tasks
- Seamlessly orchestrate interactions between multiple agents
Supported Models
- OpenAI
- Grok
- DeepSeek
- Anthropic
- Llama
- Genai
Installation
Install the package via pip:
pip install agents-manager
Quick Start
from agents_manager import Agent, AgentManager
from agents_manager.models import OpenAi, Anthropic, Genai
from dotenv import load_dotenv
load_dotenv()
# Define the OpenAi model
openaiModel = OpenAi(name="gpt-4o-mini")
#Define the Anthropic model
anthropicModel = Anthropic(
name="claude-3-5-sonnet-20241022",
max_tokens= 1024,
)
#Define the Genai model
genaiModel = Genai(name="gemini-2.0-flash-001")
def multiply(a: int, b: int) -> int:
"""
Multiply two numbers.
"""
return a * b
def transfer_to_agent_3_for_math_calculation() -> Agent:
"""
Transfer to agent 3 for math calculation.
"""
return agent3
def transfer_to_agent_2_for_math_calculation() -> Agent:
"""
Transfer to agent 2 for math calculation.
"""
agent2.set_instruction("You can change the instruction here")
return agent2
# Define agents
agent3 = Agent(
name="agent3",
instruction="You are a maths teacher, explain properly how you calculated the answer.",
model=genaiModel,
tools=[multiply]
)
agent2 = Agent(
name="agent2",
instruction="You are a maths calculator bro",
model=anthropicModel,
tools=[transfer_to_agent_3_for_math_calculation]
)
agent1 = Agent(
name="agent1",
instruction="You are a helpful assistant",
model=openaiModel,
tools=[transfer_to_agent_2_for_math_calculation]
)
# Initialize Agent Manager and run agent
agent_manager = AgentManager()
agent_manager.add_agent(agent1)
response = agent_manager.run_agent("agent1", "What is 2 multiplied by 3?")
print(response["content"])
You can run for stream response as well.
response_stream = agent_manager.run_agent_stream("agent1", [
{"role": "user", "content": "What is 2 multiplied by 3?"},
])
for chunk in response_stream:
print(chunk["content"], end="")
You can also pass container as tool to the agent.
from agents_manager import Agent, AgentManager, Container
...
agent4 = Agent(
name="agent4",
instruction="You are a helpful assistant",
model=model,
tools=[Container(
name="hello",
description="A simple hello world container",
image="hello-world:latest",
)]
)
You can also pass the result of the container to the next agent with result variable.
from agents_manager import Agent, Container
...
agent5 = Agent(
name="agent1",
instruction="You are a helpful assistant",
model=model,
tools=[Container(
name="processing",
description="Container to do some processing...",
image="docker/xxxx:latest",
environment=[
{"name": "input1", "type": "integer"},
{"name": "input2", "type": "integer"}
],
authenticate={
"username": "xxxxx",
"password": "xxxxx",
"registry": "xxxxx"
},
return_to={
"agent": agent6,
"instruction": "The result is: {result}" # {result} will be replaced with the result of the container
},
)]
)
You can also pass output_format to agent to format the output.
from pydantic import BaseModel
from agents_manager import Agent
class Answer(BaseModel):
value: str
agent1 = Agent(
name="agent1",
instruction="You are a helpful assistant",
model=model,
output_format=Answer
)
Note 1: The output_format should be a pydantic model.
Note 2: Anthropic model does not support output_format, you can use tool to format the output.
You can also run the agent with a dictionary as the input content.
response = agent_manager.run_agent("agent1", {"role": "user", "content": "What is 2 multiplied by 3?"})
You can also run the agent with a list of history of messages as the input.
response = agent_manager.run_agent("agent1", [
{"role": "user", "content": "What is 2 multiplied by 3?"},
])
More models
from agents_manager.models import Grok, DeepSeek, Llama
#Define the Grok model
modelGrok = Grok(name="grok-2-latest")
#Define the DeepSeek model
modelDeepSeek = DeepSeek(name="deepseek-chat")
#Define the Llama model
modelLlama = Llama(name="llama3.1-70b")
Troubleshooting
- While using Genai model with functions, if you get the following error:
google.genai.errors.ClientError: 400 INVALID_ARGUMENT. {'error': {'code': 400, 'message': '* GenerateContentRequest.tools[0].function_declarations[0].parameters.properties: should be non-empty for OBJECT type\n', 'status': 'INVALID_ARGUMENT'}}
It is because google genai does not support functions without parameters. You can fix this by providing a dummy parameter. Please let me know if you have a better solution for this.
- If you get the following error while running the container tool:
Error: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
It is because the docker daemon is not running. You can fix this by starting the docker daemon. and export the following environment variable:
#linux
export DOCKER_HOST=unix:///var/run/docker.sock
#colima
export DOCKER_HOST=unix://$HOME/.colima/default/docker.sock
How It Works
- Define Agents: Each agent has a name, a specific role (instruction), and a model.
- Assign Tools: Agents can be assigned tools (functions and containers) to perform tasks.
- Create an Agent Manager: The
AgentManagermanages the orchestration of agents. - Run an Agent: Start an agent to process a request and interact with other agents as needed.
Use Cases
- AI-powered automation systems
- Multi-agent chatbots
- Complex workflow orchestration
- Research on AI agent collaboration
Contributing
Contributions are welcome! Feel free to submit issues and pull requests.
License
MIT License
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agents_manager-1.3.1.tar.gz.
File metadata
- Download URL: agents_manager-1.3.1.tar.gz
- Upload date:
- Size: 17.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfbbb9073ffbc5d39d69a20cacab17a3b87503d16af94211999f1bd1f017247e
|
|
| MD5 |
ead3d49dae09f8e96f76ba419860de9a
|
|
| BLAKE2b-256 |
dfe3bd36dae779144fba785c880058b9be736e581ae2135d830d7bcddb1cd473
|
Provenance
The following attestation bundles were made for agents_manager-1.3.1.tar.gz:
Publisher:
publish-to-pypi.yml on sandeshnaroju/agents_manager
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agents_manager-1.3.1.tar.gz -
Subject digest:
cfbbb9073ffbc5d39d69a20cacab17a3b87503d16af94211999f1bd1f017247e - Sigstore transparency entry: 219906690
- Sigstore integration time:
-
Permalink:
sandeshnaroju/agents_manager@ecfc5a2a5614bb852f5858b62af6ac34d4b25b8f -
Branch / Tag:
refs/tags/v1.3.1 - Owner: https://github.com/sandeshnaroju
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@ecfc5a2a5614bb852f5858b62af6ac34d4b25b8f -
Trigger Event:
push
-
Statement type:
File details
Details for the file agents_manager-1.3.1-py3-none-any.whl.
File metadata
- Download URL: agents_manager-1.3.1-py3-none-any.whl
- Upload date:
- Size: 21.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6d664b64dee1b51b6540965d47cfe02f888835e6908493117e46ff0d64cab33
|
|
| MD5 |
c81193c528cc4fdcc0cdf0bcf2d3b5a6
|
|
| BLAKE2b-256 |
59457aa2249bec043d93eb78231c56e091755f39bdc7e2610ea0ecefe22162e2
|
Provenance
The following attestation bundles were made for agents_manager-1.3.1-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on sandeshnaroju/agents_manager
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agents_manager-1.3.1-py3-none-any.whl -
Subject digest:
f6d664b64dee1b51b6540965d47cfe02f888835e6908493117e46ff0d64cab33 - Sigstore transparency entry: 219906691
- Sigstore integration time:
-
Permalink:
sandeshnaroju/agents_manager@ecfc5a2a5614bb852f5858b62af6ac34d4b25b8f -
Branch / Tag:
refs/tags/v1.3.1 - Owner: https://github.com/sandeshnaroju
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@ecfc5a2a5614bb852f5858b62af6ac34d4b25b8f -
Trigger Event:
push
-
Statement type: