Inferensys

Prompt

Error Severity Scoring Prompt for Agent Steps

A practical prompt playbook for using the Error Severity Scoring Prompt for Agent Steps in production AI workflows to achieve consistent, calibrated severity scores across heterogeneous agent failures.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Define the job, reader, and constraints for a severity scoring prompt that brings consistent calibration to heterogeneous agent failures.

This prompt is for monitoring systems and agent orchestrators that must assign a consistent severity level to step failures. It is designed for operational dashboards, alerting pipelines, and post-execution analysis where heterogeneous errors from different tools, APIs, and models need a single, calibrated scoring method. Use it when you need to prioritize on-call response, trigger specific recovery workflows, or generate incident reports from agent execution traces. The prompt ingests a structured failure record—including the error message, the step's role in the overall plan, and any available downstream dependency information—and outputs a severity level (critical, high, medium, or low) with a blast radius estimate, data loss risk, and an impact assessment on subsequent steps.

Do not use this prompt for real-time step-level recovery decisions. It is an analytical scoring tool, not a retry or skip decision engine. If you wire this prompt directly into an agent's execution loop to decide whether to abort a workflow, you will introduce latency and a point of failure that is better served by a deterministic rule engine. Instead, use this prompt in offline or nearline analysis paths: post-execution trace review, batch incident report generation, or as a signal into a monitoring system that aggregates severity scores across many agent runs. The prompt assumes you have already classified the failure type (transient, permanent, permission, etc.) using a separate classification step. Pair it with the Agent Step Failure Classification Prompt Template to ensure the input to this scorer is well-structured.

The primary risk with severity scoring prompts is severity inflation, where the model overestimates the impact of a failure to appear cautious. To mitigate this, you must calibrate the prompt with clear definitions for each severity level, provide few-shot examples that demonstrate appropriate restraint, and run inter-rater consistency evals comparing model-assigned scores against a golden set of failures scored by your operations team. A secondary risk is context blindness, where the model fails to account for the blast radius because it doesn't understand your specific system architecture. Always include a concise dependency map in the [CONTEXT] field showing which downstream steps or services are affected by the failing step. Start with a human-reviewed calibration set of 20-30 failures before trusting this prompt in an automated pipeline.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Error Severity Scoring Prompt delivers consistent value and where it introduces operational risk.

01

Good Fit: Monitoring Heterogeneous Agent Fleets

Use when: you operate multiple agent types (RAG, coding, browser) and need a single severity taxonomy for centralized alerting. Guardrail: lock the severity taxonomy in the prompt schema and never let individual agent developers redefine levels.

02

Bad Fit: Real-Time Step Execution Decisions

Avoid when: the agent runtime needs a binary retry/skip decision in under 200ms. Severity scoring adds latency and reasoning overhead. Guardrail: use a lightweight classification prompt for inline decisions and reserve severity scoring for the observability sidecar or post-execution analysis path.

03

Required Inputs: Structured Failure Context

What to watch: the prompt cannot produce consistent scores from raw stack traces alone. Guardrail: always provide the agent step type, intended outcome, actual error message, retry count, and downstream dependency list. Missing fields cause severity inflation or underestimation.

04

Operational Risk: Severity Inflation Under Load

What to watch: when many steps fail simultaneously, the model may escalate every failure to critical, overwhelming on-call responders. Guardrail: include a calibration example in the prompt showing a batch failure scenario with correct medium severity assignments, and run periodic inter-rater consistency evals against a golden set.

05

Operational Risk: Blast Radius Overestimation

What to watch: the model may assume all downstream steps will fail when a single prerequisite step fails, inflating the blast radius estimate. Guardrail: require the prompt to list specific downstream steps by ID and mark each as blocked, at-risk, or unaffected, rather than accepting a single aggregate blast radius score.

06

Integration Pattern: Sidecar Scoring Service

What to watch: embedding severity scoring inside the agent execution loop couples observability to runtime availability. Guardrail: deploy the scoring prompt as an async sidecar that consumes execution logs and publishes severity events to your monitoring stack. This keeps agent latency predictable and allows scoring to use a slower, more thorough model.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template that instructs the model to score the severity of an agent step failure and return a strict JSON object.

This prompt template is the core instruction set for your severity scoring system. It is designed to be pasted directly into your monitoring harness or evaluation pipeline. The model is forced to reason about the failure's blast radius, data loss risk, and downstream impact before committing to a severity level, which prevents the common failure mode of severity inflation for transient errors.

