Inferensys

Prompt

Router Health Check Prompt Template

A practical prompt playbook for using Router Health Check Prompt Template in production AI workflows to assess routing latency, decision consistency, fallback rate, and error rate against health thresholds.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

A practical guide for AI operations teams and platform engineers to run periodic, batch-based health assessments of a model router using production trace samples.

This prompt is designed for AI operations teams and platform engineers who need to run periodic health assessments of a model router using production trace samples. The router is the decision layer that selects which model handles each request. When routing degrades, costs rise, latency spikes, and user experience suffers. This prompt evaluates a batch of production traces against defined health thresholds for latency, decision consistency, fallback rate, and error rate. Use it to produce a structured health status report suitable for dashboard integration, alerting pipelines, and operational reviews.

This is not a real-time monitoring query. It is a batch assessment tool for scheduled health checks, post-deployment validation, and incident follow-up. Before using this prompt, you must have access to a representative batch of production traces that include routing metadata such as the selected model, fallback activations, per-step latency, and error codes. The prompt expects these traces to be provided as structured input, along with your organization's specific health thresholds for each metric. Without this context, the assessment will be generic and may miss critical signals. Do not use this prompt for real-time alerting, single-trace debugging, or as a substitute for a metrics dashboard. It is a diagnostic tool for periodic review, not a continuous monitoring system.

After running this prompt, you will receive a structured health status report that classifies the router's state as healthy, degraded, or critical for each dimension. The report includes specific trace IDs for anomalies, making it actionable for follow-up investigation. Wire the output into your operational dashboards or alerting pipelines, but always pair it with a human review step before taking automated action on routing configuration changes. The next step is to adapt the prompt template with your specific thresholds and trace schema, then integrate it into a scheduled evaluation harness.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Router Health Check Prompt works, where it fails, and what you must provide before running it.

01

Good Fit: Periodic SLO Audits

Use when: You run scheduled health assessments against production trace samples to verify routing latency, fallback rate, and error rate against defined SLO thresholds. Guardrail: Pin the health check to a fixed time window and a consistent trace sample size so trend comparisons remain valid across runs.

02

Good Fit: Pre- and Post-Change Validation

Use when: You need to compare router health metrics before and after a configuration change, model upgrade, or infrastructure migration. Guardrail: Run the prompt on both time windows with identical parameters and flag any metric shift that exceeds your statistical significance threshold.

03

Bad Fit: Real-Time Alerting

Avoid when: You need sub-second or streaming anomaly detection on live traffic. This prompt is designed for batch trace analysis, not inline decision-making. Guardrail: Pair this prompt with a streaming anomaly detector for real-time alerts; use the health check for periodic confirmation and trend reporting.

04

Bad Fit: Single-Trace Diagnosis

Avoid when: You are investigating one specific failed request. The health check prompt aggregates across traces and will miss individual anomalies. Guardrail: Route single-trace investigations to the Routing Decision Audit or Fallback Activation Root-Cause prompts instead.

05

Required Inputs

You must provide: A batch of production trace segments containing routing decisions, timestamps, model identifiers, latency measurements, fallback flags, and error codes. Guardrail: Validate that trace samples are complete and representative before running the health check; missing fields produce unreliable health scores.

06

Operational Risk: Threshold Drift

What to watch: Health thresholds that are too tight cause alert fatigue; thresholds that are too loose miss degradation. Guardrail: Recalibrate thresholds quarterly using historical trace data and review threshold sensitivity whenever traffic patterns or model mix change materially.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt for performing a periodic health assessment of a model router using production trace samples.

This prompt template is designed to be integrated into an automated observability pipeline. It ingests a batch of production trace segments and evaluates the router's performance against predefined health thresholds for latency, decision consistency, fallback rate, and error rate. The output is a structured health status report intended for dashboard consumption and automated alerting. Before using this template, ensure you have collected a representative sample of traces from your production monitoring system, including the original request context, the routing decision, and the outcome metadata.

