Graph optimization for multi-agent LLM workflows.
Project description
AgentProp
Graph optimization for multi-agent LLM workflows.
AgentProp models agents, tools, memories, documents, and verifiers as nodes in a directed weighted graph. It then uses propagation models, classical graph algorithms, optional GNN-style policies, and reinforcement learning to optimize:
- which agents receive full context first
- which edges are redundant or risky to prune
- where verifier agents should observe or intercept failures
- how much cost is saved versus broadcast routing
- how learned routing policies compare with graph-theoretic baselines
AgentProp is not an agent orchestrator. It is an analysis and optimization layer for workflows you already have, want to inspect, or want to study.
Status
AgentProp is usable as a public alpha framework. The graph backbone, CLI, reports, workflow templates, ML/RL baselines, MCP/coding-agent briefs, checkpoints, and experiment artifact registry are implemented and tested.
The main limitation is evidence depth: real routed LLM validation should be treated as directional until larger, repeated studies are published. The current library prioritizes reproducible artifacts and conservative claims.
Check the current rollout state:
agentprop readiness
Install
python -m venv .venv
source .venv/bin/activate
python -m pip install -e ".[dev]"
Optional extras:
python -m pip install -e ".[dl]" # torch-backed GNN experiments
python -m pip install -e ".[rl]" # optional Gymnasium ecosystem compatibility
CUDA/GPU is not required for the current dependency-light alpha workflows. Modal/GPU becomes useful for larger torch sweeps and hyperparameter searches.
First Recipes
Analyze a workflow:
agentprop analyze benchmarks/workflows/planner_coder_tester_reviewer.json
Recommend seed agents for context routing:
agentprop optimize planner_coder_tester_reviewer --budget 2 --algorithm greedy
Use quality-aware routing when correctness-sensitive roles should be protected:
agentprop optimize planner_coder_tester_reviewer \
--budget 2 \
--algorithm quality-aware-greedy
Simulate propagation:
agentprop simulate chain --seeds node_0 --model zero-forcing
Prune toward a token-reduction target:
agentprop prune planner_coder_tester_reviewer --target-token-reduction 0.3
Write an HTML report:
agentprop report planner_coder_tester_reviewer --out reports/demo.html --format html
Generate a Codex or Claude Code brief:
agentprop agent-instructions planner_coder_tester_reviewer \
--target codex \
--out reports/codex_agent_brief.md
Experiment Recipes
Run the benchmark table and SVG plot:
PYTHONPATH=src:. python experiments/run_benchmark.py \
--workflows planner_coder_tester_reviewer,chain,tree \
--budget 2 \
--trials 20 \
--out-dir results/benchmark
Run a small ML/RL sweep:
PYTHONPATH=src:. python experiments/run_ml_rl_sweep.py \
--config configs/sweeps/ml_rl_smoke.json \
--artifact-root results/ml_rl_smoke
Dry-run the full recipe suite:
PYTHONPATH=src:. python experiments/run_experiment_suite.py \
--config configs/experiment_suites/ml_core.json \
--artifact-root results/ml_core \
--dry-run
Preflight the real LLM case study without making LLM calls:
PYTHONPATH=src:. python experiments/run_case_study.py \
--execution-mode llm \
--preflight \
--out-dir docs/results/case_study_001
Artifacts
AgentProp writes plain, inspectable artifacts:
results.json/results.csvfor benchmark and case-study rowssummary.jsonfor aggregate metricstraces.jsonlandoutputs.jsonlfor routed LLM execution tracesverification_logs.jsonlwhen command verification is enabledregistry.jsonfor ML/RL checkpoints and metric artifacts*.svgplots for benchmark and case-study summaries- Markdown, JSON, or HTML optimization reports
This recipe-first layout is intentional: every claim should point to a command and a saved artifact.
What Is Implemented
- Directed weighted
AgentGraphwith JSON, validation, NetworkX conversion, and Graphviz DOT export. - Propagation models: Independent Cascade, Linear Threshold, Bootstrap Percolation, Randomized Zero Forcing, deterministic Zero Forcing, and learned trace-calibrated propagation.
- Classical baselines: random, degree, in-degree, out-degree, PageRank, betweenness, closeness, k-core, greedy, CELF, cost-aware greedy, and quality-aware greedy.
- Bottleneck, articulation, bridge, low-reliability, failure-sensitive, pruning, observability, and verifier-placement diagnostics.
- Role-critical routing with context-sensitivity scores, graded context allocation, calibrated compression ratios, risk annotations, and verifier-placement coupling.
- Workflow templates for agent-inspired workflows and synthetic graph families.
- Quality scorers for exact match, human labels, rubrics, and injected LLM-as-judge adapters.
- Dependency-light ML baselines, optional torch GNNs, Q-learning, REINFORCE, PPO, expanded workflow-control actions, a category-conditioned online bandit, checkpoints, and artifact registry.
- Framework interchange adapters and optional native hooks for LangGraph, CrewAI, and OpenAI Agents SDK.
- Claude Code/Codex instructions and a lightweight stdio MCP server.
Documentation
- Documentation index
- Tutorial
- Quality-aware routing
- Case-study protocol
- ML/DL/RL guide
- Coding-agent integration
- Framework integrations
- Contributing
Development
ruff check .
mypy src
pytest
CI runs the same gates on every push and pull request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentprop-0.1.0a1.tar.gz.
File metadata
- Download URL: agentprop-0.1.0a1.tar.gz
- Upload date:
- Size: 813.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e1966b8866ac1b6520c1cee51a1d76a3df6b582d0cf9282e3482e56704fdbab
|
|
| MD5 |
ff29f51a6c559601743997dc25417cc7
|
|
| BLAKE2b-256 |
20dca0414a7f2e4122a30bb7a8d17249dcfb80d9171da6d622baea06e422e6e0
|
File details
Details for the file agentprop-0.1.0a1-py3-none-any.whl.
File metadata
- Download URL: agentprop-0.1.0a1-py3-none-any.whl
- Upload date:
- Size: 105.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3634dabe074f24fc7d58e3255c6c9e542453e5045789aa6dee8bda420afe201b
|
|
| MD5 |
10fd64b1165e279695149ee75e9227a5
|
|
| BLAKE2b-256 |
d2c8dc711d089ebcc98d35f3dcdb6f1e89e929a402712532419649ba4e7b1324
|