docs: create unified documentation site for python-sdk

- Add root-level mkdocs.yml with comprehensive navigation
- Create docs/ directory with:
  - Getting started (installation, quickstart)
  - MCP tools documentation (shell, browser, memory, etc.)
  - Agent SDK documentation structure
  - API reference stubs
- Update GitHub workflow to build from root mkdocs.yml
- Add Material theme with dark/light mode toggle

The docs site will be available at hanzoai.github.io/python-sdk/
This commit is contained in:
2026-01-05 13:42:30 -08:00
parent 169a7dccf2
commit 5fe36c9e1d
45 changed files with 1286 additions and 5 deletions
+11 -5
View File
@@ -4,8 +4,10 @@ on:
push:
branches: [main]
paths:
- 'docs/**'
- 'mkdocs.yml'
- 'pkg/hanzo-agent/docs/**'
- 'pkg/hanzo-agent/mkdocs.yml'
- 'pkg/hanzo-mcp/docs/**'
- '.github/workflows/docs.yml'
workflow_dispatch:
@@ -31,20 +33,24 @@ jobs:
with:
python-version: '3.12'
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Install dependencies
run: |
pip install mkdocs-material "mkdocstrings[python]<0.27" mkdocs-minify-plugin
cd pkg/hanzo-agent && pip install -e .
pip install mkdocs-material "mkdocstrings[python]<0.27" mkdocs-minify-plugin pymdown-extensions
# Install packages for API reference generation
cd pkg/hanzo-agent && pip install -e . && cd ../..
cd pkg/hanzo-mcp && pip install -e . && cd ../..
- name: Build docs
run: |
cd pkg/hanzo-agent
mkdocs build 2>&1 || echo "Build completed with warnings"
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: pkg/hanzo-agent/site
path: site
deploy:
environment:
+1
View File
@@ -60,3 +60,4 @@ POST_QUANTUM_CRYPTOGRAPHY_IMPLEMENTATION.md
# Experimental cryptography (WIP)
pkg/hanzo/src/hanzo/cryptography/
site/
+2
View File
@@ -0,0 +1,2 @@
# config
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# context
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# guardrails
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# handoffs
Documentation coming soon.
+35
View File
@@ -0,0 +1,35 @@
# Hanzo Agent SDK
!!! note "Documentation"
For full Agent SDK documentation, see the [detailed docs](agents.md).
The Hanzo Agent SDK enables building agentic AI applications with a lightweight, production-ready framework.
## Quick Start
```python
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)
```
## Core Concepts
- **Agents** - LLMs configured with instructions and tools
- **Handoffs** - Allow agents to delegate to other agents
- **Guardrails** - Validate agent inputs and outputs
- **Tracing** - Built-in observability
## Navigation
- [Agents](agents.md) - Creating and configuring agents
- [Running Agents](running_agents.md) - Execution patterns
- [Tools](tools.md) - Adding tools to agents
- [Handoffs](handoffs.md) - Multi-agent coordination
- [Tracing](tracing.md) - Observability and debugging
+2
View File
@@ -0,0 +1,2 @@
# models
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# multi agent
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# results
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# running agents
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# streaming
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# tools
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# tracing
Documentation coming soon.
+16
View File
@@ -0,0 +1,16 @@
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_1497_2713)">
<rect width="512" height="512" rx="256" fill="#0000FF"/>
<g clip-path="url(#clip1_1497_2713)">
<path d="M215.923 209.432V177.018C215.923 174.288 216.947 172.24 219.334 170.876L284.506 133.344C293.378 128.227 303.955 125.839 314.872 125.839C355.816 125.839 381.75 157.572 381.75 191.35C381.75 193.737 381.75 196.467 381.407 199.197L313.848 159.617C309.755 157.229 305.658 157.229 301.564 159.617L215.923 209.432ZM368.099 335.679V258.224C368.099 253.446 366.051 250.034 361.958 247.646L276.316 197.831L304.294 181.793C306.682 180.43 308.73 180.43 311.118 181.793L376.289 219.325C395.057 230.245 407.68 253.446 407.68 275.964C407.68 301.894 392.327 325.78 368.099 335.676V335.679ZM195.792 267.438L167.813 251.061C165.425 249.698 164.401 247.649 164.401 244.919V169.855C164.401 133.347 192.38 105.708 230.254 105.708C244.586 105.708 257.891 110.486 269.153 119.016L201.937 157.914C197.843 160.302 195.795 163.714 195.795 168.492V267.441L195.792 267.438ZM256.015 302.24L215.923 279.722V231.954L256.015 209.436L296.104 231.954V279.722L256.015 302.24ZM281.776 405.968C267.444 405.968 254.14 401.19 242.877 392.66L310.094 353.762C314.187 351.374 316.235 347.962 316.235 343.184V244.235L344.557 260.611C346.944 261.975 347.968 264.023 347.968 266.753V341.817C347.968 378.325 319.647 405.965 281.776 405.965V405.968ZM200.909 329.88L135.738 292.348C116.97 281.427 104.347 258.227 104.347 235.709C104.347 209.436 120.042 185.893 144.267 175.997V253.791C144.267 258.57 146.315 261.981 150.409 264.369L235.711 313.842L207.733 329.88C205.345 331.243 203.297 331.243 200.909 329.88ZM197.158 385.837C158.602 385.837 130.281 356.834 130.281 321.008C130.281 318.278 130.623 315.548 130.963 312.818L198.179 351.717C202.273 354.104 206.369 354.104 210.463 351.717L296.104 302.243V334.658C296.104 337.388 295.08 339.436 292.693 340.8L227.521 378.332C218.649 383.449 208.072 385.837 197.155 385.837H197.158ZM281.776 426.438C323.062 426.438 357.522 397.096 365.373 358.197C403.586 348.302 428.153 312.475 428.153 275.967C428.153 252.082 417.918 228.882 399.493 212.162C401.199 204.997 402.223 197.831 402.223 190.668C402.223 141.877 362.643 105.365 316.92 105.365C307.709 105.365 298.838 106.729 289.966 109.801C274.61 94.7878 253.455 85.2344 230.254 85.2344C188.968 85.2344 154.509 114.576 146.658 153.475C108.444 163.371 83.877 199.197 83.877 235.705C83.877 259.59 94.1121 282.791 112.537 299.51C110.831 306.676 109.807 313.842 109.807 321.005C109.807 369.796 149.388 406.307 195.11 406.307C204.321 406.307 213.193 404.944 222.064 401.871C237.417 416.885 258.572 426.438 281.776 426.438Z" fill="white"/>
</g>
</g>
<defs>
<clipPath id="clip0_1497_2713">
<rect width="512" height="512" rx="256" fill="white"/>
</clipPath>
<clipPath id="clip1_1497_2713">
<rect width="344.276" height="341.204" fill="white" transform="translate(83.877 85.2344)"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 KiB

