Loop + graph engineering
August 10, 2026
The 2026 stack has two layers: how one agent runs (loop engineering), and how many agents are wired (graph engineering). AGI CLI was built as a distributed agent factory — both layers, on the coding agents and machines you already use. The CLI command is still agents.
Prefer the visual longform (diagrams, LangGraph-style examples)? Open the shareable HTML edition.
The split
Loop engineering designs the observe → reason → act → verify cycle for one agentic node: skills, tools, secrets, permissions, durable state, recovery. Graph engineering designs topology across many nodes: who exists, who waits on whom, where they run, how work joins. The literature is clear that they compose — a graph of unengineered loops is an org chart of unreliable employees; excellent loops with accidental topology fail as coordination debt.
Industry names for this ladder (prompt → context → harness → loop → graph) are still settling. The practice is not: encode structure you already know, put model reasoning where it adds value, keep state outside the conversation.
Loop engineering in AGI CLI
Osmani's loop primitives map almost one-to-one onto the CLI surface. You design the system that prompts the agent — not each turn by hand.
| Loop primitive | AGI CLI surface |
|---|---|
| Harness + version | agents add / use / view · profiles · model tiers |
| Skills & instructions | skills · rules · AGENTS.md |
| Connectors / tools | mcp · browser · computer · pty |
| Permissions | permissions · --mode plan|edit|auto|skip |
| Secrets | secrets · run --secrets |
| External state / resume | sessions · run --resume · export/import |
| Automations / heartbeat | routines · webhooks · monitors · watchdog |
agents run claude "Land RUSH-1234" --mode edit --secrets eng --model best
agents sessions --active
agents sessions <id> --markdown --last 5That is loop engineering operationalized across Claude, Codex, Grok, and the other harnesses under one binary — not re-derived per product.
Graph engineering in AGI CLI
Topology is not a research paper. It is named nodes, explicit edges, parallel ready sets, joins, and placement across machines.
| Graph primitive | AGI CLI surface |
|---|---|
| Named nodes | teams add … --name backend |
| Dependency edges | --after backend,frontend (DAG; cycles rejected) |
| Parallel wave | Independent nodes launch together on start --watch |
| Isolation | --enable-worktrees · boundary contracts |
| Placement | --device pin · --devices pool |
| Steer / re-enter | teams message · teams resume |
agents teams create ship --enable-worktrees --devices yosemite-s0,yosemite-s1
agents teams add ship claude "API" --name backend --worktree api --device yosemite-s0
agents teams add ship claude "UI" --name frontend --worktree ui --device yosemite-s1
agents teams add ship claude "E2E" --name qa --after backend,frontend --worktree qa
agents teams start ship --watchThere is no --before flag: declare the edge on the dependent node with --after. Wave 1 can run independent surfaces in parallel; QA is a multi-parent join.
They compose
Each teammate is a full coding-agent loop (Claude, Codex, …). The team is the graph. Devices and hosts are the fleet. That matches the literature's newer point: graph nodes are no longer single LLM calls — they can be whole agent runs. AGI CLI was already doing that with teams.
Inner loops are cyclic (tool call → observe → reason). The outer team schedule is usually a DAG. Both are true at once — LangChain's three-year graph note: loops are simple graphs; production systems still need cycles inside nodes.
Related on this site: harness engineering (the layer under the loop), teams recipe, sessions recipe.
Same patterns elsewhere
Not a bake-off — the same vocabulary shows up across the stack:
- LangGraph — nodes + edges + state; fan-out / join; coding agents as nodes inside a larger graph (the 2026 pattern).
- LangChain loop stack — agent → verification → event-driven → hill-climbing.
- Schedules & heartbeats — OpenClaw, Codex Automations, LangSmith crons; AGI CLI
routines. - Durable workflows — Temporal, Airflow agent tasks, Conductor YAML graphs for long-lived multi-step work.
AGI CLI's niche is the coding-agent factory on your fleet: same shapes, harness-native, multi-product sessions, SSH placement — complementary to application graph libraries and enterprise gateways.
One recipe that uses both
# LOOP: skills + secrets + mode on every node
# GRAPH: DAG + worktrees + devices
agents teams create landing --enable-worktrees \
--devices yosemite-s0,yosemite-s1 -d "Ship pricing page"
agents teams add landing claude "Implement pricing API" \
--name api --worktree api --mode edit --model best
agents teams add landing claude "Build pricing UI" \
--name ui --worktree ui --mode edit
agents teams add landing claude "Playwright + ship checklist" \
--name qa --after api,ui --worktree qa --mode edit
agents teams start landing --watch
agents sessions --teams
agents teams message landing qa "Skip flaky snapshot; land the rest"Further reading
- On this site: Teams as graph engineering · Sessions · index + cross-device · Distributed fleet execution
- Visual longform (HTML) — diagrams, dual-column LangGraph sketches.
- Teams visual longform · Sessions visual longform
- Addy Osmani, Loop Engineering.
- LangChain, The Art of Loop Engineering · 3 Years of Graph Engineering with LangGraph.
- TrueFoundry, Graph Engineering for Multi-Agent Systems.
- CLI reference: docs/teams.md · docs/sessions.md.