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.
Five Terms You Need to Know
| Term | Plain Meaning | Real Counterpart in Repo |
|---|---|---|
gateway | Single HTTP/3 QUIC, HTTP/2, or stdio server binary that agents call. | gap-cli / gap-server |
branch | One 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-* |
snapshot | Immutable compiled bundle of schemas, indexes, and Cedar rules pinned per request. | gap-snapshot (ArcSwap) |
principal | Authenticated human, agent, or service caller evaluated by Cedar default-deny policy. | gap-sec + policies/default.cedar |