Skip to content

Scaling Projections

AgentCTX is designed to scale from single-developer setups to enterprise deployments with hundreds of agents. This page covers scaling characteristics across key dimensions.

AgentsArchitectureNotes
1–5Standalone or Docker ComposeSingle gateway instance
5–20Docker Compose with persistenceSurrealDB + NATS for state
20–100Kubernetes + load balancerMultiple gateway replicas
100+Kubernetes + NATS superclustersFederated, multi-region

The gateway is stateless — scaling is horizontal. Add replicas behind a load balancer.

BackendsBehavior
1–10All lazy-spawned, minimal resource use
10–50Consider grouping by role for efficient scoping
50+Use backend pools with dedicated gateway instances

Lazy spawning means unused backends consume zero resources.

MemoriesStoragePerformance
< 10KIn-memory (SurrealDB)< 1ms queries
10K–100KSurrealDB with HNSW indices< 5ms queries
100K–1MSurrealDB cluster< 10ms queries
1M+Sharded SurrealDB + archive tier< 20ms queries

The decay system naturally prunes stale memories, keeping the active set focused.

DocumentsChunksIndex Size
100~2K~50MB
1,000~20K~500MB
10,000~200K~5GB
100,000~2M~50GB

Knowledge search uses MiniSearch (full-text) by default. When surrealqlNative=true, HNSW vector indices provide sub-linear scaling — doubling the corpus doesn’t double query time.

TransportOps/sec (TypeScript)Ops/sec (Rust)
stdio~50K~200K
SSE~30K~150K
HTTP~40K~180K
CTXB (binary)~500K~2M+

The Rust gateway provides 4–5x throughput improvement over the TypeScript gateway.

Team SizeMonthly Token SavingsAnnual Value
5 developers~$1,500/mo~$18,000/yr
20 developers~$6,000/mo~$72,000/yr
100 developers~$30,000/mo~$360,000/yr

Based on the 90% token reduction measured in Token Savings.