Skip to main content
Trinity
Architecture

System Overview

Trinity provides a real-time operational layer for monitoring, managing, and interacting with your agent fleet. The Dashboard, Operations page, and monitoring systems give operators full visibility into agent activity, health, and collaboration.

Architecture Diagram

Trinity platform architecture: Clients, Platform Services, Agent Containers, and Storage

Dashboard

The main Dashboard monitors all agents and their activities in real time, with three switchable view modes — Timeline, Grid, and List. Timeline is the default; the choice persists per browser. Header filters (type-to-filter with /, quick tag filter, owner filter, time range) apply to every mode, and Create Agent sits in the header. See the full Dashboard reference.

Grid View

A magnetic tile canvas holding two kinds of occupant on one lattice: agent tiles (one per agent, with avatar, runtime badge, live status chips, and inline Running and Autonomy toggles) and info tiles (fleet-level readouts such as Fleet summary and Recent failures).

  • Drag a tile to move it, or drop it onto another to swap positions — the layout is saved per browser
  • Tidy re-packs tiles compactly; Reset restores the default auto-generated layout
  • Pan by dragging the background and zoom with scroll or pinch; tile metrics hydrate lazily so large fleets stay responsive
  • An optional org overlay draws departments (dept-* tags) as labelled zones and reporting lines (reports-to-* tags) as arrows between tiles

Timeline View (Default)

The default mode. Timeline shows execution boxes per agent, arranged chronologically.

  • Color-coded by trigger type: Manual (green), MCP (pink), Scheduled (purple), Agent-Triggered (cyan), Paid (yellow), Public (teal)
  • Each row shows the agent's completion rate, total cost, and parallel slot count
  • Live streaming: running executions show progress in real-time with a “Live” indicator
  • Time range filter: 1h, 6h, 24h, 7d, or custom
  • Active only toggle hides agents with no recent activity
  • Jump to Now snaps the view to the current time

Agent-to-agent collaboration is surfaced here — in the Timeline replay via the Agent-Triggered trigger type — rather than as a live node graph.

Dashboard timeline view showing execution boxes color-coded by trigger type with collaboration arrows

List View

The former standalone Agents page, folded into the Dashboard as a third mode (/agents now redirects here).

  • One row per agent: name, status, tags, runtime, read-only state, and last activity, with inline Run and Autonomy toggles
  • Sort by name, status, or activity; filter by name and status; select multiple rows for bulk tag operations
  • System agents pin to the top and hide the Run toggle
Dashboard List view showing one row per agent with status, tags, runtime, and inline Run/Autonomy toggles

Tag Clouds and Activity Feed

Agents are grouped visually by tags on the Dashboard. Click a tag cloud to filter the view to that group.

A real-time WebSocket-driven activity stream shows agent collaborations, task starts/completions, schedule executions, and errors as they happen.

Dashboard API Endpoints

EndpointMethodDescription
/api/agentsGETList all agents
/api/agents/context-statsGETContext and activity state for all agents
/api/agents/autonomy-statusGETAutonomy status for all agents
/api/activities/timelineGETCross-agent activity timeline (filterable)
/api/executions/timelineGETBucketed fleet rollups for building your own readouts
/api/agents/{name}/tagsPUTSet an agent's full tag list, including dept-* and reports-to-* org tags (rejected for agent-scoped keys)
/api/telemetry/hostGETHost CPU/memory/disk

Monitoring

Multi-layer health monitoring for the agent fleet with real-time alerts, automatic cleanup of stuck resources, and a fleet-wide health view on the Operations page. In addition to the periodic health-check loop, each running agent pushes a lightweight heartbeat to the backend every 5 seconds.

Health Levels

Agent health is reported at five severity levels:

LevelMeaning
healthyAll checks passing
degradedMinor issues detected
unhealthySignificant problems
criticalImmediate attention required
unknownUnable to determine status

Three Monitoring Layers

01

Docker Layer — Container status, CPU/memory usage, restart count, OOM detection.

02

Network Layer — Agent HTTP reachability with latency tracking.

03

Business Layer — Runtime availability, context usage, error rates.

Alert Cooldowns: Repeated alerts for the same condition are throttled to prevent notification spam.

Health Tab (Operations Page)

