Name | hanzo-agents JSON |
Version |
0.1.1
JSON |
| download |
home_page | None |
Summary | Production-grade AI agent runtime for deterministic, debuggable agent systems |
upload_time | 2025-09-06 12:47:59 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.11 |
license | MIT |
keywords |
agents
ai
llm
multi-agent
orchestration
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Hanzo Agents
[](https://pypi.org/project/hanzo-agents/)
[](https://pypi.org/project/hanzo-agents/)
Advanced agent framework for building and orchestrating AI agents.
## Installation
```bash
pip install hanzo-agents
```
## Features
- **Agent Creation**: Build specialized AI agents
- **Swarm Orchestration**: Coordinate multiple agents
- **Tool Integration**: Equip agents with tools
- **Memory Systems**: Persistent agent memory
- **Hierarchical Control**: Parent-child agent relationships
- **Parallel Execution**: Run agents concurrently
## Quick Start
### Basic Agent
```python
from hanzo_agents import Agent
agent = Agent(
name="assistant",
model="gpt-4",
instructions="You are a helpful assistant"
)
response = await agent.run("Help me with Python")
print(response)
```
### Agent Swarm
```python
from hanzo_agents import Agent, Swarm
# Create specialized agents
researcher = Agent(
name="researcher",
model="gpt-4",
instructions="Research and analyze topics"
)
writer = Agent(
name="writer",
model="gpt-3.5-turbo",
instructions="Write clear documentation"
)
# Create swarm
swarm = Swarm([researcher, writer])
# Run task
result = await swarm.run(
"Research quantum computing and write a summary"
)
```
### Agent with Tools
```python
from hanzo_agents import Agent, Tool
# Define custom tool
def calculate(expression: str) -> float:
"""Calculate mathematical expression"""
return eval(expression)
# Create agent with tool
agent = Agent(
name="calculator",
model="gpt-4",
tools=[Tool(calculate)],
instructions="You are a math assistant"
)
response = await agent.run("What is 25 * 4 + 10?")
```
## Advanced Usage
### Hierarchical Agents
```python
from hanzo_agents import Agent, HierarchicalSwarm
# Manager agent
manager = Agent(
name="manager",
model="gpt-4",
instructions="Coordinate team members"
)
# Worker agents
workers = [
Agent(name="dev1", model="gpt-3.5-turbo"),
Agent(name="dev2", model="gpt-3.5-turbo"),
]
# Hierarchical swarm
swarm = HierarchicalSwarm(
manager=manager,
workers=workers
)
result = await swarm.run("Build a web application")
```
### Agent Memory
```python
from hanzo_agents import Agent, MemoryStore
# Create memory store
memory = MemoryStore()
# Agent with memory
agent = Agent(
name="assistant",
model="gpt-4",
memory=memory
)
# Conversations are remembered
await agent.run("My name is Alice")
response = await agent.run("What's my name?")
# Response: "Your name is Alice"
```
### Parallel Execution
```python
from hanzo_agents import ParallelSwarm
swarm = ParallelSwarm([
Agent(name="agent1", model="gpt-4"),
Agent(name="agent2", model="gpt-3.5-turbo"),
Agent(name="agent3", model="claude-2"),
])
# All agents work in parallel
results = await swarm.run_parallel([
"Task 1",
"Task 2",
"Task 3"
])
```
## Agent Types
### Specialized Agents
```python
from hanzo_agents import (
CodeAgent,
ResearchAgent,
WriterAgent,
DataAgent
)
# Code generation agent
code_agent = CodeAgent(
languages=["python", "javascript"],
frameworks=["django", "react"]
)
# Research agent
research_agent = ResearchAgent(
sources=["web", "papers", "docs"],
depth="comprehensive"
)
# Writing agent
writer_agent = WriterAgent(
style="technical",
format="markdown"
)
# Data analysis agent
data_agent = DataAgent(
tools=["pandas", "numpy", "matplotlib"]
)
```
## Configuration
### Agent Configuration
```python
agent = Agent(
name="assistant",
model="gpt-4",
temperature=0.7,
max_tokens=2000,
timeout=30,
retry_count=3,
instructions="...",
system_prompt="...",
tools=[...],
memory=...,
callbacks=[...]
)
```
### Swarm Configuration
```python
swarm = Swarm(
agents=[...],
strategy="round_robin", # round_robin, random, weighted
max_concurrent=5,
timeout=60,
error_handling="continue" # continue, stop, retry
)
```
## Callbacks and Events
```python
from hanzo_agents import Agent, EventCallback
class LoggingCallback(EventCallback):
async def on_start(self, agent, task):
print(f"{agent.name} starting: {task}")
async def on_complete(self, agent, result):
print(f"{agent.name} completed: {result}")
async def on_error(self, agent, error):
print(f"{agent.name} error: {error}")
agent = Agent(
name="assistant",
model="gpt-4",
callbacks=[LoggingCallback()]
)
```
## Best Practices
1. **Agent Specialization**: Create focused agents with clear roles
2. **Resource Management**: Use appropriate models for tasks
3. **Error Handling**: Implement robust error recovery
4. **Memory Management**: Clean up memory periodically
5. **Tool Selection**: Choose minimal necessary tools
6. **Monitoring**: Track agent performance and costs
## Development
### Setup
```bash
cd pkg/hanzo-agents
uv sync --all-extras
```
### Testing
```bash
# Run tests
pytest tests/
# With coverage
pytest tests/ --cov=hanzo_agents
```
### Building
```bash
uv build
```
## License
Apache License 2.0
Raw data
{
"_id": null,
"home_page": null,
"name": "hanzo-agents",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "agents, ai, llm, multi-agent, orchestration",
"author": null,
"author_email": "Hanzo AI <dev@hanzo.ai>",
"download_url": "https://files.pythonhosted.org/packages/ee/c9/7f6d9fd4f2156957f75146e77f95b49c1924028e91935ca60aab2dcd2fbf/hanzo_agents-0.1.1.tar.gz",
"platform": null,
"description": "# Hanzo Agents\n\n[](https://pypi.org/project/hanzo-agents/)\n[](https://pypi.org/project/hanzo-agents/)\n\nAdvanced agent framework for building and orchestrating AI agents.\n\n## Installation\n\n```bash\npip install hanzo-agents\n```\n\n## Features\n\n- **Agent Creation**: Build specialized AI agents\n- **Swarm Orchestration**: Coordinate multiple agents\n- **Tool Integration**: Equip agents with tools\n- **Memory Systems**: Persistent agent memory\n- **Hierarchical Control**: Parent-child agent relationships\n- **Parallel Execution**: Run agents concurrently\n\n## Quick Start\n\n### Basic Agent\n\n```python\nfrom hanzo_agents import Agent\n\nagent = Agent(\n name=\"assistant\",\n model=\"gpt-4\",\n instructions=\"You are a helpful assistant\"\n)\n\nresponse = await agent.run(\"Help me with Python\")\nprint(response)\n```\n\n### Agent Swarm\n\n```python\nfrom hanzo_agents import Agent, Swarm\n\n# Create specialized agents\nresearcher = Agent(\n name=\"researcher\",\n model=\"gpt-4\",\n instructions=\"Research and analyze topics\"\n)\n\nwriter = Agent(\n name=\"writer\",\n model=\"gpt-3.5-turbo\",\n instructions=\"Write clear documentation\"\n)\n\n# Create swarm\nswarm = Swarm([researcher, writer])\n\n# Run task\nresult = await swarm.run(\n \"Research quantum computing and write a summary\"\n)\n```\n\n### Agent with Tools\n\n```python\nfrom hanzo_agents import Agent, Tool\n\n# Define custom tool\ndef calculate(expression: str) -> float:\n \"\"\"Calculate mathematical expression\"\"\"\n return eval(expression)\n\n# Create agent with tool\nagent = Agent(\n name=\"calculator\",\n model=\"gpt-4\",\n tools=[Tool(calculate)],\n instructions=\"You are a math assistant\"\n)\n\nresponse = await agent.run(\"What is 25 * 4 + 10?\")\n```\n\n## Advanced Usage\n\n### Hierarchical Agents\n\n```python\nfrom hanzo_agents import Agent, HierarchicalSwarm\n\n# Manager agent\nmanager = Agent(\n name=\"manager\",\n model=\"gpt-4\",\n instructions=\"Coordinate team members\"\n)\n\n# Worker agents\nworkers = [\n Agent(name=\"dev1\", model=\"gpt-3.5-turbo\"),\n Agent(name=\"dev2\", model=\"gpt-3.5-turbo\"),\n]\n\n# Hierarchical swarm\nswarm = HierarchicalSwarm(\n manager=manager,\n workers=workers\n)\n\nresult = await swarm.run(\"Build a web application\")\n```\n\n### Agent Memory\n\n```python\nfrom hanzo_agents import Agent, MemoryStore\n\n# Create memory store\nmemory = MemoryStore()\n\n# Agent with memory\nagent = Agent(\n name=\"assistant\",\n model=\"gpt-4\",\n memory=memory\n)\n\n# Conversations are remembered\nawait agent.run(\"My name is Alice\")\nresponse = await agent.run(\"What's my name?\")\n# Response: \"Your name is Alice\"\n```\n\n### Parallel Execution\n\n```python\nfrom hanzo_agents import ParallelSwarm\n\nswarm = ParallelSwarm([\n Agent(name=\"agent1\", model=\"gpt-4\"),\n Agent(name=\"agent2\", model=\"gpt-3.5-turbo\"),\n Agent(name=\"agent3\", model=\"claude-2\"),\n])\n\n# All agents work in parallel\nresults = await swarm.run_parallel([\n \"Task 1\",\n \"Task 2\",\n \"Task 3\"\n])\n```\n\n## Agent Types\n\n### Specialized Agents\n\n```python\nfrom hanzo_agents import (\n CodeAgent,\n ResearchAgent,\n WriterAgent,\n DataAgent\n)\n\n# Code generation agent\ncode_agent = CodeAgent(\n languages=[\"python\", \"javascript\"],\n frameworks=[\"django\", \"react\"]\n)\n\n# Research agent\nresearch_agent = ResearchAgent(\n sources=[\"web\", \"papers\", \"docs\"],\n depth=\"comprehensive\"\n)\n\n# Writing agent\nwriter_agent = WriterAgent(\n style=\"technical\",\n format=\"markdown\"\n)\n\n# Data analysis agent\ndata_agent = DataAgent(\n tools=[\"pandas\", \"numpy\", \"matplotlib\"]\n)\n```\n\n## Configuration\n\n### Agent Configuration\n\n```python\nagent = Agent(\n name=\"assistant\",\n model=\"gpt-4\",\n temperature=0.7,\n max_tokens=2000,\n timeout=30,\n retry_count=3,\n instructions=\"...\",\n system_prompt=\"...\",\n tools=[...],\n memory=...,\n callbacks=[...]\n)\n```\n\n### Swarm Configuration\n\n```python\nswarm = Swarm(\n agents=[...],\n strategy=\"round_robin\", # round_robin, random, weighted\n max_concurrent=5,\n timeout=60,\n error_handling=\"continue\" # continue, stop, retry\n)\n```\n\n## Callbacks and Events\n\n```python\nfrom hanzo_agents import Agent, EventCallback\n\nclass LoggingCallback(EventCallback):\n async def on_start(self, agent, task):\n print(f\"{agent.name} starting: {task}\")\n \n async def on_complete(self, agent, result):\n print(f\"{agent.name} completed: {result}\")\n \n async def on_error(self, agent, error):\n print(f\"{agent.name} error: {error}\")\n\nagent = Agent(\n name=\"assistant\",\n model=\"gpt-4\",\n callbacks=[LoggingCallback()]\n)\n```\n\n## Best Practices\n\n1. **Agent Specialization**: Create focused agents with clear roles\n2. **Resource Management**: Use appropriate models for tasks\n3. **Error Handling**: Implement robust error recovery\n4. **Memory Management**: Clean up memory periodically\n5. **Tool Selection**: Choose minimal necessary tools\n6. **Monitoring**: Track agent performance and costs\n\n## Development\n\n### Setup\n\n```bash\ncd pkg/hanzo-agents\nuv sync --all-extras\n```\n\n### Testing\n\n```bash\n# Run tests\npytest tests/\n\n# With coverage\npytest tests/ --cov=hanzo_agents\n```\n\n### Building\n\n```bash\nuv build\n```\n\n## License\n\nApache License 2.0",
"bugtrack_url": null,
"license": "MIT",
"summary": "Production-grade AI agent runtime for deterministic, debuggable agent systems",
"version": "0.1.1",
"project_urls": {
"Documentation": "https://docs.hanzo.ai/agents",
"Homepage": "https://github.com/hanzoai/agents",
"Issues": "https://github.com/hanzoai/agents/issues",
"Repository": "https://github.com/hanzoai/agents"
},
"split_keywords": [
"agents",
" ai",
" llm",
" multi-agent",
" orchestration"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "edf47346be4a7482c2c16010a424e85bbb7cc75cfad40f638709b089b1c01f8e",
"md5": "58e6336cc4b2af14bcfdf94fe8692125",
"sha256": "35e64e2752c6e3981686a04361adb7734815e3a3f295464a4d165acdb44d8deb"
},
"downloads": -1,
"filename": "hanzo_agents-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "58e6336cc4b2af14bcfdf94fe8692125",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 40894,
"upload_time": "2025-09-06T12:47:57",
"upload_time_iso_8601": "2025-09-06T12:47:57.878796Z",
"url": "https://files.pythonhosted.org/packages/ed/f4/7346be4a7482c2c16010a424e85bbb7cc75cfad40f638709b089b1c01f8e/hanzo_agents-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "eec97f6d9fd4f2156957f75146e77f95b49c1924028e91935ca60aab2dcd2fbf",
"md5": "fe08c9c1417c6b191109f732d9c6d69e",
"sha256": "be3203dba641a3bacc722375f922c7cdda8ba1b41b77c6d40f1d4df78779cb81"
},
"downloads": -1,
"filename": "hanzo_agents-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "fe08c9c1417c6b191109f732d9c6d69e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 82794,
"upload_time": "2025-09-06T12:47:59",
"upload_time_iso_8601": "2025-09-06T12:47:59.268128Z",
"url": "https://files.pythonhosted.org/packages/ee/c9/7f6d9fd4f2156957f75146e77f95b49c1924028e91935ca60aab2dcd2fbf/hanzo_agents-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-06 12:47:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hanzoai",
"github_project": "agents",
"github_not_found": true,
"lcname": "hanzo-agents"
}