text
You are an agent reliability scorer. Your task is to analyze a failed agent step and assign a consistent severity level.

## INPUT
[AGENT_STEP_FAILURE_RECORD]

## CONTEXT
[AGENT_PLAN_CONTEXT]

## INSTRUCTIONS
1. Analyze the failure record against the provided plan context.
2. Determine the severity level based on the following criteria:
   - **critical**: The failure makes the entire plan unrecoverable, causes irreversible side effects, or risks significant data loss.
   - **high**: A core plan objective is now unachievable, or the failure blocks multiple downstream critical steps.
   - **medium**: The step can be skipped or replaced with a fallback without breaking core objectives, but it requires a plan modification.
   - **low**: The failure is transient, has no downstream impact, or can be resolved by a simple retry without plan changes.
3. Estimate the blast radius: the number of downstream steps directly impacted.
4. Assess data loss risk as `none`, `possible`, or `confirmed`.
5. Identify the specific downstream step IDs from the plan context that are now blocked or at risk.

## CONSTRAINTS
- Do not inflate severity for transient errors like timeouts or 429 rate limits unless retries are exhausted.
- A `critical` severity must be justified by irreversible harm, not just task importance.
- If the failure record is incomplete, note this in the `assessment_notes` field and score conservatively.

## OUTPUT_SCHEMA
You must return a single, valid JSON object with no additional text or markdown fences:
{
  "severity": "critical" | "high" | "medium" | "low",
  "blast_radius": <integer>,
  "data_loss_risk": "none" | "possible" | "confirmed",
  "impacted_step_ids": ["<string>", ...],
  "justification": "<concise, evidence-based reason for the score>",
  "assessment_notes": "<any caveats about incomplete data or low confidence>"
}

To adapt this template for your environment, replace the [AGENT_STEP_FAILURE_RECORD] placeholder with a structured object containing the error message, step ID, tool name, and raw output. The [AGENT_PLAN_CONTEXT] should include the original plan's dependency graph and the status of all preceding steps. If your agent framework uses different severity labels, adjust the enum values in both the instructions and the OUTPUT_SCHEMA, but keep the decision criteria anchored to concrete, observable consequences rather than subjective importance. After pasting this into your harness, immediately run it against your golden set of historical failures to calibrate the scoring against your team's operational definitions.

IMPLEMENTATION TABLE

Prompt Variables

Inputs the prompt needs to work reliably. These must be populated from your agent execution context before calling the model.

PlaceholderPurposeExampleValidation Notes

[STEP_DESCRIPTION]

The natural-language description of the agent step that failed, including its intended outcome.

Call the create_invoice API with the validated billing payload.

Must be non-empty. Check that the description matches the step in the execution plan log.

[ERROR_PAYLOAD]

The raw error object or message returned by the tool, API, or runtime.

{"error": "TimeoutError", "message": "Request to payment gateway exceeded 30s", "code": 504}

Must be a valid JSON string or plain text. If null, the prompt should refuse to score and request the error payload.

[STEP_CONTEXT]

The relevant state before the step executed, including inputs, prior successful steps, and any accumulated data.

Step 3 of 7. Previously: user authenticated, cart validated. Cart total: $142.50.

Must include at least the immediate predecessor step's output. Truncate to 500 tokens to avoid context pollution.

[AGENT_ROLE]

A short label for the agent's function to calibrate severity relative to the system's purpose.

ecommerce_checkout_agent

Must match a known role in the agent registry. If unknown, default to 'general_agent' and flag for review.

[DOWNSTREAM_STEPS]

A list of the remaining steps in the plan that depend on the failed step's output.

["charge_payment", "send_confirmation_email", "update_inventory"]

Must be a valid JSON array of strings. If empty, set to an empty array and note that blast radius is limited to the current step.

[RETRY_COUNT]

The number of times this specific step has already been retried.

2

Must be an integer >= 0. If > 3, the prompt should automatically increase severity by one level.

[TOKEN_BUDGET_REMAINING]

The percentage of the total token budget remaining for the current agent session.

45

Must be an integer between 0 and 100. If < 10, the prompt should add a budget-exhaustion risk flag to the output.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Error Severity Scoring Prompt into a post-execution analysis pipeline or monitoring sidecar.

