{"slug": "integrating-langgraph-with-maref-protocol-level-governance-that-works-today", "title": "Integrating LangGraph with MAREF — Protocol-Level Governance That Works Today", "summary": "MAREF Engineering announced that its protocol-level governance integration with LangGraph, using MCP and A2A, is live and tested, while the native LangGraphAdapter remains on the roadmap. The MCPBridge wraps tool calls in a security gate, and the A2ABridge governs multi-agent task lifecycles, both providing audit logging and halt capabilities. The AutoGen adapter is already shipped, but the LangGraph native adapter is specified but not yet merged.", "body_md": "# Integrating LangGraph with MAREF — Protocol-Level Governance That Works Today\n\nBy MAREF Engineering\n\nIf you're building production agents in 2026, there's a good chance they're a **LangGraph** state graph. Nodes, edges, conditional routing — elegant, testable, and — until you add a governance layer — completely unsupervised. This guide shows the two ways to govern a LangGraph app with MAREF, and it's honest about which is ready today.\n\nTL;DR: the **protocol-level path (MCP + A2A) is live and tested**; the native `LangGraphAdapter`\n\ndocumented in the quickstart is on the roadmap, with the AutoGen sidecar adapter already shipped.\n\n## The honest status, first\n\nMAREF's [quickstart](/en/docs/quickstart/) documents a `sidecar.adapters.langgraph.LangGraphAdapter`\n\nwith three methods — `evaluate_node_safety`\n\n, `observe_transition`\n\n, and `inject_governance`\n\n. We want to be direct with you: **that adapter is specified but not yet merged.** The AutoGen adapter (`sidecar.adapters.autogen.AutoGenAdapter`\n\n) is live; LangGraph's native adapter is being built to the same contract.\n\nWhat that means for you: you should not block on the adapter. The protocol-level integration below uses only shipped, tested code paths and gives you the same governance guarantees today.\n\n## Path 1 — Govern tool calls inside a LangGraph node (MCP)\n\nLangGraph nodes call tools. Those tools are where the blast radius lives. Wrap them with `MCPBridge`\n\nand every call from any node goes through the security gate — with the same event stream you can feed your audit log:\n\n``` python\nfrom langgraph.graph import StateGraph\nfrom maref.integration.mcp_client import MCPClient, MCPServerConfig\nfrom maref.integration.mcp_bridge import MCPBridge\n\nclient = MCPClient()\nconn = client.register_server(MCPServerConfig(\n    command=[\"npx\", \"-y\", \"@your/tool-server\"],\n    transport_type=\"stdio\",\n    server_name=\"tool-server\",\n))\nbridge = MCPBridge(client)                      # wraps calls in the security gate\n\ndef tool_node(state):\n    # every node that touches the world goes through governance\n    return bridge.invoke_tool(\n        conn,\n        tool_name=state[\"tool\"],\n        args=state[\"args\"],\n    )\n\ngraph = StateGraph(dict)\ngraph.add_node(\"tools\", tool_node)\ngraph.add_edge(\"__start__\", \"tools\")\n```\n\nA DENY verdict returns `{\"error\": \"Tool blocked by security gate\", ...}`\n\n— the external server is never called, and the node's `__error__`\n\nedge or fallback logic can route around it. Your LangGraph topology stays exactly as designed; MAREF just sits at every tool boundary.\n\n## Path 2 — Govern whole tasks across agents (A2A)\n\nFor multi-agent LangGraph deployments — several graphs, maybe a supervisor — the `A2ABridge`\n\nmakes MAREF itself an A2A-governed agent that creates, delegates, and halts tasks across the federation:\n\n``` python\nfrom maref_lite.state_machine import GovernanceStateMachine\nfrom maref.governance.audit import AuditLogger\nfrom maref.integration.a2a_bridge import A2ABridge\n\nbridge = A2ABridge(\n    state_machine=GovernanceStateMachine(),\n    audit_logger=AuditLogger(log_path=\"maref-audit.jsonl\"),\n    agent_name=\"langgraph-supervisor\",\n)\n\ntask_id = bridge.create_task(\"Summarize Q3 report\")    # governed lifecycle\n# another agent can delegate into us:\nbridge.delegate_task(task_id, \"https://other-agent.local:8000\")\n\n# any authorized human can halt a task outright:\nbridge.force_halt_task(task_id, reason=\"scope change\")\n```\n\nEvery `create_task`\n\n, delegation, and state change is HMAC-signed into the audit log and runs through the same governance state machine — `OBSERVE → ANALYZE → EVALUATE → DECIDE → ACT → VERIFY → STABILIZE → REPORT`\n\n, with `HALT`\n\nreachable by any authorized human or the circuit breaker.\n\nThe result: your LangGraph graphs keep their orchestration logic, while MAREF owns the \"is this safe?\" decision at every boundary — tool calls, inter-agent handoffs, and task lifecycle.\n\n## Which path should you pick?\n\n**Single graph, several tools**→ Path 1 (MCP bridge on tool calls). Minimal change, immediate audit trail.** Multiple graphs / supervisor pattern**→ Path 2 (A2A). You get task lifecycle governance, delegation, and a kill-switch across the whole fleet.** Both**→ They compose. MAREF governs tool calls*and*task orchestration simultaneously — that's the 8-layer architecture working as designed.\n\n*🛡️ Sources: MAREF source — src/maref/integration/mcp_bridge.py (MCPBridge.invoke_tool), src/maref/integration/a2a_bridge.py (A2ABridge.create_task / delegate_task / force_halt_task), src/sidecar/adapters/autogen.py (shipped sidecar adapter). LangGraph adapter contract defined in docs/quickstart.md §3.3 (roadmap — AutoGen adapter shipped). *\n\n[Quickstart](/en/docs/quickstart/)·\n\n[Integrations](/en/integrations/).", "url": "https://wpnews.pro/news/integrating-langgraph-with-maref-protocol-level-governance-that-works-today", "canonical_source": "https://maref.cc/en/blog/langgraph-integration-tutorial", "published_at": "2026-08-14 00:00:00+00:00", "updated_at": "2026-08-14 04:35:33.897180+00:00", "lang": "en", "topics": ["ai-agents", "ai-safety", "ai-tools", "developer-tools"], "entities": ["MAREF Engineering", "LangGraph", "MCPBridge", "A2ABridge", "AutoGenAdapter", "LangGraphAdapter"], "alternates": {"html": "https://wpnews.pro/news/integrating-langgraph-with-maref-protocol-level-governance-that-works-today", "markdown": "https://wpnews.pro/news/integrating-langgraph-with-maref-protocol-level-governance-that-works-today.md", "text": "https://wpnews.pro/news/integrating-langgraph-with-maref-protocol-level-governance-that-works-today.txt", "jsonld": "https://wpnews.pro/news/integrating-langgraph-with-maref-protocol-level-governance-that-works-today.jsonld"}}