mirror of
https://github.com/hanzoai/python-sdk.git
synced 2026-10-23 20:23:00 +00:00
feat: add hanzo-agents package with CLI
- hanzo-agents run <agent> <prompt> - hanzo-agents list - hanzo-agents status - hanzo-agents config Supports: claude, codex, gemini, grok, qwen, vibe
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
# hanzo-agents
|
||||
|
||||
Multi-agent orchestration CLI for Hanzo AI.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
# Install via uv
|
||||
uv tool install hanzo-agents
|
||||
|
||||
# Or via pip
|
||||
pip install hanzo-agents
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
# Run an agent
|
||||
hanzo-agents run claude "Explain this code"
|
||||
hanzo-agents run gemini "Review this PR"
|
||||
|
||||
# List available agents
|
||||
hanzo-agents list
|
||||
|
||||
# Check agent status
|
||||
hanzo-agents status
|
||||
hanzo-agents status claude
|
||||
|
||||
# Show configuration
|
||||
hanzo-agents config
|
||||
```
|
||||
|
||||
## Available Agents
|
||||
|
||||
| Agent | Description |
|
||||
|-------|-------------|
|
||||
| `claude` | Anthropic Claude Code CLI |
|
||||
| `codex` | OpenAI Codex CLI |
|
||||
| `gemini` | Google Gemini CLI |
|
||||
| `grok` | xAI Grok CLI |
|
||||
| `qwen` | Alibaba Qwen CLI |
|
||||
| `vibe` | Vibe coding agent |
|
||||
|
||||
## Library Usage
|
||||
|
||||
```python
|
||||
from hanzo_agents import AgentTool
|
||||
import asyncio
|
||||
|
||||
tool = AgentTool()
|
||||
result = asyncio.run(tool.call(None, action="run", name="claude", prompt="Hello"))
|
||||
print(result)
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Apache 2.0
|
||||
@@ -0,0 +1,26 @@
|
||||
"""Hanzo Agents - Multi-agent orchestration for Hanzo AI.
|
||||
|
||||
This package provides a CLI and library for running and orchestrating
|
||||
multiple AI agents including Claude, Codex, Gemini, Grok, and more.
|
||||
|
||||
Usage:
|
||||
# CLI
|
||||
hanzo-agents run claude "Explain this code"
|
||||
hanzo-agents list
|
||||
hanzo-agents status
|
||||
|
||||
# Library
|
||||
from hanzo_agents import run_agent, list_agents
|
||||
result = await run_agent("claude", "Explain this code")
|
||||
"""
|
||||
|
||||
__version__ = "0.1.2"
|
||||
|
||||
from hanzo_tools.agent import AgentTool, IChingTool, ReviewTool
|
||||
|
||||
__all__ = [
|
||||
"__version__",
|
||||
"AgentTool",
|
||||
"IChingTool",
|
||||
"ReviewTool",
|
||||
]
|
||||
@@ -0,0 +1,135 @@
|
||||
"""CLI for hanzo-agents."""
|
||||
|
||||
import asyncio
|
||||
import sys
|
||||
|
||||
import click
|
||||
from rich.console import Console
|
||||
from rich.table import Table
|
||||
|
||||
from . import __version__
|
||||
|
||||
console = Console()
|
||||
|
||||
|
||||
@click.group(invoke_without_command=True)
|
||||
@click.option("--version", "-v", is_flag=True, help="Show version")
|
||||
@click.pass_context
|
||||
def main(ctx, version):
|
||||
"""Hanzo Agents - Multi-agent orchestration CLI.
|
||||
|
||||
Run and orchestrate AI agents including Claude, Codex, Gemini, Grok, and more.
|
||||
|
||||
Examples:
|
||||
hanzo-agents run claude "Explain this code"
|
||||
hanzo-agents list
|
||||
hanzo-agents status claude
|
||||
"""
|
||||
if version:
|
||||
console.print(f"hanzo-agents {__version__}")
|
||||
return
|
||||
|
||||
if ctx.invoked_subcommand is None:
|
||||
click.echo(ctx.get_help())
|
||||
|
||||
|
||||
@main.command()
|
||||
@click.argument("agent", required=False)
|
||||
@click.argument("prompt", required=False)
|
||||
@click.option("--timeout", "-t", default=300, help="Timeout in seconds")
|
||||
def run(agent, prompt, timeout):
|
||||
"""Run an agent with a prompt.
|
||||
|
||||
Examples:
|
||||
hanzo-agents run claude "Explain this code"
|
||||
hanzo-agents run gemini "Review this PR"
|
||||
"""
|
||||
if not agent:
|
||||
console.print("[yellow]Usage: hanzo-agents run <agent> <prompt>[/yellow]")
|
||||
console.print("\nAvailable agents: claude, codex, gemini, grok, qwen, vibe")
|
||||
return
|
||||
|
||||
if not prompt:
|
||||
console.print("[yellow]Please provide a prompt[/yellow]")
|
||||
return
|
||||
|
||||
try:
|
||||
from hanzo_tools.agent import AgentTool
|
||||
|
||||
tool = AgentTool()
|
||||
result = asyncio.run(
|
||||
tool.call(None, action="run", name=agent, prompt=prompt, timeout=timeout)
|
||||
)
|
||||
console.print(result)
|
||||
except ImportError:
|
||||
console.print("[red]hanzo-tools-agent not installed[/red]")
|
||||
console.print("Run: pip install hanzo-tools-agent")
|
||||
sys.exit(1)
|
||||
except Exception as e:
|
||||
console.print(f"[red]Error: {e}[/red]")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
@main.command("list")
|
||||
def list_agents():
|
||||
"""List available agents."""
|
||||
table = Table(title="Available Agents")
|
||||
table.add_column("Agent", style="cyan")
|
||||
table.add_column("Description", style="white")
|
||||
table.add_column("Status", style="green")
|
||||
|
||||
agents = [
|
||||
("claude", "Anthropic Claude Code CLI", "✓"),
|
||||
("codex", "OpenAI Codex CLI", "✓"),
|
||||
("gemini", "Google Gemini CLI", "✓"),
|
||||
("grok", "xAI Grok CLI", "✓"),
|
||||
("qwen", "Alibaba Qwen CLI", "✓"),
|
||||
("vibe", "Vibe coding agent", "✓"),
|
||||
]
|
||||
|
||||
for name, desc, status in agents:
|
||||
table.add_row(name, desc, status)
|
||||
|
||||
console.print(table)
|
||||
|
||||
|
||||
@main.command()
|
||||
@click.argument("agent", required=False)
|
||||
def status(agent):
|
||||
"""Check agent status and availability."""
|
||||
try:
|
||||
from hanzo_tools.agent import AgentTool
|
||||
|
||||
tool = AgentTool()
|
||||
if agent:
|
||||
result = asyncio.run(tool.call(None, action="status", name=agent))
|
||||
else:
|
||||
result = asyncio.run(tool.call(None, action="list"))
|
||||
console.print(result)
|
||||
except ImportError:
|
||||
console.print("[red]hanzo-tools-agent not installed[/red]")
|
||||
sys.exit(1)
|
||||
except Exception as e:
|
||||
console.print(f"[red]Error: {e}[/red]")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
@main.command()
|
||||
def config():
|
||||
"""Show agent configuration."""
|
||||
try:
|
||||
from hanzo_tools.agent import AgentTool
|
||||
|
||||
tool = AgentTool()
|
||||
result = asyncio.run(tool.call(None, action="config"))
|
||||
console.print(result)
|
||||
except ImportError:
|
||||
console.print("[red]hanzo-tools-agent not installed[/red]")
|
||||
sys.exit(1)
|
||||
except Exception as e:
|
||||
console.print(f"[red]Error: {e}[/red]")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,46 @@
|
||||
[project]
|
||||
name = "hanzo-agents"
|
||||
version = "0.1.2"
|
||||
description = "Multi-agent orchestration CLI for Hanzo AI"
|
||||
readme = "README.md"
|
||||
license = { text = "Apache-2.0" }
|
||||
requires-python = ">=3.10"
|
||||
authors = [{ name = "Hanzo AI", email = "[email protected]" }]
|
||||
keywords = ["hanzo", "ai", "agents", "orchestration", "cli"]
|
||||
classifiers = [
|
||||
"Development Status :: 4 - Beta",
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: Apache Software License",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
]
|
||||
dependencies = [
|
||||
"click>=8.0",
|
||||
"rich>=13.0",
|
||||
"hanzo-tools-agent>=0.2.0",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = ["pytest", "ruff"]
|
||||
|
||||
[project.scripts]
|
||||
hanzo-agents = "hanzo_agents.cli:main"
|
||||
agents = "hanzo_agents.cli:main"
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://hanzo.ai"
|
||||
Repository = "https://github.com/hanzoai/python-sdk"
|
||||
Documentation = "https://docs.hanzo.ai"
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["hanzo_agents"]
|
||||
|
||||
[tool.ruff]
|
||||
line-length = 100
|
||||
target-version = "py310"
|
||||
Reference in New Issue
Block a user