Inferensys

Prompt

Agent Role Failure Mode Analysis Prompt

A practical prompt playbook for using Agent Role Failure Mode Analysis Prompt in production AI workflows.
Operations team reviewing AI workflow automation on laptop, workflow builder visible, casual office setup.
PROMPT PLAYBOOK

When to Use This Prompt

Define the job, the reader, and the constraints for systematically analyzing agent role failures.

This prompt is for reliability engineers, platform architects, and SRE teams who need to move beyond ad-hoc debugging and systematically identify how a specific agent role can fail in production. The job-to-be-done is producing a structured failure mode catalog—complete with severity ratings, blast radius estimates, and compensating controls—before those failures cause multi-agent coordination breakdowns. You should use this when you are designing a new agent role, auditing an existing one, or preparing for a failure injection testing campaign. The ideal user has access to the agent's role definition, capability boundary contract, tool access policy, and any existing incident reports.

Do not use this prompt when you need a real-time incident response playbook or a postmortem of a specific event. It is a proactive analysis tool, not a reactive one. It also assumes you already have a well-scoped agent role definition; if you are still drafting the role's purpose and boundaries, start with the Agent Role Definition Prompt Template or the Agent Capability Boundary Contract Prompt instead. The output is a planning artifact that feeds into test case generation and orchestration policy, not a runtime decision engine.

The prompt requires you to provide the agent's role contract, its declared capabilities and exclusions, its tool access manifest, and any known constraints or past incidents. The model will produce a table of failure modes, each with a severity score, detection mechanism, and suggested control. You should then review this output with domain experts, prioritize the high-severity items, and convert them into concrete failure injection tests using the scenarios the prompt generates. Never treat the model's severity ratings as final; validate them against your actual system's blast radius and business impact.

PRACTICAL GUARDRAILS

Use Case Fit

Where this prompt works, where it fails, and what you must have in place before running it.

01

Good Fit: Pre-Deployment Agent Review

Use when: you have a defined agent role contract and need a systematic failure mode catalog before production. Guardrail: run this prompt against every new agent role before it enters staging. The output becomes a test plan, not a one-time readout.

02

Good Fit: Multi-Agent System Audit

Use when: you operate multiple interacting agents and need to understand cascading failure blast radius. Guardrail: feed the prompt one agent role at a time, then cross-reference failure catalogs to find shared failure surfaces.

03

Bad Fit: Undefined or Vague Agent Roles

Avoid when: the agent role lacks a written scope, capability boundary, or tool access policy. Guardrail: the prompt requires a concrete role contract as input. Without it, the model hallucinates plausible but irrelevant failure modes.

04

Bad Fit: Real-Time Runtime Decision-Making

Avoid when: you need an agent to self-diagnose failures during live execution. Guardrail: this prompt is an offline analysis tool. Runtime failure detection requires separate guard prompts, confidence checks, and escalation logic wired into the agent harness.

05

Required Input: Complete Agent Role Contract

Must have: a structured role definition including scope, capabilities, tool access, stop conditions, input/output contracts, and escalation paths. Guardrail: if any of these are missing, run the Agent Role Definition Prompt Template or Capability Boundary Contract Prompt first.

06

Operational Risk: Over-Reliance on Model Judgment

Risk: the model may miss failure modes that require domain-specific operational knowledge or rate severity incorrectly. Guardrail: treat the output as a starting point for human review. Pair with an SRE or domain expert who validates severity ratings and adds infrastructure-level failure modes the model cannot see.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for systematically analyzing how an agent role can fail, with placeholders for role definition, context, and output schema.

This template is designed to be copied directly into your prompt library or orchestration harness. It expects a structured agent role definition as input and produces a failure mode catalog with severity ratings, detection mechanisms, and compensating controls. The square-bracket placeholders let you swap in your own role contracts, risk thresholds, and output format requirements without rewriting the analysis logic.

text
You are a reliability engineer analyzing an agent role for failure modes. Your task is to produce a structured failure mode catalog.

## AGENT ROLE DEFINITION
[ROLE_DEFINITION]

