mech.app

The mech.app newsletter

Agentic AI, minus the noise.

Get practical field notes on AI agents, automation, developer tools and security delivered to your inbox.

No spam. Unsubscribe anytime.

AI Agents

Dual-Layer Agent Monitoring: AWS DevOps Agent and AgentCore Evaluations

How AWS separates quality drift detection from infrastructure debugging in multi-agent systems using continuous evals and autonomous investigation.

Source: aws.amazon.com
Dual-Layer Agent Monitoring: AWS DevOps Agent and AgentCore Evaluations

Multi-agent systems fail differently than microservices. Traditional APM tools capture latency, error rates, and throughput. They miss prompt drift, tool-selection errors, cross-agent state corruption, and emergent coordination bugs. AWS addresses this gap with a dual-layer monitoring pattern: AgentCore Evaluations for continuous quality scoring and DevOps Agent for autonomous infrastructure investigation.

The reference implementation is a four-agent airline reservation system. Each agent handles a distinct domain (flight search, booking, payment, customer service), and the system demonstrates how to instrument both quality degradation and infrastructure failures without conflating the two concerns.

The Monitoring Gap in Multi-Agent Systems

Single-agent systems fail when the model hallucinates, the prompt drifts, or a tool call returns malformed data. Multi-agent systems add coordination failures: agent A passes corrupted state to agent B, agent C makes a decision based on stale context from agent D, or the orchestrator routes a request to the wrong specialist.

Traditional observability stacks track:

  • Request latency
  • Error rates
  • Resource utilization
  • Trace spans

They do not track:

  • Task completion quality
  • Inter-agent handoff correctness
  • Prompt effectiveness over time
  • Tool selection accuracy

AWS splits these concerns into two layers. AgentCore Evaluations runs continuous quality checks. DevOps Agent investigates infrastructure and configuration issues autonomously.

AgentCore Evaluations: Continuous Quality Scoring

AgentCore Evaluations is a managed service that runs eval datasets against production agents on a schedule. You define test cases, expected outputs, and scoring functions. The service executes them without touching production traffic.

Eval Dataset Structure

Each eval case includes:

  • Input prompt or task description
  • Expected output or success criteria
  • Scoring function (exact match, semantic similarity, custom logic)
  • Agent identifier

For the airline system, evals cover:

  • Flight search accuracy (correct routes, dates, prices)
  • Booking completion (reservation created, payment processed, confirmation sent)
  • Customer service response quality (relevant answers, correct policy citations)
  • Cross-agent handoffs (state passed correctly between agents)

Instrumentation Pattern

AgentCore Evaluations runs outside the production request path. It does not add latency or error risk to live traffic. The service:

  1. Schedules eval runs (hourly, daily, or triggered by deployment)
  2. Invokes agents with test inputs
  3. Compares outputs to expected results
  4. Publishes scores to CloudWatch Metrics
  5. Triggers alarms when scores drop below thresholds

This separates quality monitoring from infrastructure monitoring. A drop in eval scores indicates prompt drift, model degradation, or tool misconfiguration. A spike in error rates indicates infrastructure failure.

Scoring Functions

AWS provides built-in scorers:

  • Exact match
  • Semantic similarity (embedding distance)
  • JSON schema validation
  • Custom Lambda functions

For multi-agent coordination, custom scorers check state handoff correctness:

def score_handoff(agent_output, expected_state):
    """
    Validate that agent A passed correct state to agent B.
    """
    if "booking_id" not in agent_output:
        return 0.0
    
    if agent_output["booking_id"] != expected_state["booking_id"]:
        return 0.0
    
    if agent_output["passenger_count"] != expected_state["passenger_count"]:
        return 0.5  # Partial credit for correct ID but wrong count
    
    return 1.0

This catches coordination bugs that traditional tracing misses. A trace might show successful HTTP calls between agents, but the state passed was incorrect.

DevOps Agent: Autonomous Infrastructure Investigation

DevOps Agent is an autonomous agent that investigates infrastructure and configuration issues. It reads CloudWatch alarms, queries logs, inspects agent configurations, and proposes fixes. It does not auto-remediate by default (you can enable that), but it surfaces root causes faster than manual investigation.

Investigation Flow

When an alarm fires:

  1. DevOps Agent receives the alarm event
  2. Queries CloudWatch Logs for error patterns
  3. Inspects agent configuration (prompts, tool definitions, IAM roles)
  4. Checks recent deployments and configuration changes
  5. Correlates errors across agents
  6. Generates a root cause hypothesis
  7. Proposes remediation steps

For the airline system, a booking failure might trigger:

  • Log query: “Show me all booking agent errors in the last hour”
  • Configuration check: “Did the payment tool endpoint change?”
  • Cross-agent correlation: “Are flight search agents also failing?”
  • Hypothesis: “Payment service endpoint was updated but booking agent configuration was not”

Tool Access and Safety Boundaries

DevOps Agent has read access to:

  • CloudWatch Logs and Metrics
  • Agent configurations (Bedrock Agent definitions)
  • IAM role policies
  • Recent CloudFormation or CDK deployments

It has write access to:

  • Incident reports (stored in S3)
  • Remediation proposals (stored in DynamoDB)
  • Optional auto-remediation (disabled by default)

The safety boundary is explicit. DevOps Agent can read production state and propose fixes, but it cannot modify production configurations unless you enable auto-remediation and define allowed actions (restart agent, roll back deployment, update configuration parameter).