Fleet health lives on the admin-only Health tab of the Operations page (/operations?tab=health). It shows summary cards, active alerts, and a per-agent health list with a status filter; admins can trigger a fleet-wide check with Check All. The periodic health-check loop is disabled by default and can be enabled via the API. Real-time WebSocket updates push health state changes as they occur. Individual agent health is visible in both the agent header and the Agents listing page.

Fleet health monitoring view showing agent health statuses and metrics

Cleanup Service

A background service that automatically recovers stuck resources:

  • Stale executions — Any execution with status='running' past its per-slot timeout is marked failed
  • Stale activities — Any activity with activity_state='started' past the configured threshold is marked failed
  • Stale Redis slots — Orphaned slot reservations are released
  • Run frequency — Every 5 minutes, plus a one-shot sweep on backend restart
  • Startup recovery — Orphaned executions (container down, not in process registry) are marked failed immediately and their slots are released

Monitoring MCP Tools

ToolDescription
get_fleet_health()Fleet-wide health summary
get_agent_health(name)Individual agent health
trigger_health_check()Force an immediate health check

Monitoring API Endpoints

EndpointMethodDescription
/api/monitoring/statusGETFleet health summary (includes heartbeat_* fields)
/api/monitoring/enablePOSTStart the health-check loop; persisted (admin)
/api/monitoring/disablePOSTStop the health-check loop; persisted (admin)
/api/monitoring/check-allPOSTTrigger a fleet-wide health check (admin)
/api/monitoring/cleanup-statusGETCleanup service status (admin)
/api/monitoring/cleanup-triggerPOSTForce a cleanup run (admin)

Operations

The Operations page at /operations is the single fleet-operations surface: one tabbed view with Needs Response, Notifications, Health, Executions, and Resolved tabs. It replaces the former standalone Health, Operating Room, and Executions pages, and the navigation bar shows a single Operations entry with one unified badge of pending items.

Needs Response Tab

Shows items from agents' operator queues that are waiting on a human: questions, approval requests, and alerts.

  • Agents write to ~/.trinity/operator-queue.json inside their container
  • A background sync service polls running agents every 5 seconds and persists items to the backend database
  • Operators respond to items directly; responses are written back to the originating agent
  • The first open item auto-expands when items arrive
  • WebSocket events: operator_queue_new, operator_queue_responded, operator_queue_acknowledged, operator_queue_cleared

Notifications Tab

Consolidated view of agent notifications (replaces the former standalone Events page).

  • Filter by agent, type, priority, or status; optionally show dismissed items
  • Stats cards display pending, acknowledged, total, and per-agent counts
  • Bulk selection and bulk actions
  • Real-time updates via WebSocket

Health and Executions Tabs

The Health tab hosts fleet health monitoring (admin-only); the Executions tab lists all task runs across the fleet, and Operations → Reports shows the structured results agents publish (see Agent Reports). See the Monitoring and Executions sections above and the Operations page reference.

Resolved Tab

Terminal operator-queue items (responded, acknowledged, cancelled, expired). Responded items stay visible until the agent confirms delivery of the response.

Sync Service

Restart-resilient sync between agent containers and the backend database, with a manual refresh button on the operator tabs. Cancelled and expired statuses are written back into agent queue files, so agents stop waiting on cleared items.

Operations page showing the operator queue with pending questions and approval requests from agents

Operator Queue API

EndpointMethodDescription
/api/operator-queueGETList queue items
/api/operator-queue/statsGETQueue statistics
/api/operator-queue/bulk-cancelPOSTCancel listed pending items
/api/operator-queue/clear-resolvedPOSTHide terminal items
/api/operator-queue/{id}GETGet single item
/api/operator-queue/{id}/respondPOSTSubmit response
/api/operator-queue/{id}/cancelPOSTCancel item
/api/operator-queue/agents/{name}GETItems for a specific agent
/api/notifications/dismiss-allPOSTDismiss all pending + acknowledged notifications

MCP Tool: send_notification(agent_name, message, priority) — sends a notification to the Operations page from within an agent.

Infrastructure Components

Backend (FastAPI)

:8000

Python 3.11, FastAPI, Uvicorn

Central orchestrator with 40+ routers covering agents, chat, schedules, credentials, skills, processes, monitoring, and more. Manages agent containers via the Docker socket (mounted read-only). Broadcasts real-time events over WebSocket.

Frontend (Vue.js 3)

:80

Vue.js 3, Tailwind CSS, Vite, Nginx