text
You are an AI operations auditor performing a health check on a model routing system.

Your task is to analyze a batch of production trace samples and produce a structured health status report. Evaluate the router's performance against the provided thresholds.

# INPUT DATA

You will receive a JSON array of trace objects. Each object contains:
- trace_id: string
- timestamp: ISO 8601 string
- request_summary: string (the user's original request)
- routing_decision: object
  - selected_model: string
  - decision_latency_ms: integer
  - fallback_activated: boolean
  - fallback_reason: string or null
- outcome: object
  - status: "success" | "error" | "timeout"
  - total_latency_ms: integer
  - error_code: string or null

# HEALTH THRESHOLDS

Evaluate the batch against these thresholds:
- [LATENCY_THRESHOLD_MS]: Maximum acceptable decision latency in milliseconds.
- [FALLBACK_RATE_THRESHOLD]: Maximum acceptable fallback activation rate (0.0 to 1.0).
- [ERROR_RATE_THRESHOLD]: Maximum acceptable error rate (0.0 to 1.0).
- [CONSISTENCY_CHECK_ENABLED]: If true, check for decision consistency on semantically similar requests.

# OUTPUT SCHEMA

Return a single JSON object conforming to this schema:
{
  "report_id": "string",
  "assessment_timestamp": "ISO 8601 string",
  "batch_summary": {
    "total_traces": integer,
    "time_window_start": "ISO 8601 string",
    "time_window_end": "ISO 8601 string"
  },
  "health_checks": [
    {
      "check_name": "string",
      "status": "healthy" | "degraded" | "unhealthy",
      "observed_value": number,
      "threshold": number,
      "breaching_trace_ids": ["string"],
      "details": "string"
    }
  ],
  "overall_status": "healthy" | "degraded" | "unhealthy",
  "anomalies": [
    {
      "trace_id": "string",
      "anomaly_type": "string",
      "description": "string"
    }
  ],
  "recommendations": ["string"]
}

# CONSTRAINTS

- Base all findings strictly on the provided trace data. Do not invent or assume data.
- If a threshold is not breached, set status to "healthy".
- If a threshold is breached by less than 10%, set status to "degraded".
- If a threshold is breached by 10% or more, set status to "unhealthy".
- For the consistency check, group requests by semantic similarity and flag groups where different models were selected without a clear differentiating factor.
- If [CONSISTENCY_CHECK_ENABLED] is false, omit the consistency health check.
- The "details" field must contain a concise, data-driven explanation of the finding.

# INPUT DATA

[TRACE_BATCH]

To adapt this template for your environment, replace the square-bracket placeholders with production data. [TRACE_BATCH] should be populated with a JSON array of trace objects from your observability store. [LATENCY_THRESHOLD_MS], [FALLBACK_RATE_THRESHOLD], and [ERROR_RATE_THRESHOLD] should be set to your team's SLO values. The [CONSISTENCY_CHECK_ENABLED] boolean allows you to toggle a more expensive semantic analysis. The output schema is designed to be ingested directly by a monitoring dashboard or alerting system. If any check returns an "unhealthy" status, the overall_status should trigger an alert. Always validate the model's JSON output against the schema before posting it to a dashboard, and log the raw response for debugging.

IMPLEMENTATION TABLE

Prompt Variables

Inputs the Router Health Check Prompt needs to work reliably. Validate each before sending.

PlaceholderPurposeExampleValidation Notes

[TRACE_SAMPLE_BATCH]

Collection of production trace segments to analyze

JSON array of 100 trace objects from the last 24 hours

Must be a non-empty array. Each element must contain routing_decision, latency_ms, and fallback_activated fields. Reject if array length is 0 or missing required fields.

[HEALTH_THRESHOLDS]

Configurable thresholds that define healthy vs unhealthy routing behavior

{"max_fallback_rate_pct": 5, "max_p95_latency_ms": 2000, "max_error_rate_pct": 1, "min_decision_consistency_pct": 95}

Must be a valid JSON object with all four numeric fields present. Each value must be a positive number. Reject if any field is missing, negative, or non-numeric.

[TIME_WINDOW]

The production time range the trace sample covers

2025-01-15T00:00:00Z to 2025-01-15T23:59:59Z

Must be a valid ISO 8601 datetime range string. Start must precede end. Reject if unparseable or if window exceeds 7 days without explicit override.

[ROUTER_CONFIG_VERSION]

Identifier for the router configuration active during the trace window

router-config-v2.4.1

Must be a non-empty string matching the deployed config version. Validate against deployment registry. Reject if version string is empty or not found in known config versions.

[MODEL_CATALOG]

List of available models and their capability profiles during the trace window

JSON array with model IDs, capability tags, and cost tiers

Must be a non-empty array. Each entry must have model_id, capabilities, and cost_tier fields. Reject if catalog is empty or if any model referenced in traces is missing from catalog.

[ALERT_SEVERITY_MAP]

Mapping of health status levels to alert severity for downstream notification

{"healthy": "none", "degraded": "warning", "unhealthy": "critical"}

Must be a valid JSON object with exactly three keys: healthy, degraded, unhealthy. Values must be one of: none, warning, critical. Reject if keys are missing or values are invalid.

[DASHBOARD_OUTPUT_SCHEMA]

Expected structure for the health status report consumed by dashboards

JSON schema with status, metrics, alerts, and recommendations fields

Must be a valid JSON Schema object. Must include required fields: status, metrics, alerts, recommendations. Reject if schema is invalid or missing required fields.

[PREVIOUS_HEALTH_REPORT]

Prior health check report for trend comparison and degradation detection

JSON object from the previous run or null for first run

If provided, must match [DASHBOARD_OUTPUT_SCHEMA] structure. Allow null for initial baseline runs. Reject if provided but schema-incompatible with current output schema.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Router Health Check prompt into a scheduled observability pipeline with validation, retries, and alerting.

The Router Health Check prompt is designed to run as a periodic batch job, not a real-time per-request check. You feed it a representative sample of production traces from a fixed time window (e.g., the last 15 minutes) and receive a structured health report. The implementation harness must handle trace extraction, prompt assembly, response validation, and integration with your alerting and dashboarding systems. Treat the prompt output as a signal that can trigger an on-call page, not as a replacement for your metrics pipeline.

Wiring the workflow: 1) Trace extraction: Query your observability store (e.g., ClickHouse, Elasticsearch, Datadog) for routing events in the target window. Select a statistically meaningful sample—at least 200 traces, stratified by model if your router serves multiple models. 2) Prompt assembly: Inject the sampled traces into the [TRACE_SAMPLE] placeholder along with your [HEALTH_THRESHOLDS] (max acceptable fallback rate, p95 routing latency, error rate ceiling). 3) Model selection: Use a model with strong structured output capabilities and a context window large enough for your trace sample. GPT-4o or Claude 3.5 Sonnet are good defaults; avoid smaller models that may miscount or hallucinate statistics. 4) Validation: Parse the JSON output and validate that all required fields (overall_status, fallback_rate, routing_latency_p95, error_rate, decision_consistency_score, anomalies, recommendations) are present and within expected ranges. Reject reports where fallback_rate exceeds 1.0 or routing_latency_p95 is negative. 5) Retry logic: If validation fails, retry once with the same input. If the second attempt also fails, log the raw response and escalate to a human reviewer—do not silently discard a failed health check.

