Files
python-sdk/docs/index.md
zeekay 5acb444f42 rescue: snapshot of orphaned worktree /home/z/work/hanzo/python-sdk-limits
Parent checkout /home/z/work/hanzo/python-sdk was deleted; this is the surviving working tree
(worktree .git admin dir lost). Base: 5c0cc67e39 (2026-10-04).
Omitted (secret/size screen): 0 file(s).

Claude-Session: https://claude.ai/code/session_015XYKLn69gF4x75RWePpDBV
2026-11-20 23:15:53 -08:00

4.7 KiB

Hanzo Python SDK

A workspace of 65 packages. Two things live here that people usually arrive for: the API client, and the MCP server.

The API client (hanzoai)

Generated from the Hanzo API's own OpenAPI document — 1814 paths, 2479 operations, 192 API classes over 2460 models. It is documented in the repository README, which carries the install line, the quickstart and the five runnable flows in examples/.

import os
from hanzoai.cloud import ApiClient, Configuration, KeysApi

client = ApiClient(
    Configuration(host="https://api.hanzo.ai"),
    "Authorization", f"Bearer {os.environ['HANZO_API_KEY']}",
)

with client as api:
    for key in KeysApi(api).get_keys().keys or []:
        print(key.prefix, key.type, key.created_at)

The rest of this site is the MCP server, the agent framework and the tool packages.

Installation

=== "MCP server" bash pip install hanzo-mcp

=== "Agent SDK" bash pip install hanzo-agent

=== "Using uv" bash uv pip install hanzo-mcp

Quick Start

Using with Claude Code

The easiest way to use Hanzo MCP is with Claude Code:

# Install globally
uvx hanzo-mcp

# Or run directly
uvx hanzo-mcp --transport stdio

Agent SDK Example

from agents import Agent, Runner

agent = Agent(
    name="assistant",
    instructions="You are a helpful assistant."
)

result = Runner.run_sync(agent, "Hello!")
print(result.final_output)

MCP Tools Example

from hanzo_mcp import create_mcp_server

# Create server with all tools
server = create_mcp_server()
server.run()

Packages

Package Description PyPI
hanzo-mcp MCP server with all tools PyPI
hanzo-agent Agent SDK PyPI
hanzo-tools-shell Shell/command tools PyPI
hanzo-tools-fs File system tools PyPI
hanzo-tools-browser Browser automation PyPI
hanzo-tools-memory Memory/knowledge tools PyPI

Features

30+ MCP Tools

  • File System: read, write, edit, tree, find, search, ast
  • Shell: cmd, zsh, bash, ps, npx, uvx, open
  • Browser: Full Playwright automation with 70+ actions
  • Memory: Unified memory tool with recall, create, update, delete
  • Reasoning: think, critic for structured AI reasoning
  • LSP: Go-to-definition, find references, rename, hover
  • Refactor: Advanced code refactoring with AST support
  • Agent: Run external AI agents (Claude, Gemini, Codex, etc.)
  • LLM: Direct LLM access and multi-model consensus

Auto-Backgrounding

Long-running commands automatically background after 30 seconds:

# This will auto-background if it takes too long
cmd("npm install")

# Check status
ps()  # List all background processes
ps(logs="cmd_xxx")  # View output
ps(kill="cmd_xxx")  # Stop process

Multi-Backend Support

Use the MCP with any AI assistant:

  • Claude Code - uvx hanzo-mcp
  • VS Code/Cursor - Hanzo extension with auto-detection
  • Antigravity - Full integration via Open VSX
  • Any MCP Client - Standard MCP protocol

Documentation

Getting Started

Reference

Tool Categories