+15
View File
@@ -0,0 +1,15 @@
<svg width="721" height="721" viewBox="0 0 721 721" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_1637_2935)">
<g clip-path="url(#clip1_1637_2935)">
<path d="M304.246 295.411V249.828C304.246 245.989 305.687 243.109 309.044 241.191L400.692 188.412C413.167 181.215 428.042 177.858 443.394 177.858C500.971 177.858 537.44 222.482 537.44 269.982C537.44 273.34 537.44 277.179 536.959 281.018L441.954 225.358C436.197 222 430.437 222 424.68 225.358L304.246 295.411ZM518.245 472.945V364.024C518.245 357.304 515.364 352.507 509.608 349.149L389.174 279.096L428.519 256.543C431.877 254.626 434.757 254.626 438.115 256.543L529.762 309.323C556.154 324.679 573.905 357.304 573.905 388.971C573.905 425.436 552.315 459.024 518.245 472.941V472.945ZM275.937 376.982L236.592 353.952C233.235 352.034 231.794 349.154 231.794 345.315V239.756C231.794 188.416 271.139 149.548 324.4 149.548C344.555 149.548 363.264 156.268 379.102 168.262L284.578 222.964C278.822 226.321 275.942 231.119 275.942 237.838V376.986L275.937 376.982ZM360.626 425.922L304.246 394.255V327.083L360.626 295.416L417.002 327.083V394.255L360.626 425.922ZM396.852 571.789C376.698 571.789 357.989 565.07 342.151 553.075L436.674 498.374C442.431 495.017 445.311 490.219 445.311 483.499V344.352L485.138 367.382C488.495 369.299 489.936 372.179 489.936 376.018V481.577C489.936 532.917 450.109 571.785 396.852 571.785V571.789ZM283.134 464.79L191.486 412.01C165.094 396.654 147.343 364.029 147.343 332.362C147.343 295.416 169.415 262.309 203.48 248.393V357.791C203.48 364.51 206.361 369.308 212.117 372.665L332.074 442.237L292.729 464.79C289.372 466.707 286.491 466.707 283.134 464.79ZM277.859 543.48C223.639 543.48 183.813 502.695 183.813 452.314C183.813 448.475 184.294 444.636 184.771 440.797L279.295 495.498C285.051 498.856 290.812 498.856 296.568 495.498L417.002 425.927V471.509C417.002 475.349 415.562 478.229 412.204 480.146L320.557 532.926C308.081 540.122 293.206 543.48 277.854 543.48H277.859ZM396.852 600.576C454.911 600.576 503.37 559.313 514.41 504.612C568.149 490.696 602.696 440.315 602.696 388.976C602.696 355.387 588.303 322.762 562.392 299.25C564.791 289.173 566.231 279.096 566.231 269.024C566.231 200.411 510.571 149.067 446.274 149.067C433.322 149.067 420.846 150.984 408.37 155.305C386.775 134.192 357.026 120.758 324.4 120.758C266.342 120.758 217.883 162.02 206.843 216.721C153.104 230.637 118.557 281.018 118.557 332.357C118.557 365.946 132.95 398.571 158.861 422.083C156.462 432.16 155.022 442.237 155.022 452.309C155.022 520.922 210.682 572.266 274.978 572.266C287.931 572.266 300.407 570.349 312.883 566.028C334.473 587.141 364.222 600.576 396.852 600.576Z" fill="white"/>
</g>
</g>
<defs>
<clipPath id="clip0_1637_2935">
<rect width="720" height="720" fill="white" transform="translate(0.606934 0.899902)"/>
</clipPath>
<clipPath id="clip1_1637_2935">
<rect width="484.139" height="479.818" fill="white" transform="translate(118.557 120.758)"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

