Why not just use an API Gateway?
Generic infra tools route packets. AgentCTX routes meaning.
vs Infrastructure & Token Formats
LiteLLM, Kong, Traefik, TOON — they solve routing or serialization. AgentCTX solves cognition.
| Capability | Generic Infra API | TOON Format | AgentCTX Gateway |
|---|---|---|---|
| Architectural Foundation | |||
| Primary Focus | Routing (TCP/HTTP) | Data Serialization | Cognition & Semantics |
| Payload Size per Op | ~40-100 Tokens | ~20-40 Tokens (-60%) | ~8 Tokens (-91%) |
| Agent Native Language | JSON-RPC | TOON notation | CTX Syntax |
| Compilation Target | N/A (pass-through) | N/A (format only) | 6 targets (SurrealQL, REST, MCP, etc.) |
| Memory & Context Routing | |||
| Memory Engine | Bring your own DB | None | SurrealQL Hybrid DB |
| Recall Method | RAG Pipeline | N/A | Structured Direct Recall |
| Lookup Latency | Variable (~150ms+) | N/A | < 1ms (< 50k keys) |
| Session Persistence | Client managed | Stateless | Automatic & Tagged |
| Security & Observability | |||
| Payload Receipts | Plaintext Logs | None | Ed25519 Cryptographic |
| Validation Layer | JSON Schema | Schema-Aware Headers | WASM Parse Time |
| Audit Trailing | Splunk / ELK | None | Response Ledger |
| Token Economics | |||
| Reduction vs JSON | 0% (uses JSON) | 30-60% | 82-91% |
| Nested Data Handling | Verbose payloads | Gains diminish | Flat compiled output |
| Static Content | Re-sent per call | Re-sent per call | CAS deduplication (99.9%) |
vs MCP (Model Context Protocol)
MCP is a transport — it defines how agents connect to tools. CTX is a protocol layer on top, adding compression, memory, orchestration, and trust.
MCP gives you
- Tool discovery and invocation
- stdio / SSE transport
- JSON-RPC message format
- Server lifecycle management
CTX adds on top
- Up to 91% compression — CTX grammar vs verbose JSON
- 5-layer persistent memory — agents remember across sessions
- Unified routing — one gateway to N MCP backends
- RBAC + Ed25519 signing — every action is verified
- Orchestration — lifecycle, budgets, coherence monitoring
- Knowledge plane — vector + graph search, not just tools
AgentCTX doesn't replace MCP — it enhances it. Your existing MCP servers work unchanged.
vs AI Frameworks
CTX doesn't compete — it subsumes. MemGPT's virtual memory → CTX Layers 0-5 with RBAC. DSPy's typed signatures → CTX grammar with trust.
| Capability | BAML | DSPy | Letta | AIOS | LangGraph | CTX |
|---|---|---|---|---|---|---|
| Natively emits executable instructions | ||||||
| Eliminates context inflation (via CTX/CAS) | ||||||
| Paginates memory out of the context window | ||||||
| Cross-session persistent knowledge graphs | ~ | |||||
| Enforces RBAC on every tool execution | ||||||
| Generates Ed25519 cryptographic receipts | ||||||
| Language-agnostic protocol (not a framework) | ~ | |||||
| Direct Agent-to-Agent IPC support |
Integration, Not Competition
AgentCTX is complementary. Here's how these tools would use CTX:
The Core Difference
Standard API gateways assume their client is a deterministic script that doesn't "think." They rely on heavy, nested JSON payloads that obliterate an LLM's context window. AgentCTX reverses this: it allows the agent to think in a tiny, expressive DSL, and places the burden of translation (compiling that DSL into verbose JSON for upstream APIs) entirely onto the Rust sidecar.