Case Study #2

Agent Orchestrator: Building a Multi-Agent Control Tower for Autonomous AI Governance

How Cedron Technologies engineered a real-time observability and governance platform that provides interactive Causal DAG visualization, time-travel step replay, circuit breaker kill-switches, and Human-in-the-Loop approval gates for autonomous AI agent workflows.

14
REST API Endpoints
Complete governance API surface
11
MCP Tools
Native Model Context Protocol server
1-Click
Emergency Kill-Switch
Instant rogue agent termination
<60s
Loop Detection
Automated SRE watchdog alerting

The Problem: Governing Autonomous AI Agents

The AI industry is rapidly shifting from single-prompt chat interfaces to autonomous multi-agent systems — architectures where multiple specialized AI agents collaborate, delegate tasks, and make decisions independently at machine speed.

While agent capabilities are advancing rapidly, the observability and governance tooling has not kept pace. Organizations deploying multi-agent systems face critical risks:

Risk Description Impact
Runaway Loops Agent A delegates to B, which delegates back to A infinitely Unbounded token costs
Hallucination Drift Hallucinated context cascades across agent handoffs Compounding errors
Unauthorized Actions Agents autonomously execute high-risk operations Data loss, compliance violations
Black Box Execution No visibility into why an agent made a decision Impossible to audit or debug

The central question: "When an autonomous AI agent is executing a 15-step workflow at machine speed — calling APIs, delegating to sub-agents, and making real-time decisions — how does a human operator maintain meaningful oversight?"

Solution Architecture

Agent Orchestrator is a Rails 8.1 platform that provides three layers of governance: passive observability (DAGs, replay, live streaming), active governance (circuit breakers, kill-switches, HITL gates), and proactive safety (automated SRE watchdogs).

System Architecture
┌──────────────────────────────────────────────────────────────┐
│              AGENT ORCHESTRATOR (Port 3000)                   │
│                                                              │
│  ┌──────────────┐  ┌───────────────┐  ┌────────────────────┐│
│  │ Control Tower │  │  REST API v1  │  │   MCP Server       ││
│  │ Dashboard UI  │  │ 14 Endpoints  │  │  11 Tools (/mcp)   ││
│  │ (Hotwire +    │  │               │  │                    ││
│  │  Stimulus)    │  │ /api/v1/runs  │  │ /mcp/sse           ││
│  └──────┬───────┘  └──────┬────────┘  └────────┬───────────┘│
│         │                 │                     │            │
│  ┌──────▼─────────────────▼─────────────────────▼──────────┐ │
│  │                APPLICATION CORE                         │ │
│  │                                                         │ │
│  │  ┌───────┐ ┌────────┐ ┌────────┐ ┌─────────┐ ┌───────┐│ │
│  │  │ Runs  │ │ Agents │ │ Events │ │Handoffs │ │Alerts ││ │
│  │  └───┬───┘ └───┬────┘ └───┬────┘ └────┬────┘ └───┬───┘│ │
│  │      └──────────┴─────────┴───────────┴───────────┘    │ │
│  │                    PostgreSQL                           │ │
│  └─────────────────────────────────────────────────────────┘ │
│                                                              │
│  ┌──────────────────────────────────────────────────────────┐│
│  │ AlertDetectionService (SolidQueue Background Watchdog)   ││
│  │ • Loop Detection  • Stuck Agent  • Budget Exceeded       ││
│  └──────────────────────────────────────────────────────────┘│
│                                                              │
│  ┌──────────────────────────────────────────────────────────┐│
│  │ ActionCable + Turbo Streams (Real-Time Broadcasting)     ││
│  └──────────────────────────────────────────────────────────┘│
└──────────────────────────────────────────────────────────────┘
         ▲                    ▲                    ▲
         │ HTTP Telemetry     │ HTTP Telemetry     │ MCP Protocol
         │                    │                    │
┌────────┴───────┐  ┌────────┴───────┐  ┌────────┴───────┐
│  Cedron Agent  │  │  Future Agent  │  │ MCP-Compatible │
│  (Port 3001)   │  │  (Port 300X)   │  │ AI Framework   │
└────────────────┘  └────────────────┘  └────────────────┘

Core Capabilities

Interactive Causal DAG

Dynamic SVG graph showing every agent as a clickable node and every delegation as a directional edge with Bézier curves. Click to inspect payloads, tokens, and latency.

Time-Travel Step Replayer

VCR-style scrubber to rewind, play, pause, and step through every event in execution history. Debug agent reasoning and identify hallucination drift.

Circuit Breakers & Kill-Switch

1-click Pause, Resume, and Emergency Kill-Switch controls. Automatically trips when loops or budget overruns are detected by the SRE watchdog.

Human-in-the-Loop Gates

Agents request human authorization before executing high-risk actions. The run pauses and displays an interactive approval banner with 1-click Authorize/Reject.

Proactive SRE Watchdogs

Background jobs monitor event streams in real-time and auto-trigger alerts for infinite loops, stuck agents, budget overruns, and unreliable models.

Real-Time Live Streaming

Built on ActionCable & Turbo Streams — timeline events, alerts, and agent states stream live to the dashboard without page refreshes.

Human-in-the-Loop Authorization Flow

For high-risk, irreversible, or costly actions, agents can request human permission before executing. This is critical for operations like deploying infrastructure, creating JIRA tickets, modifying databases, or executing financial transactions.

🛡️ Human Gate Required — Approval ID: appr_7a3f1c

Action Proposed: create_jira_ticket
Agent: gemini-2.5-flash
Description: "[PROD] Connection Pool Timeout — PostgreSQL max connections exceeded"
Risk Level: High

