Inferensys

Prompt

Agent Health Check Monitoring Prompt

A practical prompt playbook for platform operators evaluating agent readiness before routing work in production multi-agent systems.
Developer reviewing multi-agent chat interface on laptop, agent conversation logs visible, casual coding session at WeWork desk.
PROMPT PLAYBOOK

When to Use This Prompt

Define the pre-routing health check job, the required inputs, and the operational boundaries where this prompt adds value versus where it breaks.

This prompt is a programmatic pre-flight check for platform operators and SRE teams managing multi-agent systems. Its job is to produce a structured health assessment that an orchestrator can consume before routing work to a specific agent. You run this prompt when you need a machine-readable signal—availability status, degraded-capability flags, recent failure patterns, and a clear routing recommendation—to feed directly into a routing decision. The ideal user is an engineer wiring agent readiness checks into an orchestration loop, not someone building a dashboard for manual review.

To use this prompt effectively, you must provide recent agent execution logs, error counts, latency percentiles (p50, p95, p99), and a current capability declaration for the agent. The prompt assumes these inputs are available and reasonably fresh—stale data will produce misleading health signals. The output is a structured JSON block with fields like availability_status, degraded_capabilities, failure_pattern_summary, and routing_recommendation. You should validate this output against a schema before allowing the orchestrator to act on it. If the agent is marked degraded but the routing recommendation is route, flag the inconsistency for human review. This is a high-stakes decision point; a false-negative health signal can route critical work to a failing agent, while a false-positive can unnecessarily drain capacity from healthy agents.

Do not use this prompt for real-time sub-millisecond health checks. It is designed for pre-routing evaluation cycles measured in seconds, where the orchestrator can afford a model inference round-trip before committing to an agent. Do not use it as a replacement for metric-based threshold alerting or heartbeat monitoring—those belong in your observability stack. This prompt is the semantic layer that interprets raw telemetry into a routing decision, and it should be paired with deterministic circuit breakers that can override the model's recommendation if error rates exceed hard limits. If the agent's capability declaration changes frequently, ensure the prompt receives the latest version; stale capability data is a common failure mode that causes the model to recommend routing to an agent that no longer supports the required task.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Agent Health Check Monitoring Prompt delivers reliable routing intelligence and where it introduces operational risk.

01

Good Fit: Pre-Routing Readiness Gates

Use when: an orchestrator must decide whether to route work to an agent or select a fallback. The prompt produces a structured health assessment with availability status, degraded-capability flags, and routing recommendations. Guardrail: Always pair the health check output with a circuit breaker that enforces the routing decision in code, not in the prompt.

02

Good Fit: Degradation Detection Before User Impact

Use when: you need early warning of agent degradation from recent failure patterns, timeout spikes, or tool unavailability. The prompt surfaces degraded-capability flags before users experience failures. Guardrail: Run health checks on a regular heartbeat interval and log degradation state changes for postmortem correlation.

03

Bad Fit: Real-Time Latency-Sensitive Routing

Avoid when: routing decisions must happen in under 100ms. A model-based health check adds latency that may violate your orchestration SLA. Guardrail: Use a fast pre-check (metric threshold, heartbeat ping) for hot-path routing and reserve the prompt for periodic deep health assessment or cold-start evaluation.

04

Required Inputs: Agent Telemetry and Recent History

Risk: Without recent failure counts, tool availability status, and timeout history, the prompt hallucinates health signals or defaults to 'unknown.' Guardrail: Require structured telemetry input with explicit timestamps, failure codes, and tool names. Reject health assessments that lack grounding in actual telemetry data.

05

Operational Risk: Stale Health Signal Propagation

Risk: A health check that reports 'healthy' based on stale data can route traffic to a degraded agent, cascading failures downstream. Guardrail: Include a freshness timestamp in every health assessment output. Downstream orchestrators must reject assessments older than the configured TTL and request a fresh check.

06

Operational Risk: Overconfident Availability Claims

Risk: The model may report an agent as 'available' when tool dependencies are partially failing or when failure patterns are subtle. Guardrail: Require the prompt to output confidence scores per capability dimension. Route only when confidence exceeds a tunable threshold; otherwise escalate to a human operator or fallback agent.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A ready-to-use prompt template for evaluating agent health before routing work, with placeholders for live monitoring data.

