Skip to content

Architecture Overview

Sentinel is built as a multi-agent pipeline where each agent is a Cloudflare Durable Object communicating through Queues.

┌─────────────────────────────────────────────────────────────────────────┐
│ Cloudflare Workers │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Orchestrator │ │ Workers AI │ │ AI Gateway │ │
│ │ (Hono API) │ │ (Inference) │ │ (Routing) │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
│ │
│ ┌─────────────────────── Agent Pipeline ───────────────────────────┐ │
│ │ │ │
│ │ LogTailer ──→ TestGen ──→ CodeTriage ──→ FixAgent ──→ GitHub PR │ │
│ │ │ │ │ │ │ │
│ │ ▼ ▼ ▼ ▼ │ │
│ │ [errors- [triage- [fix-ready] [completed] │ │
│ │ detected] ready] │ │
│ │ │ │
│ └───────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ D1 │ │ R2 │ │ Queues │ │ Sandbox │ │
│ │ (SQLite) │ │ (Blobs) │ │ (5 + DLQ)│ │(Container)│ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
└─────────────────────────────────────────────────────────────────────────┘

Sentinel uses the Cloudflare Agents SDK rather than raw Durable Objects. The SDK provides:

  • this.schedule() — schedule future work (polling intervals, retries)
  • this.sql — embedded SQLite for fast agent-local state
  • this.setState() — reactive state management
  • AgentWorkflow — durable multi-step execution with exactly-once step semantics
StoragePurposeLatency
Agent SQLite (this.sql)Hot operational state (fingerprint cache, polling cursors)Sub-millisecond
D1System of record (incidents, audit trail, configs)~5ms
R2Binary artifacts (test cases, patches, PR descriptions)~10ms

The LogTailer maintains a fingerprint cache in agent-local SQLite for sub-millisecond dedup lookups. Authoritative records go to D1 for cross-agent queries.

Each pipeline stage has its own queue with tuned batch sizes:

  • Detection (batch_size: 10) — high throughput error ingestion
  • Triage (batch_size: 5) — moderate throughput for LLM analysis
  • Fix (batch_size: 1) — serialized to prevent concurrent repo modifications
  • Completion (batch_size: 10) — logging and status updates

All queues (except completed) have a dead-letter queue (sentinel-dlq) for failed messages.

All untrusted code execution happens in Cloudflare Sandbox containers:

  • Cloned Git repositories
  • AI-generated test cases
  • AI-generated code fixes
  • Linting and regression checks

The Worker process never executes user code directly.

ConcernChoice
RuntimeBun
LanguageTypeScript 5.9+ (strict, ESM)
Agent frameworkCloudflare Agents SDK
Sandbox@cloudflare/sandbox
HTTP APIHono
ValidationZod
LLMWorkers AI + AI Gateway
DatabaseD1
Object storageR2
MessagingQueues
IDsULID (lexicographically sortable)