✅ Authorize & Proceed ❌ Reject Action
# Agent requests permission before a sensitive tool call POST /api/v1/approvals/request { "run_id": 1, "agent_name": "gemini-2.5-flash", "action_name": "create_jira_ticket", "description": "Creating ticket for connection pool timeout", "context": { "priority": "high", "risk_level": "high" } } # Control Tower pauses the run → Operator reviews → 1-click decision POST /api/v1/approvals/appr_7a3f1c/decide { "decision": "approved", "decided_by": "lead-sre@company.com" }

Automated SRE Watchdog Alerts

Background jobs (AlertDetectionJobAlertDetectionService) monitor event streams after every event and automatically detect anomalous patterns:

🔴 Critical

Loop Detected

Same handoff pair (A→B) repeats ≥3 times within 60 seconds. Auto-pauses the run.

🔴 Critical

Budget Exceeded

Cumulative run cost exceeds configurable threshold (default: $1.00). Trips circuit breaker.

🟡 Warning

Stuck Agent

Agent in active status with no events for >5 minutes. Possible deadlock.

🟡 Warning

Unreliable Agent

Same agent name has failed ≥3 times across runs in the last 24 hours.

# Alert de-duplication prevents flooding def create_alert_once(rule:, severity:, agent:, message:) existing = @run.alerts.unresolved.where( rule_triggered: rule, agent: agent ).exists? return if existing @run.alerts.create!(rule: rule, severity: severity, ...) end

MCP & REST API Surface

Agent Orchestrator exposes a FastMCP server at /mcp for native MCP-compatible AI frameworks (Claude Desktop, Cursor, Antigravity), plus a full REST API for any HTTP client:

MCP Tool Category Purpose
CreateRunTool Lifecycle Start a new tracking session
LogEventTool Telemetry Log event to the timeline
RecordHandoffTool Telemetry Record agent-to-agent delegation
UpdateAgentTool Telemetry Update agent tokens, cost, status
CompleteRunTool Lifecycle Finalize run with completed/failed state
GetRunStatusTool Self-Monitor Query current status & alerts
PauseRunTool Governance Circuit breaker pause
ResumeRunTool Governance Resume execution
AbortRunTool Governance Emergency kill-switch
RequestApprovalTool HITL Request human authorization
CheckApprovalTool HITL Poll authorization status

Live Integration: The Tool Wrapper Pattern

A major design challenge in AI agent observability is: How do you instrument agents without polluting tool business logic with telemetry boilerplate?

Agent Orchestrator leverages the Tool Wrapper Pattern (used in Cedron Agent). Instead of adding logging code to every tool individually, a single generic execution wrapper (trace_tool) intercepts all tool invocations, captures high-precision monotonic latency, records causal delegation handoffs, and transmits payload telemetry transparently.

1. Zero Code Pollution

Specialized tools (Calculate, GetWeather, Jira) contain 100% clean business logic with zero direct HTTP or telemetry dependencies.

2. Monotonic Latency Tracking

Measures execution time at millisecond precision using monotonic clock timestamps (immune to system clock drift).

3. 2-Way Governance Injection

Pre-execution checks verify run status with the Control Tower before invoking expensive or sensitive downstream APIs.

# The Tool Wrapper Pattern — Single centralized telemetry method def self.trace_tool(tool_name, arguments) t0 = Process.clock_gettime(Process::CLOCK_MONOTONIC) # 1. Notify Control Tower: "LLM is delegating to this tool" (creates DAG edge) OrchestratorTelemetryService.log_tool_start( run_id: run_id, from_agent: model_name, tool_name: tool_name, arguments: arguments ) result = yield # 2. Execute the actual tool safely latency_ms = ((Process.clock_gettime(Process::CLOCK_MONOTONIC) - t0) * 1000).round # 3. Notify Control Tower: "Tool completed with output" (records return payload + latency) OrchestratorTelemetryService.log_tool_end( run_id: run_id, from_agent: model_name, tool_name: tool_name, result: result, latency_ms: latency_ms ) result end # Any tool simply wraps its execution — zero boilerplate inside the tool itself: class Calculate < RubyLLM::Tool def execute(expression:) LlmAgentService.trace_tool("CalculateTool", { expression: expression }) do CalculateTool.new.execute(expression: expression) end end end

Live Telemetry Results: Real chat sessions were executed through Cedron Agent across 6 tools and streamed live into Agent Orchestrator without any UI blocking:

User Prompt Tools Called Agents Events Handoffs Tokens
"hi" None 1 2 0 6
"What is 4528 × 391?" CalculateTool 2 6 2 27
"Weather in Chennai?" GetWeatherTool 2 6 2 89
"Analyze production logs" AnalyzeLogTool 2 6 2 412

Performance & Business Impact

Metric Before (No Orchestration) With Control Tower Impact
Agent Visibility 0% (Black box) 100% (Every event logged) Full Observability
Loop Detection Time Until budget exhausted <60 seconds (automated) >99% Faster
Rogue Agent Kill Time Manual SSH + process kill 1 click (Kill-Switch) Instant
Unauthorized Actions No prevention HITL gates block high-risk actions 100% Gated
Cost Tracking Monthly invoice Per-run, per-agent, per-tool Granular
Post-Incident Debug Reproduce from scratch Time-travel replay Instant Replay

Need governance for your AI agent workflows?

Cedron Technologies architects multi-agent observability platforms, Model Context Protocol integrations, and enterprise AI governance systems for autonomous agent workflows.

Schedule an Engineering Briefing