Files
zeekay 9e93ffbeb2 Name the rest of the stack without importing it
`import hanzo` ran the CLI's module body, so it needed click, rich, httpx and
everything else in the list before it could tell you its own version — on a
bare interpreter it did not import at all. It also read `__version__` back off
this module from `cli`, a cycle that only worked because the assignment
happened to sit above the import.

Both go away by naming things instead of importing them. `__getattr__`
(PEP 562) resolves a member on first touch and caches it, so `hanzo.cloud`
costs nothing until somebody wants the cloud client, and the second touch is a
dict lookup. A member that is not installed says which distribution to install
rather than raising ModuleNotFoundError from somewhere inside us.

This is the shape the npm package and the Rust crate already had: one front
door, everything behind it, nothing loaded that was not asked for. One table
maps a name to its distribution, so adding a member is one line.
2026-09-05 18:15:02 -07:00
..

hanzo

PyPI Python Version

Python orchestration helpers for Hanzo AI, and the older Python implementation of the Hanzo CLI.

The hanzo command lives elsewhere now

The Hanzo CLI is a native binary. Install it with:

curl -fsSL https://hanzo.sh | sh
hanzo auth login

That gives you hanzo (and hanzo-node, a symlink to the same build) with one command group per Hanzo Cloud product. This package's console script is hanzo-py — deliberately not hanzo, so it cannot shadow the real CLI on your PATH:

pip install hanzo
hanzo-py --help

Nothing here is being removed. If you have scripts on hanzo-py, they keep working; new work should target the native CLI.

What's still useful here

The Python library pieces, importable without touching the CLI:

from hanzo.batch_orchestrator import BatchOrchestrator

orchestrator = BatchOrchestrator()
results = await orchestrator.run_batch([
    "Summarize the incident report",
    "Draft the follow-up email",
])
from hanzo.memory_manager import MemoryManager

memory = MemoryManager()
memory.add_to_context("user", "What changed in the last deploy?")
context = memory.get_context()
from hanzo.fallback_handler import FallbackHandler

handler = FallbackHandler()
result = await handler.handle_with_fallback(
    primary_fn=api_call,
    fallback_fn=local_inference,
)

For the typed Hanzo Cloud API client, install hanzoai.

Configuration

HANZO_API_KEY=sk-...
HANZO_BASE_URL=https://api.hanzo.ai

Model ids come from the cloud catalog, not from this file — zen5, zen5-coder, zen5-flash, zen5-mini, zen5-pro, enso, enso-flash, enso-ultra. Ask the cloud rather than hardcoding: hanzo models list.

Development

cd pkg/hanzo
uv sync --all-extras
uv build

License

Apache 2.0