Skip to content

Agentic Interception, API Discovery, and AI Gateway Architecture ​

Caber governs agentic workloads through a defense in depth interception architecture combining an in process Python and Rust SDK (pycaber / pycaber.auto) with out of process AI and MCP Gateways (caber-core, LiteLLM, Envoy ext_authz, and MCP proxy). Both layers converge on the same Rust streaming_core::intercept pipeline so that HTTP calls, WebSocket frames, gRPC streams, in process agent tool invocations, MCP tool calls, and Agent to Agent (A2A) messages receive identical characterization, W3C trace propagation, and Contract v3 policy enforcement.

Python & Agents15 HTTP WS gRPC5 Agent Frameworks
<line x1="140" y1="87" x2="162" y2="87" stroke="#38bdf8" stroke-width="1.5" marker-end="url(#intArrow)" /> <rect x="162" y="45" width="135" height="85" rx="8" fill="#0f172a" stroke="#38bdf8" stroke-width="1.5" /> <text x="229" y="76" fill="#f8fafc" font-family="Inter, sans-serif" font-size="12" font-weight="600" text-anchor="middle">Protocol Decode</text> <text x="229" y="96" fill="#94a3b8" font-family="Inter, sans-serif" font-size="10" text-anchor="middle">Protobuf &amp; A2A</text> <text x="229" y="112" fill="#94a3b8" font-family="Inter, sans-serif" font-size="10" text-anchor="middle">MCP &amp; Local Exec</text> <line x1="297" y1="87" x2="319" y2="87" stroke="#38bdf8" stroke-width="1.5" marker-end="url(#intArrow)" /> <rect x="319" y="45" width="140" height="85" rx="8" fill="#0f172a" stroke="#818cf8" stroke-width="1.5" /> <text x="389" y="76" fill="#f8fafc" font-family="Inter, sans-serif" font-size="12" font-weight="600" text-anchor="middle">Rust Intercept</text> <text x="389" y="96" fill="#94a3b8" font-family="Inter, sans-serif" font-size="10" text-anchor="middle">WRL Chunker &amp; RBIX</text> <text x="389" y="112" fill="#94a3b8" font-family="Inter, sans-serif" font-size="10" text-anchor="middle">Regorus Governance</text> <line x1="459" y1="87" x2="481" y2="87" stroke="#38bdf8" stroke-width="1.5" marker-end="url(#intArrow)" /> <rect x="481" y="45" width="135" height="85" rx="8" fill="#0f172a" stroke="#818cf8" stroke-width="1.5" /> <text x="548" y="76" fill="#f8fafc" font-family="Inter, sans-serif" font-size="12" font-weight="600" text-anchor="middle">Wire Rewriter</text> <text x="548" y="96" fill="#94a3b8" font-family="Inter, sans-serif" font-size="10" text-anchor="middle">Stream Re Seat</text> <text x="548" y="112" fill="#94a3b8" font-family="Inter, sans-serif" font-size="10" text-anchor="middle">Typed ToolMessage</text> <line x1="616" y1="87" x2="638" y2="87" stroke="#38bdf8" stroke-width="1.5" marker-end="url(#intArrow)" /> <rect x="638" y="45" width="115" height="85" rx="8" fill="#0f172a" stroke="#34d399" stroke-width="1.5" /> <text x="695" y="76" fill="#f8fafc" font-family="Inter, sans-serif" font-size="12" font-weight="600" text-anchor="middle">Caber Hub</text> <text x="695" y="96" fill="#94a3b8" font-family="Inter, sans-serif" font-size="10" text-anchor="middle">ApiMapMinter</text> <text x="695" y="112" fill="#94a3b8" font-family="Inter, sans-serif" font-size="10" text-anchor="middle">5 Attempt CAS</text> <line x1="753" y1="87" x2="775" y2="87" stroke="#38bdf8" stroke-width="1.5" marker-end="url(#intArrow)" /> <rect x="775" y="45" width="95" height="85" rx="8" fill="#0f172a" stroke="#34d399" stroke-width="1.5" /> <text x="822" y="76" fill="#f8fafc" font-family="Inter, sans-serif" font-size="12" font-weight="600" text-anchor="middle">OpenSearch</text> <text x="822" y="96" fill="#94a3b8" font-family="Inter, sans-serif" font-size="10" text-anchor="middle">csi_api_map</text> <text x="822" y="112" fill="#94a3b8" font-family="Inter, sans-serif" font-size="10" text-anchor="middle">Neo4j Graph</text> 
Figure 1: End to end agentic interception, protocol normalization, wire redaction, and single writer API discovery pipeline.
## 5. AI Gateway and MCP Mediation Patterns

For polyglot microservices (TypeScript, Go, Java, Rust) or third party SaaS agents where installing pycaber in process is not possible, Caber deploys as an inline AI Gateway and MCP Proxy:

  • LiteLLM & OpenAI Compatible Proxy: Agents point OPENAI_BASE_URL or ANTHROPIC_BASE_URL at the Caber Gateway (or run the Caber callback handler inside LiteLLM Proxy). Caber extracts W3C traceparent and baggage (caber.user, caber.email), fingerprints prompt messages ($.messages[*].content), enforces Contract v3 policies, and scrubs completion chunks before returning them to the caller.
  • Envoy ext_authz & Kong Gateway: Enterprise ingress controllers delegate request and response body inspection over gRPC ext_authz to caber-core, enforcing identical Regorus WASM policies at the perimeter.
  • MCP Gateway Mediation (stdio and Streamable HTTP / SSE):
    • tools/list Dynamic Filtering: Filters out tools the initiating human principal (caber.user) is prohibited from invoking under data.caber.policy_set.
    • tools/call Argument & Output Scrubbing: Normalizes the wire path to mcp/<tool>, stamps api.resource_type: "mcp", evaluates tool arguments before execution, and redacts unauthorized spans or PII from the tool's response content before the LLM context window ingests it.