## CONTEXT
- System architecture: [SYSTEM_CONTEXT]
- Sibling agents and their responsibilities: [SIBLING_AGENTS]
- Tool access and capabilities: [TOOL_MANIFEST]
- Operational constraints: [CONSTRAINTS]

## INSTRUCTIONS
For the agent role described above, identify potential failure modes across these categories:
1. **Input failures**: malformed, missing, or adversarial inputs the agent might receive.
2. **Decision failures**: incorrect reasoning, ambiguity handling, or policy misinterpretation.
3. **Tool failures**: tool unavailability, malformed tool outputs, or tool misuse.
4. **Boundary failures**: the agent acting outside its scope, refusing valid requests, or failing to escalate.
5. **Interaction failures**: handoff corruption, context loss, or conflicting actions with sibling agents.
6. **Output failures**: malformed outputs, hallucinated claims, or missing required fields.

For each failure mode, provide:
- **Failure ID**: a short unique identifier (e.g., FM-ROLE-001).
- **Description**: what happens when this failure occurs.
- **Trigger conditions**: what causes this failure.
- **Blast radius**: what downstream systems, agents, or users are affected.
- **Severity**: CRITICAL, HIGH, MEDIUM, or LOW based on blast radius and recoverability.
- **Detection mechanism**: how this failure would be observed in logs, metrics, or outputs.
- **Compensating control**: what mitigation, fallback, or guardrail exists or should exist.
- **Failure injection test scenario**: a concrete test case that could trigger this failure in a controlled environment.

## OUTPUT SCHEMA
Return a JSON object with this exact structure:
{
  "agent_role": "string",
  "analysis_date": "string (ISO 8601)",
  "failure_modes": [
    {
      "failure_id": "string",
      "category": "input | decision | tool | boundary | interaction | output",
      "description": "string",
      "trigger_conditions": ["string"],
      "blast_radius": {
        "affected_systems": ["string"],
        "affected_agents": ["string"],
        "user_impact": "string"
      },
      "severity": "CRITICAL | HIGH | MEDIUM | LOW",
      "detection_mechanism": "string",
      "compensating_control": "string",
      "failure_injection_test": "string"
    }
  ],
  "coverage_gaps": ["string (areas not covered by current controls)"],
  "recommended_priorities": ["string (top actions to address first)"]
}

## CONSTRAINTS
- Do not invent failure modes that are impossible given the role definition and system context.
- If a category has no plausible failure modes, include an empty array for that category and note why in coverage_gaps.
- Severity ratings must be justified by blast radius, not speculation.
- Every failure injection test must be executable in a test environment without breaking production.
- If the role definition is incomplete or ambiguous, flag what is missing in coverage_gaps rather than guessing.

To adapt this template, replace each placeholder with your actual artifacts. [ROLE_DEFINITION] should be the full structured role contract from your agent registry. [SYSTEM_CONTEXT] should describe the multi-agent architecture, message bus, and shared state. [SIBLING_AGENTS] should list other agents with their responsibilities to detect interaction failures. [TOOL_MANIFEST] should include every tool the agent can call, its expected inputs and outputs, and its failure modes. [CONSTRAINTS] should capture rate limits, latency budgets, and security boundaries. If you are using this prompt inside an automated pipeline, wire the output JSON into a validation step that checks for duplicate failure IDs, missing severity justifications, and injection tests that reference unavailable test infrastructure.

Before shipping this prompt into a production reliability workflow, run it against at least three distinct agent roles and review the output for consistency. Common failure modes of this prompt itself include: producing vague detection mechanisms like "monitor logs" without specifying which logs or what patterns; assigning CRITICAL severity to low-impact failures because the blast radius description was too broad; and generating injection tests that require production access. Add a human review step for any failure mode rated CRITICAL or HIGH before accepting the catalog into your risk register.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Agent Role Failure Mode Analysis Prompt. Each placeholder must be populated before execution to produce a reliable failure mode catalog.

PlaceholderPurposeExampleValidation Notes

[AGENT_ROLE_DEFINITION]

Complete role contract including identity, purpose, scope, authority, and stop conditions

Customer Support Triage Agent: classifies inbound tickets, routes to L1/L2/L3, responds to FAQ, escalates billing disputes. Stop condition: suspected fraud.