This prompt template is designed to be integrated directly into your agent orchestration health-check harness. It evaluates the readiness of a target agent by analyzing its recent telemetry, failure patterns, and current resource state. The output is a structured health assessment that your routing layer can consume to decide whether to forward work, hold tasks in a queue, or trigger a fallback agent. Replace every square-bracket placeholder with live data from your monitoring system before each evaluation cycle. The prompt enforces a strict JSON output contract to ensure machine-readability in automated decision pipelines.

text
You are an agent health evaluator for a multi-agent orchestration platform. Your job is to assess the readiness of a single agent before routing work to it. You must produce a structured health assessment based on the provided telemetry and failure data.

## Agent Identity
- Agent Name: [AGENT_NAME]
- Agent Role: [AGENT_ROLE]
- Agent Capabilities: [AGENT_CAPABILITIES]
- Current Uptime: [UPTIME_DURATION]

## Health Metrics
- Availability Status (last 5 minutes): [AVAILABILITY_STATUS]
- Average Response Latency (ms): [AVG_LATENCY_MS]
- Error Rate (last 15 minutes, percentage): [ERROR_RATE_PERCENT]
- Active Circuit Breaker State: [CIRCUIT_BREAKER_STATE]
- Pending Task Queue Depth: [QUEUE_DEPTH]

## Recent Failure Patterns
- Last 10 Failure Reasons (chronological): [FAILURE_REASONS_LIST]
- Failure Category Distribution (JSON): [FAILURE_CATEGORY_DISTRIBUTION]
- Time Since Last Successful Task Completion (seconds): [TIME_SINCE_LAST_SUCCESS]

## Degradation Flags
- Active Degradation Flags (list): [ACTIVE_DEGRADATION_FLAGS]
- Resource Pressure Indicators (CPU/Memory/Disk): [RESOURCE_PRESSURE]
- Dependency Health Status (JSON): [DEPENDENCY_HEALTH]

## Output Schema
Produce a JSON object with exactly this structure:
{
  "agent_name": "string",
  "evaluation_timestamp": "ISO 8601 UTC",
  "overall_readiness": "healthy|degraded|unavailable",
  "routing_recommendation": "route|hold|fallback|drain",
  "degraded_capabilities": ["capability_name"],
  "active_failure_patterns": [
    {
      "pattern": "string describing the recurring failure mode",
      "frequency": "count in evaluation window",
      "severity": "low|medium|high|critical"
    }
  ],
  "risk_assessment": {
    "immediate_failure_probability": "low|medium|high",
    "data_loss_risk": "low|medium|high",
    "cascading_failure_risk": "low|medium|high"
  },
  "recommended_cooldown_seconds": 0,
  "human_escalation_required": true,
  "escalation_reason": "string, required if human_escalation_required is true",
  "evidence_summary": "string summarizing the key signals that drove this assessment"
}

## Constraints
- If AVAILABILITY_STATUS is 'offline' or CIRCUIT_BREAKER_STATE is 'open', overall_readiness MUST be 'unavailable' and routing_recommendation MUST be 'fallback'.
- If ERROR_RATE_PERCENT exceeds 20% or QUEUE_DEPTH exceeds [QUEUE_DEPTH_THRESHOLD], overall_readiness MUST be at least 'degraded'.
- If any ACTIVE_DEGRADATION_FLAGS include 'data_corruption_risk' or 'tool_auth_failure', human_escalation_required MUST be true.
- Never fabricate evidence. If the provided data is insufficient to make a determination, set overall_readiness to 'degraded', routing_recommendation to 'hold', and state the missing data in evidence_summary.
- recommended_cooldown_seconds must be 0 if overall_readiness is 'healthy'.
- Do not include any text outside the JSON object.

