AgensFlow MCP — learned coordination substrate for coding-agent loops
Project description
agensflow-mcp
Learned coordination substrate for coding-agent and MAS loops. Apache-2.0. Self-host, or use the hosted service.
What this is
AgensFlow MCP is a policy server. For each task signature your agent sees, it learns which sub-agent, model, and effort setting produces the best outcome — where "best" is a weighted trade-off of quality, cost, latency, and token budget you configure.
Under the hood: a per-signature UCB1 bandit with Welford-online variance, Anthropic cache-aware pricing, tenant isolation, and BYOK judge orchestration.
Two integration paths cover essentially every agent shape:
- Framework adapters — LangGraph, CrewAI, or any Runnable-shaped MAS
framework plug in via
agensflow-langgraph: one decorator per node, per-node model pool, one line to record reward. The adapter owns judge orchestration; the server records decisions and updates the policy. - Direct MCP integration — Claude Code / codex hook the server via
PreToolUse + SubagentStop hooks. The server orchestrates a BYOK
single-model or 3-panel cross-family judge over
POST /judge/relative.
Install
pip install agensflow-mcp
Requires Python ≥ 3.11. Postgres is recommended for production; SQLite works out-of-the-box for local dev.
Run the server
# Local dev (in-process SQLite, no external deps)
agensflow-mcp serve
# → http://localhost:8000/health
# → http://localhost:8000/docs (OpenAPI schema explorer)
# → http://localhost:8000/mcp/sse (FastMCP endpoint)
# Full stack with Postgres via Docker
docker run -d --name agensflow-postgres \
-e POSTGRES_PASSWORD=agf -p 5432:5432 postgres:16
AGF_DATABASE_URL=postgresql+psycopg://postgres:agf@localhost:5432/agensflow \
agensflow-mcp serve
Once up, verify:
curl -s http://localhost:8000/health
# → {"status":"ok","version":"..."}
Architecture
Framework Claude Code
adapter / codex hooks
(LangGraph, CrewAI, ...) │
│ │
└─────────┬────────────────┘
▼
┌──────────────────────────────────────────┐
│ HTTP + MCP surface │
│ │
│ /route /judge/relative │
│ /record /policy/{me,id} │
│ /auth/anonymous /auth/byok │
│ /langgraph/policy/{select,import, │
│ export} │
│ /langgraph/decision/execute │
│ /langgraph/reward/submit │
│ /langgraph/decisions │
│ │
│ /mcp/sse (FastMCP tools) │
└────────────────────┬─────────────────────┘
▼
┌───────────────────┐
│ Substrate engine │
│ folding · UCB1 │
│ Welford │
│ reward · pricing│
└─────────┬─────────┘
▼
Postgres / SQLite
Tier model
| Tier | Package | What you get |
|---|---|---|
| Free | agensflow-mcp (public, PyPI) |
UCB1 substrate, reward formula w_q·quality − w_c·cost − w_t·tokens − w_l·latency, tenant isolation, all HTTP endpoints (/route, /record, /judge/relative, /langgraph/*, /auth/*, /policy/*), 3-judge cross-family panel over OpenRouter (BYOK), extension plugin discovery for overlays |
| Enterprise | Private overlay (not on PyPI) | Everything above + private-tier observability signals and reward extensions. Auto-loaded via importlib entry-point when installed |
The free tier is fully functional standalone. Enterprise is an overlay you install alongside; the server auto-discovers it at boot and mounts the additional routes + companion tables. Nothing on the free tier depends on the enterprise package being present.
Learn more
- Integration guide (LangGraph adapter) —
agensflow-langgraphdocs - API reference — boot the server and open
http://localhost:8000/docs - Privacy & data handling — PRIVACY.md
- Self-hosted deployment — DEPLOY.md
License
Apache-2.0
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 agensflow_mcp-0.1.0.tar.gz.
File metadata
- Download URL: agensflow_mcp-0.1.0.tar.gz
- Upload date:
- Size: 300.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.17.1 {"ci":null,"cpu":"x86_64","distro":{"name":"macOS","version":"14.6.1"},"implementation":{"name":"CPython","version":"3.11.11"},"installer":{"name":"hatch","version":"1.17.1"},"openssl_version":"OpenSSL 3.6.2 7 Apr 2026","python":"3.11.11","system":{"name":"Darwin","release":"23.6.0"}} HTTPX2/2.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abd98bb4924ee331e49602b623d7c21a1985fc8038409866b1e75c9da079748c
|
|
| MD5 |
d6b2a627d5e68f0ce0f23e04c857b4ce
|
|
| BLAKE2b-256 |
e649234ec7794d35ebddfd738e13624aa85679c7dc5dbb2552b4efd2b1c2605f
|
File details
Details for the file agensflow_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: agensflow_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 70.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.17.1 {"ci":null,"cpu":"x86_64","distro":{"name":"macOS","version":"14.6.1"},"implementation":{"name":"CPython","version":"3.11.11"},"installer":{"name":"hatch","version":"1.17.1"},"openssl_version":"OpenSSL 3.6.2 7 Apr 2026","python":"3.11.11","system":{"name":"Darwin","release":"23.6.0"}} HTTPX2/2.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cc10b9fcf7442612d5f31518b575d17f5777e8316ef868c8cb544aa5e9d175d
|
|
| MD5 |
9a02eb60babdb380b70c3416ead773a8
|
|
| BLAKE2b-256 |
4a53cd26faa9ec75e095d6f42623aae27661c321981091d2ab58fd57df38806d
|