Must contain explicit scope boundaries and stop conditions. Reject if only a role name or vague description is provided.

[AGENT_CAPABILITY_BOUNDARY]

Declared tool access, domain limits, and explicit exclusions the agent operates within

Tools: ticket_lookup, kb_search, escalate_to_human. Exclusions: cannot modify billing, cannot access PII beyond ticket metadata, cannot issue refunds.

Must list both allowed tools and explicit exclusions. Validate against [AGENT_ROLE_DEFINITION] for contradictions.

[AGENT_INPUT_CONTRACT]

Typed input schema with required fields, type constraints, and validation rules the agent expects

Input: {ticket_id: string, customer_intent: enum[FAQ|ISSUE|COMPLAINT|URGENT], priority: int 1-5, context_summary: string max 500 chars}

Schema must be parseable as valid JSON Schema or equivalent typed contract. Reject if fields lack type constraints.

[AGENT_OUTPUT_CONTRACT]

Typed output schema with status codes, error shapes, and quality guarantees the agent produces

Output: {classification: enum, routing_target: string, confidence: float 0-1, requires_escalation: bool, summary: string}

Must define success and error shapes. Validate that status codes cover all declared stop conditions from [AGENT_ROLE_DEFINITION].

[AGENT_TOOL_ACCESS_MANIFEST]

Per-tool constraints, confirmation requirements, rate limits, and revocation conditions

kb_search: rate_limit 10/min, requires_query_sanitization true. escalate_to_human: requires_confidence_below 0.7, confirmation_required true.

Each tool must have at least one constraint. Reject if tools from [AGENT_CAPABILITY_BOUNDARY] are missing from manifest.

[AGENT_PRECONDITIONS]

Executable preconditions that must be true before the agent runs

ticket_id exists and is not closed, customer_intent is not null, priority is between 1 and 5, context_summary is under 500 chars.

Each precondition must be testable as a boolean check. Reject if preconditions reference state not declared in [AGENT_INPUT_CONTRACT].

[AGENT_POSTCONDITIONS]

Guarantees the agent makes after successful completion

classification is a valid enum value, routing_target is a registered queue, confidence is between 0 and 1, output schema matches [AGENT_OUTPUT_CONTRACT].

Each postcondition must be verifiable against output. Reject if postconditions make claims about systems outside agent scope.

[SIBLING_AGENT_ROLES]

List of adjacent agent role definitions for overlap and conflict detection

Billing Dispute Agent: handles refund requests, payment investigations. Fraud Detection Agent: flags suspicious patterns, freezes accounts pending review.

Must include at least one sibling role for meaningful failure mode analysis. Validate that sibling roles have distinct scope boundaries from [AGENT_ROLE_DEFINITION].

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the failure mode analysis prompt into a reliability engineering workflow with validation, logging, and human review gates.

This prompt is designed to run as a batch analysis job, not a real-time user-facing call. You feed it a complete agent role definition (identity, scope, tools, authority, stop conditions) and receive a structured failure mode catalog. The output is intended for human review by reliability engineers before any failure injection tests are designed or compensating controls are implemented. Because the analysis covers production risk, the harness must treat the model's output as a draft for expert review, not as an operational artifact.

Integration pattern: Wrap the prompt in a job that accepts a role definition JSON payload and returns a failure mode catalog. Validate the output against the expected schema before storing it. Key validation checks include: every failure mode must have a non-empty severity field from the allowed enum, every detection_mechanism must reference an observable signal, and every compensating_control must be actionable. Reject or flag records that contain placeholder text, circular reasoning (e.g., 'detect by noticing the failure'), or severity ratings inconsistent with the described blast radius. Log all validation failures for the engineering team to review.

Model choice and retries: Use a model with strong reasoning capabilities (GPT-4o, Claude 3.5 Sonnet, or equivalent). Set temperature low (0.0–0.2) to reduce variance in severity ratings and control descriptions. If the output fails schema validation, retry once with the validation errors appended to the prompt as [PREVIOUS_ERRORS]. If the second attempt also fails, flag the role definition for manual analysis rather than looping indefinitely. Human review gate: Before any failure injection test is executed based on this catalog, a reliability engineer must sign off on severity ratings, blast radius assessments, and compensating control adequacy. The model can miss domain-specific failure interactions that only an experienced operator would recognize.