This prompt is not designed for real-time agent decision loops. It belongs in a post-execution analysis pipeline or a monitoring sidecar that observes agent traces asynchronously. The primary job is to produce consistent, structured severity scores across heterogeneous agent failures so that downstream alerting, reporting, and retrospective systems can operate on a normalized signal. Running this prompt in the hot path of an agent's error-recovery logic adds latency and token cost without improving the immediate recovery decision. Instead, call it after a step failure is logged, or batch it across multiple failures in a periodic analysis window.

Integration pattern: Wire the prompt as a consumer of your agent trace store. When a step execution record transitions to a failed or error terminal state, publish an event to a message queue or invoke a webhook. A lightweight worker—a cloud function, a background job, or a monitoring sidecar—pulls the failure record, assembles the prompt with the required [STEP_CONTEXT], [ERROR_PAYLOAD], and [DOWNSTREAM_DEPENDENCIES] placeholders, and calls the model. Validation layer: Before writing the output to your observability database, validate that severity is one of the allowed enum values (critical, high, medium, low), that blast_radius_estimate is a non-empty string, and that data_loss_risk is a boolean. Reject and log any response that fails schema validation; do not silently ingest malformed severity records. Retry logic: If the model call fails or returns invalid JSON, retry once with exponential backoff (1s, then 2s). After two failures, write a fallback record with severity: "unknown" and a validation_error note so the failure is still visible in your monitoring dashboards.

Model choice and cost control: Use a fast, cost-efficient model for this task—a lightweight instruction-tuned model or a small hosted model with JSON mode support. The prompt's output schema is flat and the reasoning required is classification, not generation. Avoid routing this to a large, expensive frontier model unless your severity decisions are demonstrably worse on smaller models and the cost difference is justified by alerting accuracy. Logging and audit: Store the full prompt, the model response, the validated severity record, and the trace ID of the original failure in a structured log. This audit trail is essential for calibrating severity thresholds over time and for debugging cases where a critical alert fired on a transient DNS blip. Human review gate: For any failure scored as critical, route the record to a human-review queue before triggering a pager alert. The model can inflate severity on novel failure patterns, and a quick human sanity check prevents 3 AM wake-ups for non-critical issues. After review, feed the corrected severity back into your eval dataset to improve future calibration.

IMPLEMENTATION TABLE

Expected Output Contract

The model must return a single JSON object conforming to this schema. Use this table to build a server-side validator before the output is consumed by downstream agent logic.

Field or ElementType or FormatRequiredValidation Rule

severity_level

enum: critical | high | medium | low

Must be exactly one of the four allowed values. Reject any other string or null.

confidence_score

number (0.0 to 1.0)

Must be a float between 0 and 1 inclusive. Reject if missing, non-numeric, or out of range.

blast_radius_estimate

string

Must be a non-empty string describing the scope of impact. Reject if empty, null, or whitespace-only.

data_loss_risk

enum: confirmed | probable | possible | none

Must be exactly one of the four allowed values. Reject any other string or null.

downstream_step_impact

array of strings

Must be an array. Each element must be a non-empty string naming an affected downstream step. Reject if not an array or if any element is empty.

retry_eligibility

boolean

Must be true or false. Reject if missing, null, or any other type.

rationale

string

Must be a non-empty string explaining the severity assignment. Reject if empty, null, or shorter than 20 characters.

PRACTICAL GUARDRAILS

Common Failure Modes

Severity scoring fails in predictable ways. Here's what breaks first and how to catch it before production.

01

Severity Inflation

What to watch: The model assigns 'critical' to every failure, making the score useless for triage. This happens when the prompt lacks clear anchors or when the model defaults to worst-case language. Guardrail: Provide 2-3 scored examples per severity level in the prompt. Add a calibration check: if more than 30% of scores are 'critical' in a batch, flag for human review.

02

Inconsistent Scoring Across Similar Failures

What to watch: Two identical timeout errors get different severity scores because the model interprets context inconsistently. This breaks any downstream automation that depends on stable severity thresholds. Guardrail: Run inter-rater consistency evals across 10-20 canonical failure examples. Require Cohen's kappa above 0.7 before shipping. Add a structured output schema that forces explicit blast-radius and data-loss fields before the final score.

03

Ignoring Downstream Step Impact

What to watch: The model scores based on the immediate error type (e.g., 'timeout') without considering whether the blocked step gates 10 downstream steps or just one optional logging call. Guardrail: Include a dependency graph summary in the prompt context. Require the model to list affected downstream steps explicitly in the output before assigning severity. Validate that critical steps with many dependents cannot receive 'low' severity.

04

Data Loss Risk Underestimation

