What is GAP?

GAP gives AI agents one safe, typed entry point to call REST APIs, SQL databases, gRPC services, GraphQL subgraphs, CLIs, and code repositories—without stuffing thousands of JSON tool definitions into the LLM context window.

What you'll learn

  • Why loading flat tool catalogs directly into prompts breaks down as your system grows.
  • Core GAP vocabulary: Gateway, Branch, Connector, Snapshot, and Principal.
  • Exact crossover boundary: when to use Direct-MCP vs. when GAP dominates.
On this page

Why Flat Agent Tooling Hits a Wall

Most agent integrations connect an LLM directly to individual Model Context Protocol (MCP) or HTTP endpoints. That works cleanly for 5–10 small tools, then fails in four predictable ways in production:

  • Context Explosion: Serializing 1,000 flat JSON Schema tools up front consumes 203,421 tokens before the user even asks a question.
  • N+1 Agent Waterfalls: Without a shared join planner, the model fetches a customer, loops through orders turn-by-turn, then queries notes separately—wasting latency and tokens.
  • Mutable Descriptions (Rug Pulls): If an untrusted upstream edits a tool description after approval to inject hidden instructions, flat clients forward the poisoned text straight to the LLM.
  • Probabilistic Authorization Leaks: Letting an LLM or neural classifier enforce access control introduces bypass risk. Access decisions must be deterministic code.
Comparison of flat Direct-MCP vs Unified GAP Supergraph Without GAP (Flat Direct-MCP) 203,421-Token Prompt Bloat 1,000 raw tool schemas up front Agent N+1 loop (4 turns) Mutable descriptions (Rug-Pull risk) REST | SQL | gRPC | MCP | Code AST With GAP (Typed Supergraph) 5 Static MCP Tools (Fixed 651 tok) L0 -> L1 -> L2 Discovery + Cedar AuthZ DataLoader Batch + ArcSwap (2 turns) 6 NGC Branches · SSRF & Drift Guard HTTP/3 QUIC · MCP · A2A v1.0 · AG-UI
Comparison of flat Direct-MCP vs Unified GAP Supergraph

Five Terms You Need to Know

Core Graph Agent Protocol concepts mapped cleanly
TermPlain MeaningReal Counterpart in Repo
gatewaySingle HTTP/3 QUIC, HTTP/2, or stdio server binary that agents call.gap-cli / gap-server
branchOne upstream backend source (an API, DB, CLI, codebase, or MCP server).Configured via [[branches]] in gap.toml
connector (NGC)Adapter projecting any backend into one typed protobuf + GraphQL schema.6 shipped adapters under adapters/gap-ngc-*
snapshotImmutable compiled bundle of schemas, indexes, and Cedar rules pinned per request.gap-snapshot (ArcSwap)
principalAuthenticated human, agent, or service caller evaluated by Cedar default-deny policy.gap-sec + policies/default.cedar

When Direct-MCP Is Still Simpler (Honest Crossover)