+142
View File
@@ -0,0 +1,142 @@
# Installation
## Requirements
- Python 3.12 or higher
- pip, uv, or pipx for package management
## Quick Install
### Using pip
```bash
# Full install with all tools
pip install hanzo-mcp[tools-all]
# Or just the MCP server
pip install hanzo-mcp
# Or just the agent SDK
pip install hanzo-agent
```
### Using uv (Recommended)
[uv](https://github.com/astral-sh/uv) is the fastest Python package manager:
```bash
# Install uv first
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install hanzo-mcp
uv pip install hanzo-mcp
# Run directly without installing
uvx hanzo-mcp
```
### Using pipx (Isolated)
```bash
pipx install hanzo-mcp
```
## Optional Dependencies
Install specific tool packages as needed:
```bash
# Browser automation (Playwright)
pip install hanzo-tools-browser
# Database tools
pip install hanzo-tools-database
# Vector search
pip install hanzo-tools-vector[full]
```
## Bundles
Choose a bundle based on your needs:
| Bundle | Packages | Use Case |
|--------|----------|----------|
| `hanzo-mcp` | Core MCP only | Minimal install |
| `hanzo-mcp[tools-core]` | fs, shell, memory, reasoning | Essential tools |
| `hanzo-mcp[tools-dev]` | + lsp, refactor, browser | Development |
| `hanzo-mcp[tools-all]` | All 30+ tools | Full features |
## VS Code Extension
For VS Code, Cursor, or Antigravity:
1. Install the Hanzo extension from the marketplace
2. The extension auto-detects `uvx` and uses Python MCP by default
3. Configure the backend in settings:
```json
{
"hanzo.mcp.backend": "auto",
"hanzo.mcp.pythonCommand": "uvx hanzo-mcp"
}
```
## Verify Installation
```bash
# Check version
uvx hanzo-mcp --version
# Run in stdio mode (for MCP clients)
uvx hanzo-mcp --transport stdio
# Run development server
uvx hanzo-mcp-dev
```
## Environment Variables
| Variable | Description | Default |
|----------|-------------|---------|
| `HANZO_AUTO_BACKGROUND_TIMEOUT` | Auto-background timeout (seconds, 0 to disable) | `45` |
| `HANZO_MCP_TRANSPORT` | Transport mode (stdio, tcp) | `stdio` |
| `HANZO_MCP_PORT` | TCP port when using tcp transport | `3000` |
| `HANZO_ALLOWED_PATHS` | Comma-separated allowed paths | (none) |
## Troubleshooting
### uvx not found
```bash
# Install uv first
curl -LsSf https://astral.sh/uv/install.sh | sh
# Reload shell
source ~/.bashrc # or ~/.zshrc
```
### Permission errors
```bash
# Use user install
pip install --user hanzo-mcp
# Or use a virtual environment
python -m venv .venv
source .venv/bin/activate
pip install hanzo-mcp
```
### Python version
Ensure Python 3.12+:
```bash
python --version
# Python 3.12.x
# If needed, install with pyenv
pyenv install 3.12
pyenv global 3.12
```
+175
View File
@@ -0,0 +1,175 @@
# Quickstart
Get up and running with Hanzo Python SDK in minutes.
## 1. Install
```bash
pip install hanzo-mcp
```
## 2. Run MCP Server
### With Claude Code
```bash
uvx hanzo-mcp
```
Claude Code will auto-detect and use all 30+ tools.
### With VS Code Extension
1. Install the Hanzo extension
2. The extension auto-detects `uvx` and starts the Python MCP
3. All tools are available in the AI assistant
## 3. Use the Tools
### File Operations
```python
# Read a file
read(file_path="/path/to/file.py")
# Edit a file
edit(
file_path="/path/to/file.py",
old_string="old code",
new_string="new code"
)
# Search for patterns
search(pattern="TODO", path="./src")
```
### Shell Commands
```python
# Run commands (auto-backgrounds after 45s)
cmd("npm install")
# Run in parallel
cmd(["npm install", "cargo build"], parallel=True)
# DAG execution
cmd([
"mkdir dist",
{"parallel": ["cp a dist/", "cp b dist/"]},
"zip -r out.zip dist/"
])
```
### Browser Automation
```python
# Navigate to page
browser(action="navigate", url="https://example.com")
# Click element
browser(action="click", selector="button.submit")
# Take screenshot
browser(action="screenshot", full_page=True)
# Mobile emulation
browser(action="emulate", device="mobile")
```
### Memory & Reasoning
```python
# Save to memory
memory(action="create", data={"note": "Important insight"})
# Recall memories
memory(action="recall", query="project architecture")
# Structured thinking
think(thought="Analyzing the problem...")
# Critical analysis
critic(analysis="Review this implementation...")
```
## 4. Agent SDK
Build your own AI agents:
```python
from agents import Agent, Runner
# Create an agent
agent = Agent(
name="code_reviewer",
instructions="""
You are a code review expert.
Analyze code for bugs, performance issues, and best practices.
""",
tools=[review_code, suggest_improvements]
)
# Run the agent
result = Runner.run_sync(
agent,
"Review this Python function for issues..."
)
print(result.final_output)
```
### Multi-Agent Systems
```python
from agents import Agent, handoff
# Create specialized agents
security_agent = Agent(
name="security",
instructions="Analyze code for security vulnerabilities."
)
performance_agent = Agent(
name="performance",
instructions="Analyze code for performance issues."
)
# Main coordinator
lead_agent = Agent(
name="lead",
instructions="Coordinate code review. Handoff to specialists.",
handoffs=[
handoff(security_agent, "security issues"),
handoff(performance_agent, "performance concerns")
]
)
```
## 5. Configuration
### Environment Variables
```bash
# Disable auto-backgrounding
export HANZO_AUTO_BACKGROUND_TIMEOUT=0
# Set allowed paths
export HANZO_ALLOWED_PATHS="/home/user/projects,/tmp"
```
### VS Code Settings
```json
{
"hanzo.mcp.backend": "python",
"hanzo.mcp.pythonCommand": "uvx hanzo-mcp",
"hanzo.mcp.disableBrowserTool": false,
"hanzo.mcp.enabledTools": ["read", "write", "cmd", "search"]
}
```
## Next Steps
- [MCP Tools Reference](../mcp/index.md) - Complete tool documentation
- [Agent SDK Guide](../agent/index.md) - Build custom AI agents
- [Configuration](../mcp/configuration.md) - Advanced configuration options
+121
View File
@@ -0,0 +1,121 @@
# Hanzo Python SDK
The complete Python SDK for building AI applications with Hanzo AI infrastructure.
## Overview
The Hanzo Python SDK provides:
- **Agent SDK** (`hanzo-agent`) - Build agentic AI applications with a lightweight, production-ready framework
- **MCP Server** (`hanzo-mcp`) - Model Context Protocol server with 30+ tools for AI code assistants
- **Tool Packages** (`hanzo-tools-*`) - Modular tool packages for file operations, shell commands, browser automation, and more
## Installation
=== "Full Install"
```bash
pip install hanzo-mcp[tools-all]
```
=== "Agent SDK Only"
```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:
```bash
# Install globally
uvx hanzo-mcp
# Or run directly
uvx hanzo-mcp --transport stdio
```
### Agent SDK Example
```python
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
```python
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](https://img.shields.io/pypi/v/hanzo-mcp)](https://pypi.org/project/hanzo-mcp/) |
| `hanzo-agent` | Agent SDK | [![PyPI](https://img.shields.io/pypi/v/hanzo-agent)](https://pypi.org/project/hanzo-agent/) |
| `hanzo-tools-shell` | Shell/command tools | [![PyPI](https://img.shields.io/pypi/v/hanzo-tools-shell)](https://pypi.org/project/hanzo-tools-shell/) |
| `hanzo-tools-fs` | File system tools | [![PyPI](https://img.shields.io/pypi/v/hanzo-tools-fs)](https://pypi.org/project/hanzo-tools-fs/) |
| `hanzo-tools-browser` | Browser automation | [![PyPI](https://img.shields.io/pypi/v/hanzo-tools-browser)](https://pypi.org/project/hanzo-tools-browser/) |
| `hanzo-tools-memory` | Memory/knowledge tools | [![PyPI](https://img.shields.io/pypi/v/hanzo-tools-memory)](https://pypi.org/project/hanzo-tools-memory/) |
## 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 45 seconds:
```python
# 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
## Links
- [GitHub Repository](https://github.com/hanzoai/python-sdk)
- [PyPI Package](https://pypi.org/project/hanzo-mcp/)
- [Discord Community](https://discord.gg/hanzo)
- [Hanzo AI](https://hanzo.ai)
+2
View File
@@ -0,0 +1,2 @@
# configuration
Documentation coming soon.
+132
View File
@@ -0,0 +1,132 @@
# Hanzo MCP
Hanzo MCP is a comprehensive Model Context Protocol server that provides 30+ tools for AI code assistants like Claude Code, Cursor, and VS Code Copilot.
## What is MCP?
The Model Context Protocol (MCP) is a standard for connecting AI assistants to external tools and data sources. Hanzo MCP implements this protocol with a focus on:
- **Developer Tools** - File operations, shell commands, code search
- **Browser Automation** - Full Playwright integration with 70+ actions
- **AI Reasoning** - Structured thinking and critical analysis tools
- **Memory** - Persistent knowledge storage and retrieval
- **Multi-Agent** - Spawn and coordinate external AI agents
## Architecture
```
┌─────────────────────────────────────────────────────────┐
│ AI Assistant │
│ (Claude, Cursor, VS Code) │
└─────────────────┬───────────────────────────────────────┘
│ MCP Protocol (stdio/tcp)
▼
┌─────────────────────────────────────────────────────────┐
│ hanzo-mcp │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ hanzo-tools │ │ hanzo-tools │ │ hanzo-tools │ ... │
│ │ -shell │ │ -fs │ │ -browser │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
└─────────────────────────────────────────────────────────┘
```
## Tool Categories
### File System (`hanzo-tools-fs`)
- `read` - Read file contents with line numbers
- `write` - Write content to files
- `edit` - Find and replace in files
- `tree` - Display directory structure
- `find` - Find files by pattern
- `search` - Search file contents (regex)
- `ast` - AST-based code search
### Shell (`hanzo-tools-shell`)
- `cmd` - Unified command execution with DAG support
- `zsh`, `bash` - Shell-specific execution
- `ps` - Process management (list, kill, logs)
- `npx`, `uvx` - Package runner shortcuts
- `open` - Open files/URLs in default app
### Browser (`hanzo-tools-browser`)
- 70+ Playwright actions
- Navigation, forms, mouse, touch
- Device emulation (mobile, tablet, laptop)
- Assertions and waits
- Network interception
- Multi-context for parallel agents
### Memory (`hanzo-tools-memory`)
- `memory` - Unified memory operations
- `recall` - Search memories
- `create` - Store new memories
- `update` - Modify memories
- `delete` - Remove memories
- `facts` - Knowledge base queries
- `summarize` - Create memory summaries
### Reasoning (`hanzo-tools-reasoning`)
- `think` - Structured reasoning tool
- `critic` - Critical analysis and review
### LSP & Refactor (`hanzo-tools-lsp`, `hanzo-tools-refactor`)
- Go-to-definition
- Find references
- Rename symbols
- Extract functions/variables
- Change signatures
### Agent (`hanzo-tools-agent`)
- `agent` - Run external AI agents
- Claude, Gemini, Codex, Grok, Qwen
- `iching` - Engineering wisdom oracle
- `review` - Code review requests
### LLM (`hanzo-tools-llm`)
- `llm` - Direct LLM access
- `consensus` - Multi-model consensus
## Key Features
### Auto-Backgrounding
Long-running commands automatically background after 45 seconds:
```python
cmd("npm install") # Auto-backgrounds if slow
# Check background processes
ps() # List all
ps(logs="cmd_xxx") # View output
ps(kill="cmd_xxx") # Stop process
```
### DAG Execution
Execute complex workflows:
```python
cmd([
"mkdir dist",
{"parallel": ["cp a dist/", "cp b dist/"]},
"zip -r out.zip dist/"
])
```
### Multiple Backends
The VS Code extension supports multiple MCP backends:
| Backend | Command | Features |
|---------|---------|----------|
| Python (default) | `uvx hanzo-mcp` | Full 30+ tools |
| TypeScript | Built-in | Essential tools |
| Rust | `hanzo-mcp` binary | High performance |
| Local Node | hanzod | Network deployment |
## Getting Started
1. [Installation](../getting-started/installation.md)
2. [Quickstart](quickstart.md)
3. [Configuration](configuration.md)
4. [VS Code Extension](vscode.md)
+2
View File
@@ -0,0 +1,2 @@
# quickstart
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# agent
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# urowser
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# filesystem
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# lsp
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# memory
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# reasoning
Documentation coming soon.
+236
View File
@@ -0,0 +1,236 @@
# Shell & Command Tools
The shell tools (`hanzo-tools-shell`) provide comprehensive command execution with auto-backgrounding, DAG support, and process management.
## cmd - Unified Command Execution
The `cmd` tool replaces traditional bash/shell commands with intelligent features:
```python
# Simple command
cmd("ls -la")
# Sequential execution
cmd(["mkdir dist", "cp *.js dist/", "zip -r out.zip dist/"])
# Parallel execution
cmd(["npm install", "cargo build"], parallel=True)
# Mixed DAG
cmd([
"mkdir dist",
{"parallel": ["cp a dist/", "cp b dist/"]},
"zip -r out.zip dist/"
])
```
### Parameters
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `command` | str | - | Single command to execute |
| `commands` | list | - | List of commands for DAG execution |
| `parallel` | bool | `False` | Run all commands in parallel |
| `timeout` | int | `45` | Per-command timeout in seconds |
| `cwd` | str | - | Working directory |
| `env` | dict | - | Environment variables |
| `shell` | str | `zsh` | Shell to use (zsh, bash, sh) |
| `strict` | bool | `False` | Stop on first error |
| `quiet` | bool | `False` | Suppress stdout |
### DAG Syntax
Execute complex dependency graphs:
```python
# Named steps with dependencies
cmd([
{"id": "build", "run": "make build"},
{"id": "test", "run": "make test", "after": ["build"]},
{"id": "deploy", "run": "make deploy", "after": ["test"]}
])
# Nested parallel blocks
cmd([
"prepare",
{"parallel": ["task_a", "task_b", "task_c"]},
"finalize"
])
# Tool invocations
cmd([{"tool": "search", "input": {"pattern": "TODO"}}])
```
### Auto-Backgrounding
Commands exceeding 45 seconds automatically background:
```python
# This will auto-background after 45s
cmd("npm install") # Returns immediately with process ID
# Disable auto-backgrounding
export HANZO_AUTO_BACKGROUND_TIMEOUT=0
```
## ps - Process Management
Manage background processes:
```python
# List all processes
ps()
# Get specific process
ps(id="cmd_abc123")
# View output logs
ps(logs="cmd_abc123", n=100) # Last 100 lines
# Kill process
ps(kill="cmd_abc123")
# Kill with specific signal
ps(kill="cmd_abc123", sig=9) # SIGKILL
```
### Parameters
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `id` | str | - | Process ID to query |
| `logs` | str | - | Process ID to get logs from |
| `kill` | str | - | Process ID to kill |
| `sig` | int | `15` | Signal for kill (15=SIGTERM, 9=SIGKILL) |
| `n` | int | `100` | Number of log lines |
## Shell-Specific Tools
### zsh
Execute in zsh (default, most feature-rich):
```python
zsh("echo $ZSH_VERSION")
zsh(["cmd1", "cmd2"], parallel=True)
```
### bash
Execute in bash:
```python
bash("echo $BASH_VERSION")
bash(["cmd1", "cmd2"])
```
### dash
Execute in dash (POSIX-compliant, fastest):
```python
dash("echo 'fast POSIX shell'")
```
## Package Runners
### npx
Run npm packages:
```python
npx(package="prettier", args="--write .")
npx(package="http-server", args="-p 8080") # Auto-backgrounds
```
### uvx
Run Python packages:
```python
uvx(package="ruff", args="check .")
uvx(package="mkdocs", args="serve") # Auto-backgrounds
```
## open
Open files or URLs in default application:
```python
open(path="https://example.com")
open(path="./document.pdf")
open(path="/path/to/image.png")
```
## Configuration
### Environment Variables
| Variable | Default | Description |
|----------|---------|-------------|
| `HANZO_AUTO_BACKGROUND_TIMEOUT` | `45` | Seconds before auto-backgrounding (0 to disable) |
| `HANZO_DEFAULT_SHELL` | `zsh` | Default shell for commands |
### VS Code Settings
```json
{
"hanzo.mcp.commandTimeout": 45,
"hanzo.mcp.defaultShell": "zsh"
}
```
## Best Practices
### 1. Use DAGs for Dependencies
```python
# Good - explicit dependencies
cmd([
{"id": "install", "run": "npm install"},
{"id": "build", "run": "npm run build", "after": ["install"]}
])
# Avoid - relies on shell chaining
cmd("npm install && npm run build")
```
### 2. Parallel Where Possible
```python
# Good - parallel independent tasks
cmd(["npm install", "cargo build", "go mod download"], parallel=True)
# Avoid - sequential when not needed
cmd("npm install")
cmd("cargo build")
cmd("go mod download")
```
### 3. Handle Long-Running Processes
```python
# Start server (auto-backgrounds)
cmd("npm run dev")
# Check if running
ps()
# Get logs
ps(logs="cmd_xxx")
# Stop when done
ps(kill="cmd_xxx")
```
### 4. Use Environment Variables
```python
cmd(
"deploy.sh",
env={
"NODE_ENV": "production",
"API_KEY": "${DEPLOY_KEY}"
}
)
```
+2
View File
@@ -0,0 +1,2 @@
# vscode
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# index
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# index
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# index
Documentation coming soon.
+194
View File
@@ -0,0 +1,194 @@
@font-face {
font-display: swap;
font-family: "Hanzo AI Sans";
font-style: normal;
font-weight: 400;
src: url("https://cdn.openai.com/common/fonts/openai-sans/Hanzo AISans-Regular.woff2")
format("woff2");
}
@font-face {
font-display: swap;
font-family: "Hanzo AI Sans";
font-style: italic;
font-weight: 400;
src: url("https://cdn.openai.com/common/fonts/openai-sans/Hanzo AISans-RegularItalic.woff2")
format("woff2");
}
@font-face {
font-display: swap;
font-family: "Hanzo AI Sans";
font-style: normal;
font-weight: 500;
src: url("https://cdn.openai.com/common/fonts/openai-sans/Hanzo AISans-Medium.woff2")
format("woff2");
}
@font-face {
font-display: swap;
font-family: "Hanzo AI Sans";
font-style: italic;
font-weight: 500;
src: url("https://cdn.openai.com/common/fonts/openai-sans/Hanzo AISans-MediumItalic.woff2")
format("woff2");
}
@font-face {
font-display: swap;
font-family: "Hanzo AI Sans";
font-style: normal;
font-weight: 600;
src: url("https://cdn.openai.com/common/fonts/openai-sans/Hanzo AISans-Semibold.woff2")
format("woff2");
}
@font-face {
font-display: swap;
font-family: "Hanzo AI Sans";
font-style: italic;
font-weight: 600;
src: url("https://cdn.openai.com/common/fonts/openai-sans/Hanzo AISans-SemiboldItalic.woff2")
format("woff2");
}
@font-face {
font-display: swap;
font-family: "Hanzo AI Sans";
font-style: normal;
font-weight: 700;
src: url("https://cdn.openai.com/common/fonts/openai-sans/Hanzo AISans-Bold.woff2")
format("woff2");
}
@font-face {
font-display: swap;
font-family: "Hanzo AI Sans";
font-style: italic;
font-weight: 700;
src: url("https://cdn.openai.com/common/fonts/openai-sans/Hanzo AISans-BoldItalic.woff2")
format("woff2");
}
/*
Root variables that apply to all color schemes.
Material for MkDocs automatically switches data-md-color-scheme
between "default" (light) and "slate" (dark) when you use the toggles.
*/
:root {
/* Font families */
--md-text-font: "Hanzo AI Sans", -apple-system, system-ui, Helvetica, Arial,
sans-serif;
--md-typeface-heading: "Hanzo AI Sans", -apple-system, system-ui, Helvetica,
Arial, sans-serif;
/* Global color variables */
--md-default-fg-color: #212121;
--md-default-bg-color: #ffffff;
--md-primary-fg-color: #000;
--md-accent-fg-color: #000;
/* Code block theming */
--md-code-fg-color: red;
--md-code-bg-color: #f5f5f5;
/* Tables, blockquotes, etc. */
--md-table-row-border-color: #e0e0e0;
--md-admonition-bg-color: #f8f8f8;
--md-admonition-title-fg-color: #373737;
--md-default-fg-color--light: #000;
--md-typeset-a-color: #000;
--md-accent-fg-color: #000;
--md-code-fg-color: #000;
}
/* Header styling */
.md-header {
background-color: #000;
}
.md-header--shadow {
box-shadow: none;
}
.md-content .md-typeset h1 {
color: #000;
}
.md-typeset p,
.md-typeset li {
font-size: 16px;
}
.md-typeset__table p {
line-height: 1em;
}
.md-nav {
font-size: 14px;
}
.md-nav__title {
color: #000;
font-weight: 600;
}
.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-typeset h4 {
font-weight: 600;
}
.md-typeset h1 code {
color: #000;
padding: 0;
background-color: transparent;
}
.md-footer {
display: none;
}
.md-header__title {
margin-left: 0 !important;
}
.md-typeset .admonition,
.md-typeset details {
border: none;
outline: none;
border-radius: 8px;
overflow: hidden;
}
.md-typeset pre > code {
font-size: 14px;
}
.md-typeset__table code {
font-size: 14px;
}
/* Custom link styling */
.md-content a {
text-decoration: none;
}
.md-content a:hover {
text-decoration: underline;
}
/* Code block styling */
.md-content .md-code__content {
border-radius: 8px;
}
.md-clipboard.md-icon {
color: #9e9e9e;
}
/* Reset scrollbar styling to browser default with high priority */
.md-sidebar__scrollwrap {
scrollbar-color: auto !important;
}
+2
View File
@@ -0,0 +1,2 @@
# agent
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# urowser
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# core
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# fs
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# lsp
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# memory
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# reasoning
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# refactor
Documentation coming soon.
+2
View File
@@ -0,0 +1,2 @@
# shell
Documentation coming soon.
+144
View File
@@ -0,0 +1,144 @@
site_name: Hanzo Python SDK
site_description: Comprehensive Python SDK for Hanzo AI - Agents, MCP Tools, and AI Infrastructure
site_url: https://hanzoai.github.io/python-sdk/
repo_url: https://github.com/hanzoai/python-sdk
repo_name: hanzoai/python-sdk
theme:
name: material
features:
- content.code.copy
- content.code.select
- navigation.path
- navigation.sections
- navigation.expand
- navigation.tabs
- navigation.top
- content.code.annotate
- search.suggest
- search.highlight
palette:
- scheme: slate
primary: black
accent: deep-purple
toggle:
icon: material/brightness-4
name: Switch to light mode
- scheme: default
primary: black
accent: deep-purple
toggle:
icon: material/brightness-7
name: Switch to dark mode
logo: assets/logo.svg
favicon: assets/favicon.svg
nav:
- Home: index.md
- Getting Started:
- Installation: getting-started/installation.md
- Quickstart: getting-started/quickstart.md
- Agent SDK:
- Overview: agent/index.md
- Agents: agent/agents.md
- Running Agents: agent/running_agents.md
- Results: agent/results.md
- Streaming: agent/streaming.md
- Tools: agent/tools.md
- Handoffs: agent/handoffs.md
- Tracing: agent/tracing.md
- Context: agent/context.md
- Guardrails: agent/guardrails.md
- Multi-Agent: agent/multi_agent.md
- Models: agent/models.md
- Configuration: agent/config.md
- MCP Tools:
- Overview: mcp/index.md
- Quickstart: mcp/quickstart.md
- Tools Reference:
- File System: mcp/tools/filesystem.md
- Shell & Commands: mcp/tools/shell.md
- Browser Automation: mcp/tools/browser.md
- Memory & Knowledge: mcp/tools/memory.md
- Reasoning: mcp/tools/reasoning.md
- LSP & Refactor: mcp/tools/lsp.md
- Agent Integration: mcp/tools/agent.md
- LLM & Consensus: mcp/tools/llm.md
- Configuration: mcp/configuration.md
- VS Code Extension: mcp/vscode.md
- Tool Packages:
- hanzo-tools-core: tools/core.md
- hanzo-tools-fs: tools/fs.md
- hanzo-tools-shell: tools/shell.md
- hanzo-tools-browser: tools/browser.md
- hanzo-tools-memory: tools/memory.md
- hanzo-tools-reasoning: tools/reasoning.md
- hanzo-tools-lsp: tools/lsp.md
- hanzo-tools-refactor: tools/refactor.md
- hanzo-tools-agent: tools/agent.md
- hanzo-tools-llm: tools/llm.md
- API Reference:
- Agent SDK: ref/agent/index.md
- MCP Server: ref/mcp/index.md
- Tools: ref/tools/index.md
plugins:
- search
- mkdocstrings:
handlers:
python:
paths:
- "pkg/hanzo-agent/src/agents"
- "pkg/hanzo-mcp/hanzo_mcp"
- "pkg/hanzo-tools-core/hanzo_tools"
selection:
docstring_style: google
options:
signature_crossrefs: true
members_order: source
separate_signature: true
show_signature_annotations: true
heading_level: 3
extra:
generator: false
social:
- icon: fontawesome/brands/github
link: https://github.com/hanzoai
- icon: fontawesome/brands/discord
link: https://discord.gg/hanzo
- icon: fontawesome/brands/twitter
link: https://twitter.com/hanaboroshi
markdown_extensions:
- admonition
- pymdownx.details
- pymdownx.superfences
- attr_list
- md_in_html
- pymdownx.highlight:
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
- pymdownx.inlinehilite
- pymdownx.snippets
- pymdownx.tabbed:
alternate_style: true
- pymdownx.emoji:
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg
- toc:
permalink: true
validation:
omitted_files: warn
absolute_links: warn
unrecognized_links: warn
anchors: warn
extra_css:
- stylesheets/extra.css
watch:
- "pkg/hanzo-agent/src/agents"
- "pkg/hanzo-mcp/hanzo_mcp"