What to watch: The model treats a write-failure as low severity because the error message looks transient, missing that uncommitted state will be lost if the agent proceeds. Guardrail: Add a mandatory 'data_loss_risk' field (none/partial/full) to the output schema. Cross-validate: any failure on a write or state-mutation step with 'partial' or 'full' data loss risk must be at least 'high' severity.

05

Context Window Truncation Silently Corrupting Scores

What to watch: Long agent traces push the failure context out of the context window. The model scores from incomplete information without signaling uncertainty. Guardrail: Place the failure context at the top of the prompt, not buried after long system instructions. Add a 'context_completeness' flag to the output that the model sets to 'partial' if it detects truncated input. Reject any score where context_completeness is 'partial'.

06

Model Confuses Severity with Urgency

What to watch: The model assigns high severity to a loud but non-blocking warning while giving medium severity to a silent state corruption that will cause failures three steps later. Severity and urgency are different axes. Guardrail: Separate 'severity' (impact on goal completion and data integrity) from 'urgency' (time-sensitivity of response) in the output schema. Train evaluators on the distinction. Use pairwise comparison evals that test severity vs. urgency confusion explicitly.

IMPLEMENTATION TABLE

Evaluation Rubric

Use these criteria to build an LLM-as-judge eval or a human review checklist for the Error Severity Scoring Prompt. Each row defines a pass standard, a failure signal, and a test method to ensure consistent, production-grade severity scoring.

CriterionPass StandardFailure SignalTest Method

Severity Level Assignment

Output matches one of the allowed enum values: critical, high, medium, or low.

Output is missing, null, or an unlisted severity string.

Schema validation: assert severity field is a non-null string within the allowed enum set.

Blast Radius Estimate

The blast_radius field describes the scope of impact (e.g., 'single step', 'full workflow') in concrete terms, not just a severity restatement.

Field is empty, contains only the severity level, or uses vague terms like 'big' or 'some'.

LLM-as-judge: prompt a judge model to check if the blast radius text is specific and distinct from the severity label.

Data Loss Risk Flag

The data_loss_risk field is a boolean (true or false) that accurately reflects whether the error could cause irreversible data loss.

Field is a string, null, or true for a transient timeout error with no side effects.

Unit test with curated examples: assert data_loss_risk is true for a 'disk full' error and false for a '503 Service Unavailable' error.

Downstream Step Impact

The downstream_step_impact array lists specific step IDs or names that are blocked or invalidated by this failure.

Array is empty when the error occurs in a critical path step, or contains fabricated step IDs.

Trace-based test: replay a known execution trace and verify the output array contains the correct downstream step IDs from the plan.

Inter-Rater Consistency

Two runs of the prompt with the same input produce the same severity level and a blast radius description with >90% semantic similarity.

Severity level flips between high and low on identical inputs, or blast radius descriptions contradict each other.

Statistical test: run the prompt 5 times on the same error log. Assert that the severity level is identical across all runs.

Severity Inflation Resistance

A transient, self-correctable error (e.g., a single network timeout with a successful retry) is scored as low.

A single timeout is scored as high or critical without evidence of data loss or workflow failure.

Golden dataset test: include a set of known low-severity errors and assert that >90% are scored as low.

Justification Grounding

The justification field references specific evidence from the [ERROR_LOG] and [AGENT_STATE] inputs.

The justification is generic ('this seems bad'), hallucinates details not in the input, or is missing entirely.

LLM-as-judge: prompt a judge model to verify that every sentence in the justification is directly supported by the provided input context.

Output Schema Compliance

The output is valid JSON that strictly matches the [OUTPUT_SCHEMA] with all required fields present.

Output is missing the severity field, contains extra untyped fields, or is not parseable JSON.

Automated schema validation: parse the output with a JSON schema validator and assert zero errors.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base severity scoring prompt and a simple JSON schema. Use a single model call without retries or validation wrappers. Focus on getting consistent severity labels across 10–20 example failures before adding infrastructure.

Prompt modification

  • Remove strict enum constraints; accept free-text severity first, then map to [CRITICAL, HIGH, MEDIUM, LOW] in post-processing.
  • Drop blast-radius and downstream-impact fields until the core severity signal stabilizes.
  • Use a short system prompt: "You are a reliability engineer classifying agent step failures by severity."

Watch for

  • Severity inflation on timeout errors (every timeout becomes CRITICAL)
  • Inconsistent scoring between similar failure types
  • Missing rationale when severity is ambiguous
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.