Alerting and dashboard integration: Map overall_status to your alerting severity: healthy clears any open router health alerts, degraded triggers a warning-level notification, and unhealthy fires a critical page. Push the numeric metrics (fallback_rate, routing_latency_p95, error_rate) to your time-series dashboard alongside your existing router metrics so you can correlate the LLM's assessment with your ground-truth instrumentation. What to avoid: Do not run this prompt on every trace—it is too expensive and slow for real-time routing decisions. Do not use the prompt output to automatically change router configuration; the health report informs a human or a gated deployment pipeline, it does not self-heal. If the prompt consistently reports unhealthy while your metrics dashboard shows normal operation, investigate whether your trace sample is biased or your thresholds are misconfigured before trusting the prompt output.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, format, and validation rules for the health status report produced by the Router Health Check Prompt Template. Use this contract to parse, validate, and integrate the output into dashboards or alerting systems.

Field or ElementType or FormatRequiredValidation Rule

report_id

string (UUID v4)

Must parse as valid UUID v4; reject if missing or malformed

generated_at

string (ISO 8601 UTC)

Must parse as valid ISO 8601 datetime with UTC offset; reject if in future beyond 5-minute clock skew tolerance

assessment_window

object { start: string, end: string }

Both start and end must be valid ISO 8601; end must be after start; window must not exceed 7 days

