Production-grade AI agent runtime for deterministic, debuggable agent systems
Project description
Hanzo Agents SDK
Production-grade AI agent runtime for building deterministic, debuggable, and scalable agent systems.
Overview
Hanzo Agents SDK provides nine first-class abstractions for building AI agent systems:
- Agents - Encapsulate skills and tools with zero side-effects outside tool calls
- Tools - Perform side-effects and mutate state in a typed, inspectable way
- Networks - Orchestrate agent execution with deterministic routing
- State - Strongly-typed, validated state containers
- Routers - Control agent flow (deterministic or hybrid LLM-based)
- History - Chronological log for replay and audit
- Memory - Long-term storage (KV and vector)
- Models - Unified adapter interface for any LLM
- Deployment - Production-ready with telemetry, checkpointing, and scale
Quick Start
pip install hanzo-agents[all]
# Run an example network
hanzo-agents run examples/code_fix_network.py \
--state '{"repo":"demo"}' \
--model claude-3-opus
Core Concepts
Agents
from hanzo_agents import Agent, Tool
from typing import List
class PlanningAgent(Agent[ProjectState]):
name = "planner"
description = "Creates project plans"
model = "model://anthropic/claude-3-haiku"
tools: List[Tool] = [
CreatePlanTool(),
UpdatePlanTool(),
]
Tools
from hanzo_agents import Tool
from pydantic import BaseModel
class CreatePlanTool(Tool[ProjectState]):
name = "create_plan"
description = "Create a new project plan"
class Parameters(BaseModel):
tasks: List[str]
timeline: str
def handle(self, tasks: List[str], timeline: str, network):
# Mutate state in a typed way
network.state.plan = Plan(tasks=tasks, timeline=timeline)
return f"Created plan with {len(tasks)} tasks"
Networks & Routers
from hanzo_agents import Network, State
from dataclasses import dataclass
@dataclass
class ProjectState(State):
repo: str
plan: Optional[Plan] = None
tests_passed: bool = False
done: bool = False
def project_router(network, call_count, last_result, stack):
"""Deterministic routing logic"""
s = network.state
if s.done or call_count > 50:
return None
if s.plan is None:
return PlanningAgent
if not s.tests_passed:
return TestingAgent
s.done = True
return None
# Run the network
network = Network(
state=ProjectState(repo="my-project"),
agents=[PlanningAgent, TestingAgent, ReviewAgent],
router=project_router
)
network.run()
Memory
# Long-term memory for context across runs
network = Network(
state=state,
agents=agents,
router=router,
memory_kv=SQLiteKV("project.db"),
memory_vector=FAISSVector(dimension=1536)
)
# Agents can query memory
class ResearchAgent(Agent):
async def run(self, state, history):
# Pull relevant context
context = await self.network.memory.vector.query(
"previous security findings",
k=5
)
# Use in prompt...
CLI
The hanzo-agents CLI provides:
# Basic execution
hanzo-agents run network.py --state '{"key": "value"}'
# Model configuration
hanzo-agents run network.py --model gpt-4 --model-config config.yaml
# GPU selection
hanzo-agents run network.py --cuda 0
# Observability
hanzo-agents run network.py --json-lines --port 9464 # Prometheus
# Checkpointing
hanzo-agents run network.py --checkpoint state.chkpt
hanzo-agents run network.py --restore state.chkpt
Production Features
- Type Safety: Full typing with generics for compile-time guarantees
- Deterministic: Reproducible execution with explicit state mutations
- Observable: OpenTelemetry tracing + Prometheus metrics built-in
- Scalable: Horizontal scaling via stateless networks
- Debuggable: Step-through debugging with history replay
- Extensible: Plugin architecture for tools, models, and memory backends
Architecture
hanzo_agents/
├── core/
│ ├── agent.py # Agent base class and registry
│ ├── tool.py # Tool base class and decorators
│ ├── state.py # State validation and guards
│ ├── router.py # Router types and helpers
│ ├── network.py # Main orchestration loop
│ ├── history.py # Interaction logging
│ ├── memory.py # Memory backends (KV, vector)
│ └── model.py # Model adapters and registry
├── contrib/ # Optional integrations
│ ├── chromadb.py # ChromaDB vector store
│ ├── neo4j.py # Neo4j graph memory
│ └── langchain.py # LangChain compatibility
├── cli.py # CLI entry point
└── examples/ # Example networks
License
MIT License - see LICENSE file for details.
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 hanzo_agents-0.1.0.tar.gz.
File metadata
- Download URL: hanzo_agents-0.1.0.tar.gz
- Upload date:
- Size: 76.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ac769974dcb21d412308fd2aa06ca11c3391a5298773e80cd3d4893f4847bc1
|
|
| MD5 |
2f59ffdd234804aab1ed3247a0f78c3d
|
|
| BLAKE2b-256 |
039c9b79428a3dd1bcebfdb8b0738b562d7ebc0ab3d0faf20ca5b3cde367c330
|
File details
Details for the file hanzo_agents-0.1.0-py3-none-any.whl.
File metadata
- Download URL: hanzo_agents-0.1.0-py3-none-any.whl
- Upload date:
- Size: 41.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc7fff1be60764ed9bb4217d3c1fa806d97b976048ac098019eb1c32cb855cc9
|
|
| MD5 |
63464db6575c4a6b3e7b0829e8a95824
|
|
| BLAKE2b-256 |
aea71a92ab00ebd3339b7a84d3bd6715f36cee2e9a65373fcedcf5153c6dd259
|