Observability System Documentation

Observability System Documentation

Comprehensive monitoring, logging, and alerting design for agentic-sandbox

Project: Agentic Sandbox VM Orchestration Platform Author: Reliability Engineer Date: 2026-01-31 Status: Design Complete - Ready for Implementation


Overview

This directory contains the complete observability system design for the agentic-sandbox platform, including metrics collection, log aggregation, SLI/SLO definitions, alert rules, and operational procedures.

Platform activity sources include the Linux activity collector, network activity collector, and macOS activity collector. The macOS source implementation is complete, while production Endpoint Security activation remains gated on Apple entitlement approval, full Xcode linkage, signing, notarization, and host consent.

The activity reliability validation defines the deterministic chaos matrix and the resumable real-time seven-day campaign used to qualify these collectors and the ingest/query/export path.

Key Features:

  • Host-based metrics aggregation using Prometheus
  • Per-agent custom metrics via node_exporter textfile collector
  • Centralized log shipping to Loki
  • Actionable SLIs/SLOs for agent availability and task success
  • Three-tier alerting (warning, critical, emergency)
  • Production-ready dashboards and runbooks

Deliverables

πŸ“‹ Design Documents (3)

1. DESIGN.md (1,568 lines)

  • Purpose: Complete observability architecture and design specification
  • Contents:
  • Current state analysis
  • Architecture overview with diagrams
  • Metrics collection design (management server + agent VMs)
  • Log aggregation strategy (Loki + Promtail)
  • SLI/SLO definitions with error budget policy
  • Alert rules with severity levels
  • Dashboard specifications
  • 8-week implementation roadmap
  • Audience: Engineering leads, DevOps team, reliability engineers

2. ARCHITECTURE_DIAGRAM.md (28 KB)

  • Purpose: Visual architecture reference with ASCII diagrams
  • Contents:
  • High-level system overview
  • Data flow diagrams (metrics, logs, alerts)
  • Component inventory with ports and storage
  • Network topology
  • Retention policies
  • Audience: All engineers, operators, stakeholders

3. QUICK_REFERENCE.md (9.5 KB)

  • Purpose: Operator cheat sheet for daily operations
  • Contents:
  • Key PromQL and LogQL queries
  • Common operational tasks
  • Troubleshooting procedures
  • Performance baselines
  • Contact information
  • Audience: On-call engineers, operators

πŸ”§ Configuration Files (3)

4. prometheus.yml (3.5 KB)

  • Purpose: Prometheus scrape configuration
  • Deploy to: `/etc/prometheus/prometheus.yml`
  • Features:
  • Management server scrape config
  • Agent VM discovery (static + file_sd)
  • Alert rule loading
  • 90-day retention
  • Optional remote write config

5. alert-rules.yml (15 KB)

  • Purpose: Prometheus alerting rules
  • Deploy to: `/etc/prometheus/rules/agentic-sandbox.yml`
  • Features:
  • 25+ alert rules across 7 categories
  • Agent health (CPU, memory, disk, connectivity)
  • Command execution (failure rate, latency, stalls)
  • Task orchestration (backlog, failures)
  • Management server health
  • SLO violations
  • Storage quotas
  • Alert count: 25 rules
  • Severity levels: WARNING (14), CRITICAL (10), EMERGENCY (1)

6. file_sd_targets_example.json (241 bytes)

  • Purpose: Example Prometheus file-based service discovery
  • Deploy to: `/etc/prometheus/targets/agents.json`
  • Use case: Dynamic agent registration

πŸ“ Implementation Guides (2)

7. IMPLEMENTATION_CHECKLIST.md (15 KB)

  • Purpose: Step-by-step implementation guide with checklists
  • Timeline: 8 weeks (6 phases + post-implementation)
  • Contents:
  • Phase 1: Foundation (Week 1-2) - Prometheus, Grafana, node_exporter
  • Phase 2: Custom Metrics (Week 3) - Agent-side exporters, management extensions
  • Phase 3: Log Aggregation (Week 4) - Loki, Promtail, JSON logging
  • Phase 4: SLI/SLO Implementation (Week 5) - Recording rules, dashboards
  • Phase 5: Alerting (Week 6) - Alertmanager, runbooks, testing
  • Phase 6: Production Hardening (Week 7-8) - Retention, backup, ORR
  • Checkboxes: 87 actionable items
  • Sign-off gates: 7 approval points

8. CAPACITY_LOAD_PLAN.md

  • Purpose: Reproducible, credential-free seven-day capacity baseline

procedure

  • Coverage: Host, Docker, and QEMU tasks, PTY sessions, lifecycle

operations, management resources, agent resources, and Prometheus storage

  • Safety: Requires an explicitly approved isolated environment and

