Skip to main content

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

License

Apache-2.0

Metadata

Release files for agensflow-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agensflow-mcp 0.1.0
File Size Uploaded
agensflow_mcp-0.1.0.tar.gz 300.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agensflow-mcp 0.1.0
File Interpreter ABI Platform
agensflow_mcp-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 370.6 kB

Release files / agensflow_mcp-0.1.0.tar.gz

Download URL agensflow_mcp-0.1.0.tar.gz
Size 300.6 kB
Tags Source
SHA-256 checksum
How to use checksums
abd98bb4924ee331e49602b623d7c21a1985fc8038409866b1e75c9da079748c
BLAKE2b-256 checksum
How to use checksums
e649234ec7794d35ebddfd738e13624aa85679c7dc5dbb2552b4efd2b1c2605f
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / agensflow_mcp-0.1.0-py3-none-any.whl

Download URL agensflow_mcp-0.1.0-py3-none-any.whl
Size 70.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2cc10b9fcf7442612d5f31518b575d17f5777e8316ef868c8cb544aa5e9d175d
BLAKE2b-256 checksum
How to use checksums
4a53cd26faa9ec75e095d6f42623aae27661c321981091d2ab58fd57df38806d
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page