To adapt this template for your environment, start by mapping your existing monitoring metrics to the placeholders. The [FAILURE_CATEGORY_DISTRIBUTION] and [DEPENDENCY_HEALTH] placeholders expect pre-formatted JSON strings—ensure your monitoring pipeline serializes these before injection. The [QUEUE_DEPTH_THRESHOLD] inside the Constraints section should be replaced with your organization's specific SLO threshold. If your agent platform does not support circuit breakers, replace [CIRCUIT_BREAKER_STATE] with a static value of 'not_implemented' and adjust the constraint logic accordingly. Test this prompt against historical outage data to verify that the routing_recommendation field correctly triggers fallback or drain actions before a user-facing incident occurs.

IMPLEMENTATION TABLE

Prompt Variables

Each placeholder must be populated from your agent monitoring system before invoking this prompt. Missing or stale data will degrade the assessment confidence.

PlaceholderPurposeExampleValidation Notes

[AGENT_ID]

Unique identifier for the agent being assessed

agent-7f3a2b-invoice-processor

Must match an active agent in the registry; null or unknown ID triggers an immediate UNKNOWN status

[AGENT_ROLE]

Declared capability contract for this agent

Invoice data extraction and validation

Must be a non-empty string; compare against the agent registry to detect role drift or misconfiguration

[LAST_HEARTBEAT_UTC]

ISO-8601 timestamp of the last successful health ping

2025-01-15T14:32:00Z

Parse as datetime; if older than [STALENESS_THRESHOLD_SECONDS], flag as STALE; null allowed if agent has never checked in

[RECENT_FAILURE_COUNT]

Number of failures in the lookback window

3

Must be a non-negative integer; source from the error tracker for the window defined by [LOOKBACK_WINDOW_MINUTES]

[FAILURE_PATTERN]

Categorized failure modes from the lookback window

Timeout:2, ToolAuthError:1

Must be a structured map or list; empty string or null means no failures recorded; validate against known failure taxonomy

[DEGRADED_CAPABILITIES]

List of capabilities operating below threshold

["high-confidence-extraction"]

Must be a JSON array of capability slugs from the capability registry; empty array means no degradation detected

[ACTIVE_DEPENDENCIES]

Upstream agents or services this agent depends on

["document-preprocessor", "auth-service"]

Must be a JSON array of dependency IDs; cross-reference with dependency health status before scoring agent readiness

[LOOKBACK_WINDOW_MINUTES]

Time window in minutes for failure and degradation analysis

15

Must be a positive integer; values over 60 should trigger a warning about stale signal in fast-changing systems

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Agent Health Check Monitoring Prompt into an orchestration layer for continuous, automated routing decisions.

This prompt is not a one-off diagnostic tool; it is a scheduled component of an agent orchestration harness. It should run on a regular cadence—typically every 30 to 120 seconds—for each registered agent in the fleet. The output is a structured health record that feeds a live routing table, which the orchestrator queries before delegating work. The harness must treat the LLM's health assessment as a signal, not as ground truth, and should cross-reference it with objective metrics like heartbeat latency, tool-call success rate, and queue depth before updating the routing table.