retains sanitized numeric/status evidence only

  • Status: Generator committed under issue #661; evidence window pending

9. activity-timeline.md

  • Purpose: Metadata-only timeline API, CLI, dashboard, coverage, and

signed-export operator runbook

  • Safety: Exact tenant scope, explicit loss/clock status, safe DOM

rendering, and fail-closed server-held signing keys


Quick Start

For Engineering Leads

1. Review Design: Read DESIGN.md 2. Approve SLOs: Section 5 (SLI/SLO Definitions) 3. Assign Owner: Designate reliability engineer to lead implementation 4. Schedule Kickoff: Plan 8-week timeline starting from approved date

For Implementation Team

1. Read Checklist: IMPLEMENTATION_CHECKLIST.md 2. Set Up Environment:

   # Install Prometheus
   sudo apt install prometheus grafana -y

   # Deploy configs
   sudo cp prometheus.yml /etc/prometheus/prometheus.yml
   sudo cp alert-rules.yml /etc/prometheus/rules/agentic-sandbox.yml
   sudo systemctl reload prometheus

3. Follow Phase 1: Start with Foundation (Week 1-2) 4. Track Progress: Check off items in IMPLEMENTATION_CHECKLIST.md

For Operators

1. Bookmark: QUICK_REFERENCE.md 2. Access Dashboards:

3. Join Channels:

  • `#agentic-sandbox-alerts` (Slack)
  • `#agentic-sandbox-incidents` (Slack)

Architecture Summary

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     Observability Stack                      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”             β”‚
β”‚  β”‚Prometheus│───▢│Alertmgr  │───▢│  Slack   β”‚             β”‚
β”‚  β”‚ (Metrics)β”‚    β”‚ (Alerts) β”‚    β”‚PagerDuty β”‚             β”‚
β”‚  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β”‚
β”‚       β”‚                                                     β”‚
β”‚       β”‚ Scrape                                              β”‚
β”‚       β”‚                                                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”             β”‚
β”‚  β”‚  Mgmt    β”‚    β”‚  Agents  β”‚    β”‚   Host   β”‚             β”‚
β”‚  β”‚ Server   β”‚    β”‚node_exp  β”‚    β”‚node_exp  β”‚             β”‚
β”‚  β”‚/metrics  β”‚    β”‚ :9100    β”‚    β”‚ :9100    β”‚             β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β”‚
β”‚                                                             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                              β”‚
β”‚  β”‚   Loki   │◀───│ Promtail β”‚                              β”‚
β”‚  β”‚  (Logs)  β”‚    β”‚ (Shipper)β”‚                              β”‚
β”‚  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                              β”‚
β”‚       β”‚                                                     β”‚
β”‚       β”‚ Query                                               β”‚
β”‚       β”‚                                                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                β”‚
β”‚  β”‚           Grafana Dashboards           β”‚                β”‚
β”‚  β”‚  β€’ Agent Fleet Overview                β”‚                β”‚
β”‚  β”‚  β€’ Task Orchestration                  β”‚                β”‚
β”‚  β”‚  β€’ Storage & Quotas                    β”‚                β”‚
β”‚  β”‚  β€’ SLO Compliance                      β”‚                β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Metrics

Management Server Metrics (Existing)

MetricTypeDescription
`agentic_uptime_seconds`gaugeServer uptime
`agentic_agents_connected`gaugeConnected agent count
`agentic_agents_by_status{status}`gaugeAgents by status (ready, busy)
`agentic_commands_total`counterTotal commands dispatched
`agentic_commands_by_result{result}`counterCommands by result (success, failed)
`agentic_tasks_by_state{state}`gaugeTasks by state

Custom Agent Metrics (New)

MetricTypeDescription
`agentic_agent_commands_total{agent_id}`counterCommands executed per agent
`agentic_agent_commands_success{agent_id}`counterSuccessful commands per agent
`agentic_agent_claude_tasks_total{agent_id}`counterClaude tasks per agent
`agentic_agent_current_commands{agent_id}`gaugeActive commands per agent

System Metrics (node_exporter)

MetricTypeDescription
`node_cpu_seconds_total{mode}`counterCPU time by mode
`node_memory_MemAvailable_bytes`gaugeAvailable memory
`node_filesystem_avail_bytes{mountpoint}`gaugeAvailable disk space
`node_network_transmit_bytes_total{device}`counterNetwork TX bytes

SLO Targets

SLOTargetError BudgetMeasurement Window
Agent Availability99.0%100.8 min/weekRolling 7 days
Command Success Rate99.0%14.4 min/dayRolling 24 hours
Task Success Rate95.0%8.4 hours/weekRolling 7 days
Management Server Uptime99.9%43 min/monthRolling 30 days