trace_sample_size

integer

Must be positive integer; must match count of trace_ids in trace_sample_ids array; warn if below configured minimum sample threshold

health_status

string enum

Must be one of: healthy, degraded, unhealthy; reject any other value

routing_latency_p50_ms

number

Must be non-negative float; must not exceed routing_latency_p99_ms; warn if exceeds configured latency threshold

routing_latency_p99_ms

number

Must be non-negative float; must be greater than or equal to routing_latency_p50_ms

decision_consistency_score

number (0.0 to 1.0)

Must be float between 0.0 and 1.0 inclusive; warn if below configured consistency threshold

fallback_rate

number (0.0 to 1.0)

Must be float between 0.0 and 1.0 inclusive; alert if exceeds configured fallback rate threshold

error_rate

number (0.0 to 1.0)

Must be float between 0.0 and 1.0 inclusive; alert if exceeds configured error rate threshold

threshold_violations

array of objects

Each object must contain metric_name (string), observed_value (number), threshold_value (number), and comparison_operator (string enum: gt, lt, gte, lte); may be empty array if no violations

trace_sample_ids

array of strings

Each element must be non-empty string; array length must equal trace_sample_size; duplicates allowed but should trigger warning

recommendations

array of strings

If present, each element must be non-empty string; null or empty array allowed when health_status is healthy

PRACTICAL GUARDRAILS

Common Failure Modes

Router health checks fail silently when trace data is sparse, thresholds are static, or the prompt confuses correlation with causation. These cards cover the most common failure patterns and how to prevent them before a health report reaches a dashboard.

01

Stale Thresholds Mask Degradation

What to watch: Health thresholds defined months ago no longer reflect current traffic patterns, model latency profiles, or business priorities. The prompt reports 'healthy' while users experience timeouts. Guardrail: Require threshold freshness metadata in every health check. If thresholds are older than the evaluation window, flag the report with a 'stale config' warning and suppress the green status.

02

Low Sample Volume Produces False Confidence

What to watch: The prompt evaluates a trace window with too few samples and reports high confidence on a statistically meaningless result. A 100% success rate on three requests is noise, not signal. Guardrail: Include a minimum sample size gate in the prompt instructions. If the trace count falls below the threshold, the output must set health status to 'INSUFFICIENT_DATA' and refuse to compute rates.

03

Correlation Reported as Root Cause

What to watch: The prompt observes that fallback spikes coincide with latency increases and declares latency as the cause. In reality, both are symptoms of an upstream model overload. Guardrail: Instruct the prompt to separate 'observed correlations' from 'confirmed root causes.' Require explicit evidence chains for any causal claim. When evidence is insufficient, the output must state 'correlation observed, root cause unconfirmed.'

04

Decision Consistency Drift Across Batches

What to watch: The same trace evaluated in two different health check runs produces different consistency scores because the prompt is sensitive to trace ordering or batch boundaries. Guardrail: Add a consistency check instruction: if the prompt evaluates decision consistency, it must use pairwise comparison within a fixed reference window, not batch-relative scoring. Include a 'consistency stability' field in the output schema.

05

Error Rate Aggregation Hides Skew