Single-page web dashboard for managing agents, viewing activity streams, monitoring schedules, and interacting with agents via chat. Connects to the backend API and WebSocket for live updates.

MCP Server

:8080

Node.js, TypeScript, SSE transport

Model Context Protocol server exposing 116 tools across 28 modules for agent management, chat, schedules, skills, systems, tags, notifications, and monitoring. Enables Claude Code and other MCP clients to control Trinity programmatically.

Scheduler Service

:8001

Python, APScheduler, Redis distributed locks

Dedicated single-instance service for cron-based agent task execution. Uses Redis distributed locking to prevent duplicate runs. Syncs schedules from the SQLite database and dispatches tasks to agents via the backend API.

Redis

:6379

Redis 7 Alpine, AOF persistence

Stores encrypted credentials, distributed locks for the scheduler, execution queue state, and pub/sub events. Supports optional password authentication for production deployments.

SQLite

:N/A

SQLite 3, /data/trinity.db

Primary data store for agents, users, schedules, activities, permissions, skills, tags, chat sessions, audit logs, and execution history. Stored on the trinity-data volume shared between backend and scheduler.

Vector (Log Aggregation)

:8686

Timber Vector 0.43, Docker log source

Collects logs from all containers via the Docker socket. Writes structured NDJSON to the trinity-logs volume. The backend reads these logs for the activity stream and log viewer in the dashboard.

OTel Collector (Optional)

:4317 / 8889

OpenTelemetry Collector Contrib 0.120

Receives OTLP metrics and traces from Claude Code agents running inside containers. Exports metrics in Prometheus format on port 8889. Enabled by setting OTEL_ENABLED=1.

Data Flow

A typical request flows through the system as follows:

Trinity request flow: User → Frontend → Backend → Agent → Result
01

Authentication — JWT tokens for browser sessions, MCP API keys for programmatic access. WebSocket connections require token authentication.

02

Execution Queue — Each agent processes one request at a time. Additional requests queue (up to 3). The slot service tracks capacity for the dashboard meter.

03

Agent Execution— The backend proxies chat to the agent's internal web server (running inside the container). Claude Code or Gemini CLI processes the request with full tool access.

04

Real-time Updates — Events broadcast over WebSocket to the dashboard and filtered to MCP clients based on agent access permissions.

Network Topology

All services run on a single Docker bridge network (trinity-agent-network, subnet 172.28.0.0/16). Agent containers are dynamically attached to this network when created.

Exposed Ports (Host)

PortServiceNotes
80Frontend (Nginx)Configurable via FRONTEND_PORT
8000Backend (FastAPI)REST API + WebSocket
8080MCP ServerSSE transport, API key auth
8001SchedulerHealth check endpoint only
6379RedisOptional password auth
8686VectorHealth/API endpoint
4317OTel CollectorgRPC OTLP receiver (optional)
8889OTel CollectorPrometheus exporter (optional)
2222+Agent SSHAuto-assigned, one per agent

Internal Communication

Services reference each other by container name on the Docker network. The MCP server reaches the backend at http://backend:8000. The scheduler connects to Redis at redis://redis:6379. Agent containers communicate with the backend using the internal API secret for authentication.

Storage

VolumePurposeMounted In
trinity-dataSQLite DB, archivesBackend, Scheduler
redis-dataRedis AOF persistenceRedis
trinity-logsVector NDJSON logsVector, Backend (ro)
trinity-archivesCompressed log archivesBackend
agent-configsAgent configurationBackend
agent-{name}-workspacePer-agent persistent FSAgent container

SQLite (/data/trinity.db) stores all platform state: users, agents, permissions, schedules, activities, chat sessions, audit logs, skills, tags, and execution history.

Redis stores encrypted credentials, distributed scheduler locks, execution queue state, and pub/sub events. Configured with AOF persistence.

Agent Workspaces — Each agent gets a dedicated Docker volume (agent-{name}-workspace) mounted at /home/developer. This volume persists across container restarts and contains the agent's code, configuration, CLAUDE.md, and working files.

Host Mounts — The Docker socket is mounted read-only into the backend for container management. Agent templates, process templates, hooks, and process docs are mounted read-only from the host config directory.

Security Posture

All platform containers run with no-new-privileges and drop all Linux capabilities except what is required. The backend uses a tmpfs for /tmp with noexec. Agent containers can optionally run in restricted mode (default) or full-capabilities mode for packages that require apt-get.