Tool use and RAG considerations: This prompt does not require tool calls or retrieval during execution. However, you should store the validated failure mode catalog in a searchable registry (e.g., a vector database or structured incident repository) so that future role definitions can be compared against known failure patterns. When analyzing a new agent role, retrieve similar roles and their failure catalogs as [PRIOR_FAILURE_EXAMPLES] to ground the analysis in historical findings. This turns the prompt from a one-shot analysis into a cumulative reliability knowledge base.

What to avoid: Do not feed this prompt partial or draft role definitions. Incomplete scope descriptions produce vague failure modes that waste review time. Do not skip the human review gate for high-severity findings. Do not treat the model's severity ratings as final—they are a starting point for engineering judgment. Finally, do not run this prompt in a user-facing product flow; it belongs in a pre-deployment reliability review pipeline with clear ownership and sign-off.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the structured output schema for the failure mode catalog. Use this contract to validate agent responses before ingestion into risk management or monitoring systems.

Field or ElementType or FormatRequiredValidation Rule

failure_mode_id

string (kebab-case)

Must match pattern ^FM-[A-Z]{2,4}-\d{3}$; unique within the catalog

failure_mode_title

string (max 120 chars)

Non-empty; must describe the failure in plain language; no markdown

agent_role

string

Must exactly match a role name from the [AGENT_ROLE_REGISTRY] input

severity

enum: CRITICAL, HIGH, MEDIUM, LOW

Must be one of the four allowed values; CRITICAL reserved for safety or data-loss failures

blast_radius

object

Must contain 'affected_agents' (array of strings), 'affected_systems' (array of strings), and 'data_exposure_risk' (enum: NONE, INTERNAL, EXTERNAL)

failure_trigger_conditions

array of strings (min 1, max 5)

Each string must be a concrete, testable condition; no hypotheticals without observable signals

detection_mechanism

object

Must contain 'primary_signal' (string), 'detection_latency' (string describing time-to-detect), and 'monitoring_source' (string: LOGS, METRICS, TRACES, USER_REPORT, AGENT_SELF_REPORT)

compensating_controls

array of objects

Each object must have 'control_type' (enum: PREVENTIVE, DETECTIVE, CORRECTIVE), 'description' (string), and 'automation_readiness' (enum: AUTOMATED, SEMI_AUTOMATED, MANUAL)

PRACTICAL GUARDRAILS

Common Failure Modes

Agent role failure mode analysis reveals predictable breakpoints in multi-agent systems. These cards cover the most common failure patterns, why they occur, and what to build before they reach production.

01

Boundary Creep and Scope Drift

What to watch: An agent gradually accepts tasks outside its defined role boundary because the prompt lacks explicit refusal language or the orchestrator routes incorrectly. Over time, the agent accumulates responsibilities that overlap with sibling agents, creating duplicated work and conflicting outputs. Guardrail: Embed hard stop conditions in the role prompt with explicit capability exclusions. Validate routing decisions against a labeled delegation test suite that includes out-of-scope requests designed to trigger refusal.

02

Silent Authority Escalation

What to watch: An agent takes high-risk actions without confirmation because its role prompt grants broad authority without tiered approval gates. This is especially dangerous when agents can modify production data, send external communications, or execute irreversible operations. Guardrail: Define authority tiers in the role contract with explicit confirmation requirements per action class. Implement tool-level approval checks that intercept dangerous calls before execution, regardless of what the agent prompt says.

03

Context Starvation at Handoff

What to watch: A receiving agent gets incomplete or malformed context from the handoff agent, leading to decisions based on partial information. Common causes include truncated summaries, missing user intent, dropped tool outputs, or schema mismatches between agents. Guardrail: Define a structured handoff schema with required fields, type constraints, and completeness checks. Validate every handoff payload against the schema before the receiving agent processes it. Log handoff failures for traceability.

04

Conflicting Outputs Across Agents