To wire this into production, wrap the prompt in a function that accepts an agent_id and fetches the required [AGENT_METRICS] and [RECENT_FAILURE_LOG] from your observability stack (e.g., Prometheus, Datadog, or custom agent logs). The prompt's [OUTPUT_SCHEMA] must be enforced with a strict JSON schema validator. If the model's output fails validation, retry once with the validation error injected into the [CONSTRAINTS] field. After a second failure, mark the agent's health status as "unknown" and escalate to the on-call channel. The validated output is then merged into the routing table, where a separate circuit-breaker rule can override the LLM's recommendation based on hard thresholds (e.g., error rate > 20% forces "unavailable" regardless of the model's assessment).

Model choice matters here. Use a fast, low-cost model (e.g., GPT-4o-mini, Claude Haiku) because this prompt runs frequently and the reasoning task is narrow. Avoid models with high latency variance, as a slow health check is worse than a stale one. Log every health assessment with the model version, raw response, validation result, and final routing decision. This audit trail is critical for diagnosing cascading failures where a bad health signal caused the orchestrator to route work to a degraded agent. Never allow the LLM's health assessment to directly trigger agent restarts or infrastructure changes; always route such actions through a human-approved runbook or a pre-tested automation with a manual approval gate.

IMPLEMENTATION TABLE

Expected Output Contract

The model must return valid JSON matching this contract. Validate every field before the health assessment enters your routing decision path.

Field or ElementType or FormatRequiredValidation Rule

agent_id

string

Must match the [AGENT_REGISTRY] identifier exactly. Non-matching IDs cause a schema rejection.

availability_status

enum: available | degraded | unavailable

Must be one of the three allowed values. Any other string triggers a parse failure and retry.

degraded_capabilities

array of strings

If availability_status is degraded, this field must be present and non-empty. Each string must match a capability from [AGENT_CAPABILITY_LIST].

recent_failure_count

integer >= 0

Must be a non-negative integer. Null or negative values fail validation. Compare against [FAILURE_THRESHOLD] to trigger routing decisions.

last_failure_timestamp

ISO 8601 string or null

Must be a valid ISO 8601 datetime string or null. If recent_failure_count is 0, this field must be null.

routing_recommendation

enum: route | hold | decommission

Must be one of the three allowed values. route requires availability_status of available or degraded with acceptable capability loss.

health_score

number between 0.0 and 1.0

Must be a float within the inclusive range. Values outside this range cause a schema rejection. Score must be consistent with availability_status and recent_failure_count.

assessment_timestamp

ISO 8601 string

Must be the current UTC time in ISO 8601 format. Stale timestamps (older than [STALENESS_THRESHOLD_SECONDS]) cause the assessment to be discarded.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when monitoring agent health in production and how to guard against it.

01

Stale Health Signals

What to watch: Health checks report 'healthy' based on cached or outdated data, masking a recent failure. Agents appear available but fail immediately when routed real work. Guardrail: Include a last_checked_at timestamp in every health assessment. Reject assessments older than a configurable TTL (e.g., 30 seconds). Require a fresh probe before routing critical work.

02

False-Negative Degradation Flags

What to watch: The prompt misses partial capability loss because it only checks binary up/down status. An agent reports healthy but silently fails on a specific tool, model, or dependency. Guardrail: Require capability-level checks, not just agent-level checks. The output schema must include a degraded_capabilities array. Validate that each registered capability is explicitly probed.

03

Routing Based on Incomplete Assessment

What to watch: The orchestrator routes work to an agent before the health check completes, or uses a partial assessment missing critical signals. Guardrail: The health check prompt must produce a routing_readiness field with values ready, degraded, or do_not_route. Orchestrator code must gate routing on this field and treat missing or null values as do_not_route.

04

Failure Pattern Amnesia

What to watch: The prompt assesses current health but ignores recent failure history. A flapping agent oscillates between healthy and unhealthy, causing cascading retries. Guardrail: Require recent_failure_count and failure_window_minutes as inputs. The prompt must flag agents exceeding a threshold (e.g., 3 failures in 5 minutes) as degraded even if the current probe passes.

05

Undetected Silent Dependency Failures

What to watch: The agent itself responds, but a downstream dependency (database, API, model endpoint) is failing silently. The health check doesn't trace through the full call path. Guardrail: The prompt must instruct the agent to perform an end-to-end smoke test: execute a lightweight representative task that exercises all critical dependencies. Report each dependency's status separately in a dependency_health map.

06

Health Check Prompt Injection

What to watch: An attacker or a compromised upstream agent injects instructions into the health check context, causing the monitoring agent to report false health status or execute unintended actions. Guardrail: The health check prompt must run in an isolated context with no access to user-supplied data. Use a strict system prompt that ignores all content outside the expected health probe schema. Validate output against a strict JSON schema before accepting.

IMPLEMENTATION TABLE

Evaluation Rubric

Test this prompt against known health scenarios before deploying to production. Each test case must pass before the prompt is considered ready for routing decisions.

CriterionPass StandardFailure SignalTest Method

Healthy Agent Detection

Agent returns healthy status when all health checks pass within latency threshold

Healthy agent incorrectly flagged as DEGRADED or UNAVAILABLE

Run prompt against a mock agent returning 200 OK with all checks green; assert status is HEALTHY and routing recommendation is ROUTE

Degraded Agent Flagging

Agent with one failing non-critical check is correctly marked DEGRADED with the specific capability flag set

Degraded agent marked as HEALTHY (false negative) or UNAVAILABLE (severity inflation)

Run prompt against a mock agent with a single non-critical check failure (e.g., tool latency high); assert status is DEGRADED and [DEGRADED_CAPABILITIES] list contains the correct flag

Unavailable Agent Detection

Agent with critical check failure or timeout is marked UNAVAILABLE with routing recommendation set to DO_NOT_ROUTE

Unavailable agent marked as HEALTHY or DEGRADED, allowing traffic to a broken agent

Run prompt against a mock agent returning 503 or critical check failure; assert status is UNAVAILABLE and routing recommendation is DO_NOT_ROUTE

Recent Failure Pattern Recognition

Prompt correctly identifies failure trend when 3+ consecutive failures appear in [RECENT_FAILURE_LOG]

Failure pattern missed; agent remains HEALTHY despite repeated failures in the log window

Provide [RECENT_FAILURE_LOG] with 4 consecutive timeout entries; assert status is DEGRADED or UNAVAILABLE and failure pattern is documented in [FAILURE_PATTERN] field

Routing Recommendation Accuracy

Routing recommendation matches status: ROUTE for HEALTHY, CONDITIONAL_ROUTE for DEGRADED, DO_NOT_ROUTE for UNAVAILABLE

Mismatch between status and routing recommendation (e.g., HEALTHY with DO_NOT_ROUTE)

Validate output contract across all test cases; assert [ROUTING_RECOMMENDATION] enum value is consistent with [STATUS] enum value per the output schema

Timestamp Freshness Validation

Prompt uses [LAST_HEALTH_CHECK_TIMESTAMP] to flag stale data when older than [STALENESS_THRESHOLD_SECONDS]

Stale health check data treated as current; agent routed based on outdated information

Provide [LAST_HEALTH_CHECK_TIMESTAMP] set to 600 seconds ago with [STALENESS_THRESHOLD_SECONDS] set to 300; assert [DATA_FRESHNESS] is STALE and status is DEGRADED or UNAVAILABLE

Empty Failure Log Handling

Prompt returns HEALTHY when [RECENT_FAILURE_LOG] is empty and all checks pass

Empty log causes null-pointer behavior, hallucinated failures, or incorrect DEGRADED status

Provide [RECENT_FAILURE_LOG] as an empty array with all checks passing; assert status is HEALTHY and no failure patterns are reported

Malformed Health Check Response

Prompt returns UNAVAILABLE with parse error documented when [HEALTH_CHECK_PAYLOAD] is invalid JSON or missing required fields

Malformed payload causes hallucinated health status or unhandled error propagation

Provide [HEALTH_CHECK_PAYLOAD] as malformed JSON or missing the required status field; assert status is UNAVAILABLE and [PARSE_ERROR] field is populated with the specific parsing failure

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Add strict JSON schema validation, retry logic with exponential backoff, structured logging for every health check execution, and a set of eval cases covering known failure modes. Wire the output into a routing controller that acts on the routing_recommendation field. Add a [PREVIOUS_HEALTH_STATE] variable so the model can detect state transitions (healthy→degraded, degraded→unavailable).

json
{
  "system": "You are an agent health monitor. Output ONLY valid JSON matching the schema. Do not hallucinate metrics.",
  "schema": {
    "agent_id": "string",
    "timestamp": "ISO8601",
    "availability_status": "healthy|degraded|unavailable",
    "degraded_capabilities": ["string"],
    "failure_patterns": [{"type": "string", "count": "int", "window_hours": "int"}],
    "routing_recommendation": "route|caution|avoid",
    "confidence": 0.0-1.0,
    "state_transition": "stable|degrading|recovering|null"
  },
  "retry": {"max_attempts": 3, "on_schema_failure": true}
}

Watch for

  • Silent format drift when model outputs valid JSON but wrong field types
  • Missing human review for avoid routing decisions that could block critical workflows
  • Stale [PREVIOUS_HEALTH_STATE] causing false state-transition alerts
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.