Error Budget Policy:

  • > 50% remaining: Normal development velocity
  • 25-50% remaining: Freeze risky deployments
  • 10-25% remaining: CRITICAL - All non-essential changes blocked
  • < 10% remaining: EMERGENCY - Rollback + incident commander

Alert Summary

By Severity

SeverityCountNotificationResponse Time
WARNING14SlackBest-effort
CRITICAL10PagerDuty< 30 minutes
EMERGENCY1PagerDuty + Slack + SMSImmediate

By Category

CategoryAlert Count
Agent Health6
Command Execution4
Task Orchestration3
Management Server4
SLO Violations3
Storage Quotas3
Network2

Implementation Timeline

Week 1-2:  Foundation         [Prometheus, Grafana, node_exporter]
Week 3:    Custom Metrics     [Agent exporters, management extensions]
Week 4:    Log Aggregation    [Loki, Promtail, JSON logs]
Week 5:    SLI/SLO            [Recording rules, dashboards]
Week 6:    Alerting           [Alertmanager, runbooks, testing]
Week 7-8:  Hardening          [Retention, backup, ORR]
───────────────────────────────────────────────────────────────
Total:     8 weeks            [87 checklist items, 7 sign-offs]

Dependencies

Software Requirements

ComponentMinimum VersionInstall Method
Prometheus2.50.0`apt install prometheus`
Grafana10.3.0`apt install grafana`
Loki2.9.0Docker or binary
Promtail2.9.0`apt install promtail`
Alertmanager0.27.0`apt install prometheus-alertmanager`
node_exporter1.7.0`apt install prometheus-node-exporter`

Infrastructure Requirements

ResourceRequirementNotes
Disk (Prometheus)100GB90-day retention
Disk (Loki)50GB30-day retention
RAM (Prometheus)4GBWith 50 agents
RAM (Loki)2GBWith 10GB/day ingestion
Network1 GbpsBetween host and agents

Success Metrics

Technical Metrics

  • [ ] 100% of agent VMs monitored
  • [ ] 25+ alert rules configured
  • [ ] 4 production dashboards created
  • [ ] < 10 seconds alert fire-to-notification latency
  • [ ] < 60 seconds log write-to-query latency

Process Metrics

  • [ ] 7 ORR checklist items approved
  • [ ] 10+ runbooks written
  • [ ] 100% of critical alerts tested
  • [ ] < 1 hour recovery time objective from backup
  • [ ] 12-month capacity plan approved

Mission Correlation

Mission-owned work carries an `AIWG_MISSION_ID` environment variable into the agent process. A2A `messages:send` dispatch also sets `AIWG_A2A_TASK_ID` and uses that task ID as the mission correlation key when no higher-level mission ID exists. Management and agent logs emit structured `mission_id`, `task_id`, `command_id`, `session_id`, and `agent_id` fields at dispatch, start, terminal transition, and spawn-failure points.

One-Query Lookup

For local JSON logs:

rg '"mission_id":"<mission-id>"|mission_id=<mission-id>|"task_id":"<mission-id>"' /var/log/agentic-sandbox /mnt/inbox/runs

For journald:

journalctl -u agentic-mgmt -u agent-client --since today | rg 'mission_id=<mission-id>|"mission_id":"<mission-id>"'

For Loki:

{app=~"agentic-mgmt|agent-client"} |= "mission_id" |= "<mission-id>"

The same query key appears in persisted A2A task status and output artifacts as `mission_id`, so a failed task can be tied back to management dispatch, agent execution, and collected output chunks without timestamp-only inference.


DocumentLocationPurpose
Provisioning Scripts`/images/qemu/provision-vm.sh`VM setup
Management Server`/management/README.md`Server architecture
Agent Client`/agent-rs/README.md`Agent implementation
Protocol Spec`/proto/agent.proto`gRPC messages
Task Lifecycle`/docs/TASK_LIFECYCLE.md`Orchestration design

Support & Feedback

Questions? Contact the platform team:

  • Engineering Lead: [Name/Email]
  • DevOps Lead: [Name/Email]
  • On-Call: PagerDuty rotation

Found an issue? Open a ticket:

Contributing: Follow conventional commit format:

feat(observability): add custom agent metrics exporter
docs(observability): update SLO targets
fix(alerts): correct AgentHighCPU threshold

Changelog

VersionDateChanges
1.02026-01-31Initial design complete
--Awaiting implementation kickoff

Status: βœ… Design Complete - Ready for Implementation

Next Steps: 1. Schedule design review meeting 2. Assign implementation owner 3. Approve 8-week timeline and budget 4. Kick off Phase 1 (Foundation)


Last Updated: 2026-01-31 Document Owner: Reliability Engineer