[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-74269":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":23,"hasPages":23,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":16,"starSnapshotCount":16,"syncStatus":29,"lastSyncTime":30,"discoverSource":31},74269,"agentflow","berabuddies\u002Fagentflow","berabuddies","Orchestrate thousands of agents and harnesses as a graph programatically","",null,"Python",1280,274,16,4,0,13,17,69,39,20.32,"MIT License",false,"master",[],"2026-06-12 02:03:24","# AgentFlow\n\nOrchestrate codex, claude, and kimi agents in dependency graphs with parallel fanout, iterative cycles, and remote execution on SSH\u002FEC2\u002FECS.\n\n![AgentFlow Graph](docs\u002Fgraph.png)\n*94-node pipeline: plan → 64 workers → 8 batch merges → 16 reviews → 4 review merges → synthesis*\n\n## Install \u002F Upgrade\n\nOne line:\n\n```bash\ncurl -fsSL https:\u002F\u002Fraw.githubusercontent.com\u002Fshouc\u002Fagentflow\u002Fmaster\u002Finstall.sh | bash\n```\n\nThis installs agentflow, adds it to PATH, and installs the skill for Codex and Claude Code.\n\nOr manually:\n\n```bash\npython3 -m venv .venv && . .venv\u002Fbin\u002Factivate\npip install -e .[dev]\n```\n\n## Quick Start\n\n```python\nfrom agentflow import Graph, codex, claude\n\nwith Graph(\"my-pipeline\", concurrency=3) as g:\n    plan = codex(task_id=\"plan\", prompt=\"Inspect the repo and plan the work.\", tools=\"read_only\")\n    impl = claude(task_id=\"impl\", prompt=\"Implement the plan:\\n{{ nodes.plan.output }}\", tools=\"read_write\")\n    review = codex(task_id=\"review\", prompt=\"Review:\\n{{ nodes.impl.output }}\")\n    plan >> impl >> review\n\nprint(g.to_json())\n```\n\n```bash\nagentflow run pipeline.py --output summary\n```\n\nOr just ask Codex (the agentflow skill is auto-installed):\n\n```bash\ncodex \"Use agentflow to fan out 10 codex agents, each telling a unique joke, then merge their outputs and pick the funniest one. Write the pipeline and run it.\"\n```\n\n## Parallel Fanout\n\nFan a node into many parallel copies with `fanout()`:\n\n```python\nfrom agentflow import Graph, codex, fanout, merge\n\nwith Graph(\"code-review\", concurrency=8) as g:\n    scan = codex(task_id=\"scan\", prompt=\"List the top 5 files to review.\")\n    review = fanout(\n        codex(task_id=\"review\", prompt=\"Review {{ item.file }}:\\n{{ nodes.scan.output }}\"),\n        [{\"file\": \"api.py\"}, {\"file\": \"auth.py\"}, {\"file\": \"db.py\"}],\n    )\n    summary = codex(task_id=\"summary\", prompt=(\n        \"Merge findings:\\n{% for r in fanouts.review.nodes %}{{ r.output }}\\n{% endfor %}\"\n    ))\n    scan >> review >> summary\n\nprint(g.to_json())\n```\n\n`fanout(node, source)` dispatches on type:\n- `int` -- N identical copies: `fanout(node, 128)`\n- `list` -- one per item: `fanout(node, [{\"repo\": \"api\"}, ...])`\n- `dict` -- cartesian product: `fanout(node, {\"axis1\": [...], \"axis2\": [...]})`\n\nReduce with `merge(node, source, size=N)` (batch) or `merge(node, source, by=[\"field\"])` (group).\n\n## Iterative Cycles\n\nLoop until a stop condition with `on_failure`:\n\n```python\nfrom agentflow import Graph, codex, claude\n\nwith Graph(\"iterative-impl\", max_iterations=5) as g:\n    write = codex(\n        task_id=\"write\",\n        prompt=\"Write a Python email validator.\\n{% if nodes.review.output %}Fix: {{ nodes.review.output }}{% endif %}\",\n        tools=\"read_write\",\n    )\n    review = claude(\n        task_id=\"review\",\n        prompt=\"Review:\\n{{ nodes.write.output }}\\nIf complete, say LGTM. Otherwise list issues.\",\n        success_criteria=[{\"kind\": \"output_contains\", \"value\": \"LGTM\"}],\n    )\n    write >> review\n    review.on_failure >> write  # loop until LGTM or max_iterations\n\nprint(g.to_json())\n```\n\n## Local & External Models via Pi\n\nUse the `pi` coding agent as a target alongside `codex` and `claude`. Pi routes\nto Anthropic, OpenAI, Groq, Cerebras, xAI, DeepSeek, Gemini, OpenRouter, Bedrock,\netc., and to local endpoints (LMStudio, Ollama) via its OpenAI-compatible or\nAnthropic-compatible wire protocols.\n\n```python\nfrom agentflow import Graph, codex, pi\n\nwith Graph(\"mixed\") as g:\n    # External: Claude via Pi\n    review = pi(\n        task_id=\"review\",\n        prompt=\"Review {{ nodes.impl.output }}\",\n        model=\"anthropic\u002Fclaude-sonnet-4-6:high\",\n    )\n\n    # Local: LMStudio (add the provider once in ~\u002F.pi\u002Fagent\u002Fmodels.json)\n    scan = pi(\n        task_id=\"scan\",\n        prompt=\"Scan the repo for TODOs.\",\n        model=\"lmstudio\u002Fqwen\u002Fqwen3.6-27b\",\n        tools=\"read_only\",\n    )\n```\n\nFor one-off inline provider configs (e.g. a remote LMStudio box), pass a full\n`ProviderConfig` via `provider={...}` and AgentFlow materializes a scoped\n`models.json` for the run. See `examples\u002Fpi_local_lmstudio.py`.\n\n## Remote Execution\n\nRun agents on remote machines -- zero config needed:\n\n```python\n# EC2 (auto-discovers AMI, key pair, VPC)\ncodex(task_id=\"remote\", prompt=\"...\", target={\"kind\": \"ec2\", \"region\": \"us-east-1\"})\n\n# ECS Fargate (auto-discovers VPC, builds agent image)\ncodex(task_id=\"remote\", prompt=\"...\", target={\"kind\": \"ecs\", \"region\": \"us-east-1\"})\n\n# SSH\ncodex(task_id=\"remote\", prompt=\"...\", target={\"kind\": \"ssh\", \"host\": \"server\", \"username\": \"deploy\"})\n```\n\nShared instances across nodes:\n\n```python\nplan = codex(task_id=\"plan\", prompt=\"...\", target={\"kind\": \"ec2\", \"shared\": \"dev-box\"})\nimpl = codex(task_id=\"impl\", prompt=\"...\", target={\"kind\": \"ec2\", \"shared\": \"dev-box\"})\nplan >> impl  # same EC2 instance, files persist\n```\n\n## Scratchboard\n\nShared memory file across all agents:\n\n```python\nwith Graph(\"campaign\", scratchboard=True) as g:\n    shards = fanout(codex(task_id=\"fuzz\", prompt=\"...\"), 128)\n```\n\n## Tuned Agent Evolution\n\nUse a completed Codex run as training data to create a reusable tuned agent:\n\n```python\nfrom agentflow import Graph, codex, evolve\n\nwith Graph(\"improve-codex\", working_dir=\".\") as g:\n    source = codex(task_id=\"plan\", prompt=\"Inspect this repo and summarize the main risks.\")\n    tuned = evolve(source, target=\"codex\", optimizer=\"codex\")\n\nprint(g.to_json())\n```\n\nRun order:\n\n```bash\nagentflow run pipeline.py\nagentflow evolve \u003Crun_id> -n \u003Cnode_id> --target codex --profile codex --optimizer codex\nagentflow tuned-agents\nagentflow tuned-agent codex_tuned --output json\n```\n\nSuccessful evolutions are stored under `.agentflow\u002Ftuned_agents\u002F\u003Cname>\u002Fversions\u002F\u003Cversion>\u002F` with copied traces, the cloned repo, and version metadata. Tuned agents currently resolve only on local targets.\n\n## Examples\n\n| Example | What it does |\n|---|---|\n| `airflow_like.py` | Basic pipeline: plan → implement → review → merge |\n| `code_review.py` | Fan out code review across files, merge findings |\n| `dep_audit.py` | Audit each dependency for security\u002Flicense issues |\n| `test_gap.py` | Find untested modules, suggest tests per module |\n| `multi_agent_debate.py` | Codex vs Claude: independent solve + cross-critique |\n| `release_check.py` | Parallel release gate: tests + security + changelog |\n| `iterative_impl.py` | Write → review → fix cycle until LGTM |\n| `airflow_like_fuzz_batched.py` | 128-shard fanout with batch merge + periodic monitor |\n| `airflow_like_fuzz_grouped.py` | Matrix fanout with grouped reducers |\n| `ec2_remote.py` | Run codex on a remote EC2 instance |\n| `ecs_fargate.py` | Run codex on ECS Fargate |\n\n## Graph Optimization Rounds\n\nRun multiple optimization rounds over your graph with top-level `optimizer` and `n_run`. Use this when you want AgentFlow to let the optimizer rewrite the graph between rounds; the validation step only checks that the edited pipeline loads and passes schema validation, not that the edits are semantically better.\n\nArtifacts and logs for each round live under `.agentflow\u002Fruns\u002F\u003Crun_id>\u002Foptimization\u002Fround-XXX\u002F`.\n\n```python\nfrom agentflow import Graph, codex\n\nwith Graph(\n    \"optimization-demo\",\n    optimizer=\"codex\",\n    n_run=2,\n    concurrency=2,\n) as g:\n    plan = codex(task_id=\"plan\", prompt=\"Outline the tasks required to finish the ticket.\")\n    review = codex(task_id=\"review\", prompt=\"Review the plan for missing steps or risks.\")\n    summary = codex(task_id=\"summary\", prompt=\"Summarize the approved plan and next actions.\")\n    plan >> review >> summary\n\nprint(g.to_json())\n```\n\n## CLI\n\n```bash\nagentflow run pipeline.py           # run a pipeline\nagentflow run pipeline.py --output summary\nagentflow evolve \u003Crun_id> -n plan   # evolve a tuned agent from prior Codex traces\nagentflow tuned-agents              # list locally registered tuned agents\nagentflow tuned-agent codex_tuned   # inspect one tuned agent\nagentflow inspect pipeline.py       # show expanded graph\nagentflow validate pipeline.py      # check without running\nagentflow templates                  # list starter templates\nagentflow init > pipeline.py        # scaffold a starter\nagentflow serve                     # start the local web UI and API on 127.0.0.1:8000\n```\n\n## Web UI and API safety\n\n`agentflow serve` binds to `127.0.0.1` by default.\n\nThe web API only accepts `application\u002Fjson` requests for `\u002Fapi\u002Fruns` and `\u002Fapi\u002Fruns\u002Fvalidate`, and `pipeline_path` is disabled on those endpoints by default. This prevents the browser-facing control plane from executing arbitrary local `.py` pipeline files just by referencing a path.\n\nIf you intentionally want the web API to load pipelines from filesystem paths in a trusted local environment, opt in explicitly:\n\n```bash\nAGENTFLOW_API_ALLOW_PIPELINE_PATH=1 agentflow serve\n```\n\nThat opt-in is meant for trusted operator-controlled workflows only.\n\n## Acknowledgements\n\n* [gepa](https:\u002F\u002Fgithub.com\u002Fgepa-ai\u002Fgepa)\n* [kiss-ai](https:\u002F\u002Fgithub.com\u002Fksenxx\u002Fkiss_ai)\n* [claude-code-telegram](https:\u002F\u002Fgithub.com\u002FRichardAtCT\u002Fclaude-code-telegram)\n* [linux.do](https:\u002F\u002Flinux.do)\n","AgentFlow 是一个用于编程方式编排数千个代理并以图形式管理的工具。它支持通过依赖图来组织 Codex、Claude 和 Kimi 代理，实现并行扇出、迭代循环以及在 SSH\u002FEC2\u002FECS 上的远程执行。核心功能包括灵活定义任务间的依赖关系与数据流，并能自动处理大规模并行任务和复杂的工作流程。该工具适用于需要高效协调多个AI代理执行复杂任务的场景，例如代码审查、分布式计算任务等。基于 Python 开发，易于安装和集成到现有开发环境中。",2,"2026-06-11 03:49:44","high_star"]