Skip to content

Deployment

Each service is a container. A minimal production setup:

Container Layout

ServiceReplicasNotes
API Gateway2+Stateless, behind load balancer
Orchestrator2+Session-sharded, with state in Redis + DB
Redis/ValkeyManaged, or 1 primary + 1 replicaSingle point of failure otherwise
Research AgentsN per typeAutoscaling on queue depth

Networking

  • API Gateway is the only public-facing service
  • All internal traffic (Orchestrator → Redis, workers → Redis, Orchestrator → DB) stays on a private network
  • Workers do not need to be reachable from the Orchestrator; they pull, they don't get called

Scaling Policies

  • API Gateway: CPU or RPS based
  • Research Agents: Queue depth per agent type (e.g., scale Dining workers when LLEN jobs:dining > 100)
  • Orchestrator: Manual or session-count based; the bottleneck is usually model latency, not CPU
  • Redis: Memory- and connection-count based

Service Definition

Each container exposes:

  • A health check (/healthz)
  • A readiness check (/readyz) that verifies downstream dependencies
  • Prometheus metrics on a standard port

Marchay Platform Documentation