What to watch: A 2% aggregate error rate looks healthy, but one model in the pool has a 40% error rate masked by high volume from healthy models. Guardrail: Require per-model breakdowns in the health report schema. The prompt must flag any individual model exceeding the error threshold even when the aggregate passes. Include a 'max model error rate' field alongside the aggregate.

06

Fallback Rate Normalization to Wrong Baseline

What to watch: The prompt compares current fallback rates to a baseline window that included a known incident, making normal operations look like improvement and masking real regressions. Guardrail: Require baseline window specification in the prompt input. If the baseline window contains annotated incidents, the prompt must either exclude those periods or flag the comparison as 'baseline contaminated' with incident metadata.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for evaluating the Router Health Check output before integrating it into a dashboard or alerting pipeline. Each row defines a pass standard, a failure signal, and a concrete test method.

CriterionPass StandardFailure SignalTest Method

Health Status Field Validity

Output contains exactly one top-level health_status field with a value from the allowed enum: HEALTHY, DEGRADED, or UNHEALTHY.

Missing field, null value, or value outside the allowed enum.

Schema validation with enum check. Parse the JSON output and assert health_status is a non-null string in the allowed set.

Metric Threshold Compliance

Each metric in metric_checks has a status field that correctly reflects whether the observed value breached the configured threshold.

A metric with an observed value clearly above threshold is marked as OK, or a value below threshold is marked as BREACHED.

For each metric check, compare the observed_value against the threshold and comparison_operator fields. Assert status matches the expected outcome.

Fallback Rate Calculation Accuracy

The reported fallback_rate equals fallback_count divided by total_requests from the trace sample, expressed as a percentage rounded to one decimal place.

Reported rate differs from the calculated rate by more than 0.1 percentage points, or division by zero is unhandled.

Extract fallback_count and total_requests from the output. Compute the expected rate and assert it matches the fallback_rate field within a 0.1 tolerance.

Decision Consistency Score Range

The decision_consistency_score is a float between 0.0 and 1.0 inclusive.

Score is negative, greater than 1.0, or not a number.

Parse the score field and assert 0.0 <= score <= 1.0. Assert the value is a valid float, not a string.

Error Rate Context Completeness

If error_rate exceeds the threshold, the output includes a non-empty error_breakdown array with at least one error type and count.

Error rate is above threshold but error_breakdown is missing, null, or an empty array.

Conditional check: if error_rate > error_threshold, assert error_breakdown is an array with length > 0 and each entry has error_type and count fields.

Latency Percentile Reporting

The latency_percentiles object contains at minimum p50, p95, and p99 keys with numeric millisecond values.

Missing any required percentile key, or values are non-numeric or negative.

Assert the latency_percentiles object has keys p50, p95, p99. Assert each value is a number >= 0.

Recommendation Actionability

When health_status is DEGRADED or UNHEALTHY, the recommendations array contains at least one entry with a non-empty action and rationale field.

Status is not HEALTHY but recommendations array is empty, or entries have blank action or rationale strings.

Conditional check: if health_status is not HEALTHY, assert recommendations is an array with length > 0. For each entry, assert action and rationale are non-empty strings.

Trace Sample Window Reference

Output includes a sample_window object with start_timestamp and end_timestamp in ISO 8601 format, matching the input trace batch.

Timestamps are missing, malformed, or outside the range of the provided trace data.

Parse start_timestamp and end_timestamp as ISO 8601. Assert they are valid dates and start_timestamp <= end_timestamp. Verify they fall within the input trace batch time range.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Add strict JSON output schema with fields for overall_status, metric_breakdown, anomaly_flags, and recommended_actions. Wire [HEALTH_THRESHOLDS] from your observability config. Include retry logic for malformed outputs and log every health check result with a trace correlation ID. Add eval cases that compare the prompt's health classification against known-good and known-bad trace windows.

Watch for

  • Silent format drift when the model changes JSON field names
  • Thresholds becoming stale as traffic patterns shift
  • The prompt missing fallback rate spikes because it only looks at averages
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.