mirror of
https://github.com/hanzoai/python-sdk.git
synced 2026-10-23 20:23:00 +00:00
feat(agent): multi-agent orchestration with DAG, swarm, Lux Quasar consensus
- Actions: run, dag, swarm, consensus, dispatch, list, status, config
- DAG execution with topological sort and {dep_id} output injection
- Swarm for work distribution with asyncio.Semaphore max_concurrent
- Lux Quasar consensus: Nova DAG + Quasar finality phases
- Photon luminance-weighted peer sampling (faster agents = higher weight)
Native agents: claude, codex, gemini, grok, qwen, vibe, dev
Anthropic-compatible agents (via claude CLI):
- minimax (MiniMax-M2.1)
- kimi (Kimi K2 / Moonshot)
- deepseek (DeepSeek)
- yi (Yi / 01.AI)
- glm (Zhipu GLM-4)
- baichuan (Baichuan4)
- step (StepFun)
- dashscope (Qwen Max via DashScope)
- qwen-cc (Qwen Plus via DashScope)
Consensus: https://github.com/luxfi/consensus
This commit is contained in:
@@ -156,6 +156,20 @@ ANTHROPIC_COMPAT_AGENTS = {
|
||||
auth_env="STEPFUN_API_KEY",
|
||||
model="step-2",
|
||||
),
|
||||
# Qwen via DashScope Claude Code proxy - https://dashscope-intl.aliyuncs.com
|
||||
"dashscope": AgentConfig(
|
||||
"claude", ["-p"], None, 17,
|
||||
base_url="https://dashscope-intl.aliyuncs.com/api/v2/apps/claude-code-proxy",
|
||||
auth_env="DASHSCOPE_API_KEY",
|
||||
model="qwen-max",
|
||||
),
|
||||
# Qwen via DashScope (alias)
|
||||
"qwen-cc": AgentConfig(
|
||||
"claude", ["-p"], None, 18,
|
||||
base_url="https://dashscope-intl.aliyuncs.com/api/v2/apps/claude-code-proxy",
|
||||
auth_env="DASHSCOPE_API_KEY",
|
||||
model="qwen-plus",
|
||||
),
|
||||
}
|
||||
|
||||
# Combined agents dict
|
||||
@@ -212,24 +226,28 @@ class AgentTool(BaseTool):
|
||||
@override
|
||||
def description(self) -> str:
|
||||
default = self._default_agent()
|
||||
native = ', '.join(NATIVE_AGENTS.keys())
|
||||
compat = ', '.join(ANTHROPIC_COMPAT_AGENTS.keys())
|
||||
return f"""Multi-agent orchestration. Default: {default}
|
||||
|
||||
Actions:
|
||||
- run: Execute single agent (default: {default})
|
||||
- dag: DAG execution with dependencies
|
||||
- swarm: Work distribution across N agents
|
||||
- consensus: Metastable multi-model agreement
|
||||
- consensus: Lux Quasar multi-model agreement
|
||||
- dispatch: Different agents for different tasks
|
||||
- list/status/config: Management
|
||||
|
||||
Agents: {', '.join(AGENTS.keys())}
|
||||
Native: {native}
|
||||
Anthropic-compatible: {compat}
|
||||
|
||||
Examples:
|
||||
agent run --prompt "Explain this code"
|
||||
agent run --name minimax --prompt "Analyze with MiniMax"
|
||||
agent dag --tasks '[{{"id":"a","prompt":"analyze"}},{{"id":"b","prompt":"fix {{a}}","after":["a"]}}]'
|
||||
agent swarm --items '["f1.py","f2.py"]' --template "Review {{item}}" --max_concurrent 10
|
||||
agent consensus --prompt "Best approach?" --agents '["claude","gemini","codex"]' --rounds 3
|
||||
agent dispatch --tasks '[{{"agent":"claude","prompt":"review"}},{{"agent":"gemini","prompt":"test"}}]'
|
||||
agent consensus --prompt "Best approach?" --agents '["claude","minimax","deepseek"]' --rounds 3
|
||||
agent dispatch --tasks '[{{"agent":"claude","prompt":"review"}},{{"agent":"kimi","prompt":"test"}}]'
|
||||
|
||||
Consensus: https://github.com/luxfi/consensus
|
||||
"""
|
||||
@@ -398,6 +416,10 @@ Consensus: https://github.com/luxfi/consensus
|
||||
# Build command
|
||||
full_cmd = [cfg.cmd] + cfg.args
|
||||
|
||||
# For Anthropic-compatible APIs, add required flags
|
||||
if cfg.base_url:
|
||||
full_cmd.append("--dangerously-skip-permissions")
|
||||
|
||||
# Add model override for Anthropic-compatible APIs
|
||||
if cfg.model:
|
||||
full_cmd.extend(["--model", cfg.model])
|
||||
|
||||
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "hanzo-tools-agent"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
description = "Agent tools for Hanzo AI - multi-agent orchestration, CLI agents, swarms"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.12"
|
||||
|
||||
Reference in New Issue
Block a user