convez.ai
Agente
TigreGotico

agentpipe

TigreGotico/agentpipe

Ver no GitHub
InicialPluginScore · de 0 a 100

Async Python wrapper for 7 coding agent CLIs — delegate, cascade, and orchestrate Aider, Claude Code, Gemini, Kilo Code, OpenCode, QoderCLI, Vibe

Instalação

$npx convez-ai TigreGotico/agentpipe

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
1
Forks
0
Acompanhando
1
Saúde
37%
Último commit
há 1 mês
Versão
0.2.0
Issues abertas
7
Contribuidores
3

README

A tradução para o português deste README ainda está na fila.

agentpipe

PyPI version Python versions License CI DeepWiki Docker

Let your expensive coding agent delegate the boring work to cheap ones.

We vibe-coded this so your agents can delegate to other agents who delegate to other agents — recursive delegation all the way down, just like we did. 🌀

agentpipe gives you a single async Python API over 7 coding agent CLIs (Aider, Claude Code, Gemini CLI, Kilo Code, OpenCode, QoderCLI, Vibe). Use it to build multi-agent pipelines where a smart planner delegates tasks to cheaper workers.

from agentpipe import Agent, delegate, fan_out

# Plan with Claude, delegate execution to free models
async def build_feature():
    draft = await Agent("opencode-free").generate("Write a CLI arg parser")
    review = await Agent("claude-sonnet").generate(f"Review this:\n{draft}")
    return review

# Or use the built-in delegation pipeline
result = await delegate(
    Agent("opencode-free"),  # drafter — cheap
    Agent("claude-sonnet"),  # reviewer — smart
    "Write a palindrome checker",
    "Review for edge cases",
)

Zero Python dependencies. Works with Python 3.10+.

Why?

Coding agents are powerful but expensive. Claude Opus costs ~$15/M tokens. Opencode-free models cost $0. The smartest approach: let a strong agent plan and review, but delegate grunt work (linting, boilerplate, test writing) to free-tier agents.

agentpipe wraps every major coding agent CLI behind the same async interface so you can mix and match them in a single script.

Quick Start

pip install agentpipe

Pick any provider you have installed:

import asyncio
from agentpipe import Agent

async def main():
    # One-shot with a free model
    result = await Agent("kilo").generate("Explain async/await")
    print(result)

    # Multi-turn session with cost tracking
    async with Agent("gemini-flash").session(cwd=".") as sess:
        r1 = await sess.generate("List the modules")
        r2 = await sess.generate("Which is riskiest?")
        print(f"Cost: ${sess.usage.total_cost_usd:.4f}")

    # Stream events as they happen
    async for event in Agent("aider").generate_stream("Explain this code"):
        match event:
            case ThinkingEvent(text=t): print(t, end="")
            case UsageEvent(input_tokens=n): print(f"\n[Tokens: {n}]")

asyncio.run(main())

Delegate: Draft + Review

The killer feature. Use a cheap/free agent to write, then a strong agent to review.

from agentpipe import delegate

final = await delegate(
    Agent("kilo"),          # drafter — free
    Agent("claude-sonnet"), # reviewer — smart
    "Write a unit test for this class",
    "Check correctness, coverage, and style",
)

Fan-Out: Parallel subtasks

from agentpipe import fan_out, Agent

results = await fan_out(
    Agent("aider", timeout=60),
    ["Write tests for module A", "Write tests for module B"],
    max_concurrency=3,
)

Cascade: Automatic fallback

Try free models first, escalate to paid on failure, with cost caps.

from agentpipe import cascade

# Start free, escalate on failure
result = await cascade("Write tests", profile="default")

# Cap cost at $0.10
result = await cascade("Refactor", max_cost_usd=0.10)

# Only free models
result = await cascade("Quick question", profile="free-only")

All Providers

ProviderKeyDefault ModelCost
Aideraideropenrouter/...gemma-4:freeFree (OpenRouter)
Claude Codeclaudesonnet$10-200/mo sub
Gemini CLIgeminigemini-2.5-flashFree tier
Kilo Codekilokilo/kilo-auto/freeFree tier
OpenCode Freeopencode-freeopencode/big-pickle$0
OpenCode Zenopencode-zenopencode/gemini-3-flashPay-as-you-go
OpenCode Goopencode-goopencode-go/deepseek-v4-flash$5-10/mo
QoderCLIqoder(CLI default)Per-use
Mistral Vibevibemistral-large-latestFree tier

Install Provider CLIs

# Aider (free — OpenRouter)
pip install aider-chat

# Claude Code (paid subscription)
npm install -g @anthropics/claude-code

# Gemini CLI (free — Google account)
npm install -g @google-gemini/gemini-cli

# Kilo Code (free — no CC needed)
npm install -g @kilocode/cli

# OpenCode (free tier available)
npm install -g opencode

# Mistral Vibe (free tier)
pip install mistral-vibe

HTTP Server (FastAPI)

Run multiple agents behind HTTP with persistent sessions — perfect for CI/CD, other agents to call, or multi-process deployments.

Includes an OpenAI-compatible /v1/chat/completions endpoint so any OpenAI client (Cursor, Continue.dev, etc.) can be pointed at this server.

pip install agentpipe fastapi uvicorn sse-starlette
python -m agentpipe.server
# OpenAI-compatible — works with any OpenAI SDK
curl http://localhost:8000/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{"model":"kilo/kilo-auto/free","messages":[{"role":"user","content":"Write tests"}]}'

# The model prefix selects the provider:
#   kilo/... → Kilo Code (free)    claude/... → Claude Code
#   gemini/... → Gemini CLI        opencode/... → OpenCode
#   aider/... → Aider              vibe/... → Mistral Vibe

# Native API — create named agents with persistent sessions
curl -X POST http://localhost:8000/agents \
  -H 'Content-Type: application/json' \
  -d '{"name":"writer","provider":"kilo"}'

# Send work — sessions persist automatically
curl -X POST http://localhost:8000/agents/writer/generate \
  -H 'Content-Type: application/json' \
  -d '{"prompt":"Write unit tests for src/parser.py"}'

# Stream events via SSE
curl -X POST http://localhost:8000/agents/writer/generate-stream \
  -H 'Content-Type: application/json' \
  -d '{"prompt":"Explain this code"}'

# Check session status
curl http://localhost:8000/agents/writer/session

Docker

The container bundles 6 provider CLIs (kilo, opencode, gemini, aider, vibe, qodercli) — free-tier models work out of the box. Claude Code requires manual install (see docs). Image published to ghcr.io/tigregotico/agentpipe:latest.

# Create a .env file with API keys
echo "OPENROUTER_API_KEY=sk-or-v1-..." > .env

# Start
docker compose up

API keys, auth persistence, and working directory are handled via volume mounts and env vars configured in docker-compose.yml. To set up interactive CLI auth:

docker compose run --rm agentpipe kilo auth login

See the Docker docs and server module for details.

Docs

25 Example Scripts

python -m examples.20_fastapi_integration  # HTTP server
python -m examples.11_delegate             # Draft + review pipeline
python -m examples.10_fan_out              # Parallel subtasks
python -m examples.07_cascade              # Free → paid fallback
python -m examples.01_one_shot             # Simplest usage

License

MIT

Ver o original no GitHub

Bom para

Relacionados