Example Investigation

A customer service agent starts returning incorrect policy information. DevOps Agent:

  1. Queries logs: “customer_service_agent errors last 2 hours”
  2. Finds pattern: “Policy document retrieval returning 404”
  3. Checks configuration: “Policy document S3 bucket changed from policies-prod to policies-prod-v2
  4. Checks recent deployments: “S3 bucket renamed 3 hours ago”
  5. Hypothesis: “Agent configuration still points to old bucket name”
  6. Proposal: “Update agent configuration to use policies-prod-v2

This investigation takes seconds instead of the 20 minutes a human would spend grepping logs and checking configurations.

Four-Agent Airline System Architecture

The reference implementation has four agents:

AgentResponsibilityToolsFailure Modes
Flight SearchQuery availability, prices, routesFlight API, cacheStale cache, API rate limits, incorrect date parsing
BookingCreate reservations, manage inventoryBooking API, inventory DBRace conditions, double-booking, state corruption
PaymentProcess transactions, handle refundsPayment gateway, fraud checkGateway timeouts, fraud false positives, currency conversion errors
Customer ServiceAnswer questions, handle complaintsPolicy DB, ticket systemOutdated policy docs, incorrect routing, context loss

Orchestration Layer

A coordinator agent routes requests to specialists. It maintains conversation context and handles multi-turn interactions. The coordinator:

  • Parses user intent
  • Selects the appropriate specialist agent
  • Passes context and state
  • Aggregates responses
  • Handles errors and retries

State Management

Each agent writes state to DynamoDB. The coordinator reads and aggregates state. This creates coordination failure opportunities:

  • Agent A writes state, agent B reads stale state
  • Agent A writes malformed state, agent B fails to parse
  • Coordinator loses context between turns

AgentCore Evaluations catches these with cross-agent test cases. DevOps Agent investigates when they happen in production.

Instrumentation Trade-offs

ApproachProsConsBest For
Inline evals (production traffic)Real user data, no synthetic gapsAdds latency, risk of eval logic bugs affecting usersLow-traffic systems, non-critical paths
Scheduled evals (AgentCore)No production impact, controlled test casesMisses edge cases from real trafficHigh-traffic systems, critical paths
Autonomous investigation (DevOps Agent)Fast root cause, reduces MTTRRequires careful permission boundariesComplex multi-agent systems
Manual investigationFull control, no automation riskSlow, error-prone, does not scaleSimple systems, rare incidents

The AWS pattern combines scheduled evals with autonomous investigation. This separates quality monitoring (did the agent do the right thing?) from infrastructure monitoring (did the system stay up?).

Deployment Shape

The monitoring stack runs alongside the agent system:

┌─────────────────────────────────────────┐
│ Production Agent System                 │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐   │
│ │ Flight  │ │ Booking │ │ Payment │   │
│ │ Agent   │ │ Agent   │ │ Agent   │   │
│ └────┬────┘ └────┬────┘ └────┬────┘   │
│      │           │           │         │
│      └───────────┴───────────┘         │
│                  │                     │
│           ┌──────▼──────┐              │
│           │ Coordinator │              │
│           └──────┬──────┘              │
└──────────────────┼──────────────────────┘

        ┌──────────┼──────────┐
        │          │          │
   ┌────▼────┐ ┌──▼───────┐ ┌▼─────────┐
   │CloudWatch│ │AgentCore │ │ DevOps   │
   │ Logs    │ │  Evals   │ │  Agent   │
   └─────────┘ └──────────┘ └──────────┘

AgentCore Evaluations runs on a schedule. DevOps Agent listens to CloudWatch alarms. Both are decoupled from production request paths.

Likely Failure Modes

Eval dataset drift: Test cases become outdated as agent behavior evolves. Evals pass but production quality drops. Mitigation: version eval datasets with agent deployments, review eval coverage quarterly.

Investigation permission creep: DevOps Agent gains too many write permissions, auto-remediation causes cascading failures. Mitigation: start with read-only, enable auto-remediation for specific, safe actions only (restart, rollback).

Alarm fatigue: Too many low-severity alarms trigger DevOps Agent investigations. Mitigation: tune alarm thresholds, use composite alarms, rate-limit investigations.

Cross-agent eval gaps: Evals test individual agents but miss coordination bugs. Mitigation: write end-to-end test cases that exercise full workflows across multiple agents.

DevOps Agent hallucination: Agent proposes incorrect root cause or dangerous remediation. Mitigation: require human approval for all remediations, log all investigations for audit.

Technical Verdict

Use this pattern when you have multiple agents coordinating on complex workflows and traditional APM tools are not catching quality degradation or coordination bugs. The dual-layer approach (quality evals + autonomous investigation) makes sense when:

  • You have more than two agents with inter-agent dependencies
  • Agent behavior changes frequently (prompt updates, model swaps, tool changes)
  • You need to detect quality drift before users complain
  • You want to reduce mean time to resolution for infrastructure issues

Avoid this pattern when:

  • You have a single agent with simple, deterministic tasks
  • Your agent behavior is stable and rarely changes
  • You have low traffic and can manually investigate all incidents
  • You do not have the operational maturity to manage autonomous investigation safely

The AWS implementation is opinionated: it assumes you are using Bedrock Agents, CloudWatch, and DynamoDB. If you are running agents on other platforms, you will need to adapt the instrumentation and investigation patterns, but the dual-layer concept (separate quality from infrastructure) applies universally.