What to watch: Two agents produce incompatible answers to the same question because they operate from different context windows, use different reasoning paths, or have contradictory role instructions. Without arbitration, the system presents inconsistent results to users. Guardrail: Implement an arbitration step that compares outputs from agents with overlapping domains. Use confidence scores, evidence grounding checks, and explicit conflict resolution rules. When arbitration fails, escalate to a human reviewer with both outputs and the evidence each agent used.

05

Tool Invocation Without Validation

What to watch: An agent calls a tool with malformed arguments, calls the wrong tool for the task, or chains tool calls without checking intermediate results. The failure propagates silently through the agent graph because no validation gate exists between tool output and the next reasoning step. Guardrail: Add tool output validation at the orchestration layer, not just in the agent prompt. Check return codes, required fields, and expected value ranges before passing results to the next agent. Inject validation failure messages back into the agent context for self-correction.

06

Infinite Delegation Loops

What to watch: Agents recursively delegate tasks to each other without progress because role boundaries are circular, confidence thresholds are never met, or escalation paths loop back to the original agent. The system burns compute and eventually times out with no result. Guardrail: Set a maximum delegation depth per task and track the delegation chain. When depth is exceeded or a cycle is detected, force escalation to a human or a designated fallback agent. Log the full delegation trace for debugging role boundary definitions.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for evaluating the quality and completeness of a generated failure mode analysis before integrating it into a reliability review or agent deployment gate.

CriterionPass StandardFailure SignalTest Method

Failure Mode Completeness

Catalog covers at least one failure mode per agent capability declared in [AGENT_ROLE_CONTRACT]

Missing capabilities with zero associated failure modes

Cross-reference failure mode list against capability list from input contract; flag gaps

Severity Rating Consistency

Each failure mode has a severity rating (Low/Medium/High/Critical) with a documented rationale tied to blast radius or user harm

Severity assigned without rationale or inconsistent with defined blast radius description

Spot-check 3 failure modes; verify severity aligns with described impact and matches org severity definitions in [SEVERITY_DEFINITIONS]

Detection Mechanism Specificity

Every failure mode includes at least one concrete detection mechanism (log pattern, metric threshold, assertion, or human review trigger)

Detection field contains vague phrases like 'monitor logs' or 'check output' without specific signal

Parse detection field for each failure mode; reject entries without a measurable signal or explicit human review step

Compensating Control Actionability

Each failure mode lists a compensating control that a human or orchestration system can execute (rollback, circuit break, escalation, retry with different agent)

Control is purely aspirational ('improve prompt') or describes prevention rather than compensation

Review compensating control field; require an action verb and a target system or role; flag passive descriptions

Blast Radius Quantification

Blast radius describes affected systems, data, users, or downstream agents with enough specificity to assess containment

Blast radius is generic ('affects output') or fails to name downstream consumers

Check blast radius field for at least one named system, agent, or user-facing surface; flag entries with only internal effects described

Failure Injection Test Coverage

At least one test scenario per severity level Critical or High includes a concrete failure injection method (malformed input, tool timeout, conflicting context)

Test scenarios only describe happy-path verification or omit injection mechanism

Count test scenarios tagged Critical or High; verify each includes an injection method and expected detection trigger

Escalation Path Completeness

Failure modes rated Critical or High specify an escalation target (specific agent role, human team, or dead-letter queue)

Critical failure modes lack escalation target or reference a non-existent role

Parse escalation field for Critical and High severity entries; validate target matches a role in [AGENT_ROLE_REGISTRY] or explicit human team name

Output Schema Validity

Generated failure mode catalog conforms to [OUTPUT_SCHEMA] with all required fields present and correctly typed

Missing required fields, type mismatches, or extra fields that violate schema contract

Validate output against JSON Schema from [OUTPUT_SCHEMA]; reject on any required field missing or type error

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base prompt and a single agent role definition. Remove severity scoring and detection mechanism fields initially—focus on generating a raw list of failure modes. Use a lightweight output format like bulleted markdown instead of strict JSON schema.

code
Analyze the following agent role definition and list every way it could fail:

[AGENT_ROLE_DEFINITION]

For each failure mode, describe:
- What breaks
- Who or what is affected

Watch for

  • Overly broad failure modes that aren't actionable
  • Missing blast radius analysis
  • No distinction between internal failures and downstream impact
  • Model inventing failure modes not grounded in the role definition
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.