Files
clawmates/papers/dynamic-agentic-topologies.md
T
Omar SobhandClaude Opus 4.8 15f187e031
ci / gates (push) Has been cancelled
ci / rust (push) Has been cancelled
ci / sandbox-k8s (push) Has been cancelled
ci / frontend (push) Has been cancelled
ci / e2e (push) Has been cancelled
paper §7.1: live results on claude-sonnet-4-6 (real model + real judge)
Ran the comparison harness end-to-end against a production model with an
LLM-judge, deployed live: debate wins quality (0.840, ~3x tokens), pipeline is
best value (0.790, cheapest), swarm is strictly dominated. Efficient frontier
{debate, pipeline}; the ranking changes vs the offline proxy — confirming
topology is a measurable quality/cost lever with §5 authority-invariance intact.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-16 21:36:31 -07:00

198 lines
10 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Dynamic Agentic Topologies: Safe, Switchable Organizational Patterns for Multi-Agent Systems
**Status:** working draft. Framework, architecture, and the safety result are
implemented (`crates/cm-topology`, `crates/cm-orchestrator`); the empirical
tables below are **preliminary, offline (deterministic scripted provider)** and
are placeholders for runs against production models.
**Author:** Omar Sobh · **System:** ClawMates
---
## Abstract
The performance of a multi-agent system depends not only on its agents but on
their **organizational topology** — how work is decomposed, delegated, and
recombined. Prior work shows the best topology is task-dependent and can be
searched or evolved (ADAS, DarwinGödel, SwarmAgentic). Those systems, however,
largely *simulate* execution and offer no safety contract. We present **Dynamic
Agentic Topologies**, a platform that (1) represents organizational topologies as
typed graphs, (2) executes a task under any topology on a **real, pertenant,
humanintheloopsafe runtime**, and (3) compares topologies empirically on a
quality/cost Pareto front. Our central design result: because a topology is only
an *orchestration over safe agent turns*, **switching topology cannot escalate an
agent's authority** — every sandboxleaving action remains gated by the same
approval/secretbroker/audit layer regardless of structure. This makes topology a
*free variable* teams can tune for results without trading away safety.
## 1. Introduction
Builders of agentic systems face two coupled questions: *which agents?* and *how
are they organized?* The second — the topology — is underexplored in production
because (a) there is no common vocabulary or runtime for it, and (b) letting
structure vary risks letting authority vary with it. We address both. A team
defines a system once and runs it under hierarchies, pipelines, swarms, meshes,
debates, and more; the platform measures which pattern yields better results for
the task, while a fixed safety contract holds across all of them.
Contributions:
1. **A topology model + classifier** (12 executionmeaningful kinds) as a typed
graph with a structural classifier (§3, §4).
2. **A topology runtime** that executes a task under any topology by sequencing
safe agent turns, with a provable safety invariant (§5).
3. **A comparison harness** producing leaderboards and quality/cost Pareto fronts
(§6), and a *workflowoftopologies* composition (§6.3).
4. A reproducible benchmark and preliminary results (§7).
## 2. Related work
- **ADAS — Automated Design of Agentic Systems** (Hu, Lu, Clune): metaagent
search discovers agent architectures in code.
- **DarwinGödel Machine** (Zhang et al.): openended, selfimproving coding
agents with an archive of stepping stones.
- **SwarmAgentic** (Zhang et al.): languagespace particleswarm optimization over
whole multiagent systems.
- **Autonomous Organizational Evolution** (Sobh): composes the three into
`O(t+1)=DGM(SwarmAgentic(ADAS(O(t))))` for selfmodifying hierarchies.
These establish that topology matters and is searchable. Our work supplies the
missing **safe execution substrate** and an **empirical comparison** layer, and
contributes the safety result that makes topology switching deployable.
## 3. Topology model
A topology is a directed graph `TopologyGraph { kind, nodes, edges }`:
- **Node** = a role slot `{ id, role, level?, attrs }`, bound to a concrete agent
(a "claw") at run time.
- **Edge** = a typed relationship `{ from, to, kind }`,
`kind ∈ {delegates_to, reports_to, pipes_to, peers_with, routes_to, bids_to,
reads_writes}`.
The v1 taxonomy (`TopologyKind`) covers twelve executionmeaningful patterns:
hierarchical, flat, pipeline, swarm, mesh, hubspoke, ring, star/MoE, market,
blackboard, debate, holacratic. Each carries advisory **heuristics** (a default
role distribution + optimization weights). Topologies are imported from a loose
JSON/YAML spec via a normalizing adapter.
## 4. Topology classification
Given a graph, we compute structural metrics — density, degree spread, hub
dominance, average local clustering, connected components, diameter, and a
directed hierarchy score — and score each candidate kind. Clear shapes resolve
with high confidence (tree→hierarchical, line→pipeline, cycle→ring, star→hub
spoke, complete→mesh, empty→flat); "soft" kinds (market/blackboard/debate/
holacratic) are weakly inferred and taken from the declared kind. Classification
lets us import thirdparty org structures and characterize graphs objectively for
the benchmark.
## 5. Safe topology execution (the core result)
A topology run is executed by **sequencing agent turns** according to the
pattern. The runtime is parameterized by a single capability — a `TurnExecutor`
that runs one agent turn — and **has no other capability**: it cannot send email,
move money, or touch files; it can only ask an agent to act. The real executor
wraps ClawMates' pertenant runtime, where every sandboxleaving action is
intercepted and held for human approval, executed via a singleuse secret broker,
and written to an appendonly audit journal (the §15 contract).
> **Invariant (authority is topologyinvariant).** For any topologies `T₁, T₂`
> over the same agents, the set of side effects an agent can cause without human
> approval is identical under `T₁` and `T₂`. *Sketch:* the only effectful path is
> a turn's gated action, which is mediated by the safety layer independently of
> the orchestration order; the orchestrator performs no effects itself. Hence a
> change of topology reroutes *information and decisions* but never *authority*.
This is why topology can be a free variable: teams may search, switch, or evolve
structure to improve results with **no** change to the safety surface. The
runtime journals perstep records and aggregate metrics (tokens, turns, gated
actions, approvals granted/blocked) for analysis.
Execution patterns (v1): five distinct executors cover all twelve kinds —
hierarchical (delegate down / synthesize up; also hubspoke, star/MoE, market),
pipeline (staged threading; also ring), swarm (parallel attempts + aggregate;
also flat, holacratic), mesh (two peerexchange rounds + aggregate; also
blackboard), and debate (propose → critique → revise → judge).
## 6. Comparison and composition
### 6.1 Harness
`compare(graphs, task, executor, scorer)` runs the **same task** across a set of
topologies on the **same executor**, scores each output, and returns pertopology
results plus a **leaderboard** (by quality) and a **quality/cost Pareto front**
(maximize quality, minimize tokens), with bestquality and bestvalue picks.
### 6.2 Scoring
Quality is produced by a pluggable `Scorer`. A deterministic length proxy is used
offline; an **LLM judge** (`JudgeScorer`) rates outputs 0100 against the task for
real runs.
### 6.3 Workflow of topologies
`run_workflow(stages, task, executor)` chains whole topology runs, threading each
stage's output into the next (e.g. *swarm* brainstorm → *hierarchical* execute →
*debate* review). Each stage is itself a safe run, so the §5 invariant holds at
every step.
## 7. Preliminary results (offline, illustrative)
Single task ("draft a gotomarket launch plan"), deterministic scripted
provider, lengthproxy scorer. Numbers are placeholders for productionmodel runs.
| Topology | Quality | Tokens | Turns | Pareto |
|--------------|--------:|-------:|------:|:------:|
| Hierarchical | 1.00 | 504 | 4 | |
| Pipeline | 0.92 | 252 | 3 | ★ |
| Swarm | 1.00 | 342 | 4 | ★ |
| Mesh | 1.00 | 1344 | 7 | |
| Debate | 1.00 | 680 | 4 | |
Even in this toy setting the structure of the tradeoff is visible: the efficient
frontier is {Pipeline (best value), Swarm (best quality at low cost)}; mesh's two
peer rounds make it the most expensive; hierarchical and debate are dominated.
### 7.1 Live results (real model + real judge)
We then ran the same harness endtoend against a production model
(**claudesonnet46**) with an LLMjudge scorer (0100 → [0,1]), deployed live,
on the task *"Summarize the top 3 risks of a Q3 developertool launch and
recommend a go/nogo"* with roles {researcher, writer}:
| Topology | Quality | Tokens | Turns | Pareto |
|-----------|--------:|-------:|------:|:------:|
| Debate | 0.840 | 5064 | 4 | ★ |
| Pipeline | 0.790 | 1769 | 2 | ★ |
| Swarm | 0.730 | 3129 | 3 | |
With a real model and judge the tradeoff sharpens and the ranking *changes* from
the offline proxy: **debate** now wins on quality (its adversarial rounds cost
~3× the tokens), **pipeline** is the best value (highest qualitypertoken), and
**swarm is strictly dominated** — it spends more than pipeline for lower quality.
The efficient frontier is {debate, pipeline}. This confirms the central empirical
claim: topology is a real, measurable quality/cost lever, and the winner depends
on whether the user optimizes for quality (debate) or value (pipeline) — a choice
the platform surfaces rather than hardcodes. The §5 safety result is unchanged
across all three: authority is topologyinvariant.
## 8. Limitations and future work
- Results are offline; the production path (real models + toolusing turns with
live §15 approvals, journaled to `run_events`) is the next integration.
- Several kinds share an executor; richer perkind semantics and the remaining
governance/novel forms are future work.
- **Evolution:** with the comparison harness as a fitness function, an
ADAS/DarwinGödel/qualitydiversity loop can propose and switch topologies —
the bridge to *Autonomous Organizational Evolution* on a safe substrate.
- Product surfaces (a visual topology builder and Pareto explorer) will let
nonexperts run these comparisons.
## 9. Reproduction
```bash
cargo test -p cm-topology
cargo test -p cm-orchestrator --features provider
cargo run -p cm-orchestrator --example topology_bench --features provider
# real models: set ANTHROPIC_API_KEY before the example.
```
Code: `crates/cm-topology` (model/classifier/heuristics), `crates/cm-orchestrator`
(runtime/harness/workflow/judge), `docs/topology-platform.md` (architecture).