Skip to content

Deployment

AgentCTX supports multiple deployment models, from single-machine setups to distributed Kubernetes clusters.

ModelUse CaseComplexity
StandaloneLocal development, single userLow
Docker ComposeTeam development, small teamsMedium
KubernetesProduction, multi-tenantHigh
EdgeEmbedded in applicationsVariable

Install and run directly:

Terminal window
npm install -g @agentctx/core
actx init
actx start --transport sse --port 3100

No external dependencies required for basic operation. SurrealDB and NATS are optional for persistence and messaging.

The recommended setup for teams:

Terminal window
git clone https://github.com/ryan-haver/agentctx.git
cd agentctx
docker compose up -d --build --wait

This starts 4 services:

  • agentctx (port 3100) — TypeScript gateway
  • ctx-gateway (port 3200) — Rust HTTP gateway
  • surrealdb (port 8000) — Database
  • nats (port 4222) — Message bus
volumes:
surrealdb_data:
nats_data:
services:
surrealdb:
volumes:
- surrealdb_data:/data
nats:
volumes:
- nats_data:/data

For production deployments, deploy each component as a separate service:

apiVersion: apps/v1
kind: Deployment
metadata:
name: agentctx-gateway
spec:
replicas: 3
template:
spec:
containers:
- name: gateway
image: agentctx/gateway:latest
ports:
- containerPort: 3100
env:
- name: SURREAL_URL
value: "ws://surrealdb:8000"
- name: NATS_URL
value: "nats://nats:4222"
  • Gateway — stateless, scale horizontally behind a load balancer
  • SurrealDB — use SurrealDB cluster mode for HA
  • NATS — use NATS superclusters for cross-region federation
  • Rust gateway — single binary, very low resource footprint

Embed AgentCTX in applications using the WASM builds:

import { Parser } from '@agentctx/wasm';
const parser = new Parser();
const stmt = parser.parse('?k "auth" ^3');

The WASM parser runs in browsers, Cloudflare Workers, Deno Deploy, and other edge runtimes.

  • Change default SurrealDB credentials
  • Enable mTLS between services
  • Set up 1Password integration (OP_SERVICE_ACCOUNT_TOKEN)
  • Configure token budgets
  • Enable Sentinel monitoring (active or strict mode)
  • Set up log aggregation (OpenTelemetry)
  • Configure backup for SurrealDB volumes
  • Test actx verify in CI pipeline