Inferensys

Prompt

Agent Timeout Escalation Prompt

A practical prompt playbook for using Agent Timeout Escalation Prompt in production AI workflows.
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 job, the operator, and the operational boundaries for the Agent Timeout Escalation Prompt.

This prompt is designed for Site Reliability Engineers (SREs) and orchestration platform operators who need a programmatic, deterministic decision when a specialized agent in a multi-agent workflow exceeds its defined Service Level Agreement (SLA) threshold. The core job-to-be-done is not just detecting a timeout, but producing a structured escalation payload that assesses the partial work, estimates user impact, and routes the incident to the correct human or agentic escalation target. It replaces ad-hoc log diving and manual impact assessment with a consistent, machine-readable escalation record that can trigger downstream automation like pager alerts or workflow suspension.

Use this prompt when an agent's execution time breaches a pre-defined wall-clock or step-count limit, and you have access to the agent's execution trace, its original task definition, and the partial state it produced before timing out. The ideal user is an orchestration engineer integrating this into a workflow controller (e.g., a supervisor agent, a state machine, or a job queue) that catches the timeout exception and invokes this prompt as the immediate next step. Required context includes the agent's SLA contract, the raw task input, any intermediate outputs or tool-call logs, and a map of available escalation targets (e.g., a human on-call rotation, a fallback agent with reduced capabilities). Do not use this prompt for proactive health checks or latency prediction; it is a reactive escalation trigger, not a forecasting tool.

Avoid this prompt when the timeout is caused by a known, transient infrastructure blip that a simple retry with exponential backoff can resolve—this prompt adds decision latency and should be reserved for cases where retries are exhausted or prohibited by the SLA. It is also unsuitable for agents that do not produce any partial state, as the assessment of 'partial progress' becomes speculative. In high-severity incidents where the timeout itself indicates a cascading system failure, pair this prompt's output with a circuit-breaker activation prompt to prevent further damage. After generating the escalation decision, always log the full payload to your agent audit trail and ensure the escalation target receives a structured handoff, not just a raw alert.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Agent Timeout Escalation Prompt works and where it introduces new risks. This prompt is designed for SRE teams managing multi-agent pipelines with strict SLA thresholds.

01

Good Fit: SLA-Bound Agent Pipelines

Use when: An agent in a critical path has a hard timeout budget and exceeding it causes cascading delays or user-facing degradation. Guardrail: The prompt requires a pre-defined SLA threshold as input; do not use it without a concrete timeout value in milliseconds or seconds.

02

Good Fit: Partial Progress Is Recoverable

Use when: The timed-out agent has produced intermediate results that can be safely packaged and handed off. Guardrail: The prompt explicitly asks for a 'partial progress assessment' and marks incomplete work. Validate that the escalation target can consume this partial state.

03

Bad Fit: Non-Deterministic or Unbounded Work

Avoid when: The agent's task has no clear completion criteria or the timeout is used as a crude circuit breaker for an infinite loop. Guardrail: Pair this prompt with a separate liveness check. A timeout on an unbounded task produces a useless partial result and a false escalation.

04

Required Inputs

Required: Agent ID, SLA threshold, elapsed time, partial output payload, and a list of available escalation targets. Guardrail: If the partial output is empty or the elapsed time is under the SLA, the prompt should be bypassed entirely in the application layer to avoid hallucinated urgency.

05

Operational Risk: Urgency Inflation

What to watch: The model may overstate the user impact or severity to justify an escalation, especially if the input context uses alarming language. Guardrail: Constrain the output schema to a fixed set of severity levels (e.g., SEV1-SEV5) and validate against a rubric that penalizes unjustified SEV1 classifications.

06

Operational Risk: Escalation Target Hallucination

What to watch: The model invents an escalation target or routing key that does not exist in your system. Guardrail: Provide a strict enum of valid escalation targets in the prompt's [CONSTRAINTS] block and use a post-generation validator to reject any output not matching the allowed set.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for generating an escalation decision when an agent exceeds its SLA threshold.

This prompt template is designed to be injected into an orchestrator or supervisor agent when a worker agent has timed out. It forces a structured escalation decision instead of a silent failure or an ambiguous retry loop. The placeholders allow you to pipe in runtime context—such as the task description, elapsed time, and any partial output—so the model can assess user impact and recommend a specific escalation target.

code
You are an escalation controller for a multi-agent system. A worker agent has exceeded its SLA threshold and timed out. Your job is to produce a structured escalation decision based on the provided context. Do not retry the task. Do not fabricate results.

[TASK_DESCRIPTION]
[AGENT_ROLE]
[SLA_THRESHOLD_SECONDS]
[ELAPSED_TIME_SECONDS]
[PARTIAL_OUTPUT_IF_ANY]
[USER_IMPACT_CONTEXT]
[AVAILABLE_ESCALATION_TARGETS]
[CONSTRAINTS]

Generate a JSON escalation record with the following schema:
{
  "escalation_decision": "ESCALATE" | "ABORT" | "HOLD_FOR_HUMAN",
  "urgency": "P1_CRITICAL" | "P2_HIGH" | "P3_MODERATE" | "P4_LOW",
  "timeout_context": {
    "task": "<summary of what the agent was doing>",
    "sla_threshold_seconds": <number>,
    "elapsed_seconds": <number>,
    "overtime_seconds": <number>
  },
  "partial_progress_assessment": {
    "completion_estimate_percent": <0-100>,
    "usable_output_summary": "<what partial results can be salvaged, or null>",
    "data_loss_risk": "HIGH" | "MEDIUM" | "LOW" | "NONE"
  },
  "user_impact_estimate": {
    "affected_users_or_workflows": "<description>",
    "severity": "BLOCKING" | "DEGRADED" | "TRANSPARENT",
    "time_sensitivity": "IMMEDIATE" | "WITHIN_HOUR" | "WITHIN_DAY"
  },
  "recommended_escalation_target": {
    "target_type": "AGENT" | "HUMAN_TEAM" | "FALLBACK_WORKFLOW",
    "target_id": "<from AVAILABLE_ESCALATION_TARGETS>",
    "reason": "<why this target is appropriate>"
  },
  "handoff_package": {
    "context_for_target": "<concise summary of what the next handler needs to know>",
    "preserved_partial_output": "<the usable partial output, or null>",
    "outstanding_work_items": ["<list of remaining sub-tasks>"]
  },
  "do_not_retry": true
}

Rules:
- If PARTIAL_OUTPUT_IF_ANY is empty or null, set completion_estimate_percent to 0 and usable_output_summary to null.
- If the task is user-facing and blocking, urgency must be at least P2_HIGH.
- Never recommend retrying the same agent with the same input.
- If no escalation target fits, set escalation_decision to "HOLD_FOR_HUMAN" and target_type to "HUMAN_TEAM".

To adapt this template, replace each bracketed placeholder with data from your agent runtime. [TASK_DESCRIPTION] and [AGENT_ROLE] should come from the original dispatch instructions. [SLA_THRESHOLD_SECONDS] and [ELAPSED_TIME_SECONDS] are measured by your orchestrator. [PARTIAL_OUTPUT_IF_ANY] is whatever the agent emitted before timing out—pass it as a raw string or structured JSON. [USER_IMPACT_CONTEXT] should be a brief description of who is waiting on this task and what happens if it fails. [AVAILABLE_ESCALATION_TARGETS] is a list of agent IDs, team channels, or fallback workflow names. [CONSTRAINTS] can include policy rules like "never escalate billing tasks to the general-support agent." After generation, validate the JSON against the schema and check that the urgency level matches your internal severity definitions before routing the escalation.

IMPLEMENTATION TABLE

Prompt Variables

Required and optional placeholders for the Agent Timeout Escalation Prompt. Validate each input before assembly to prevent incorrect escalation decisions.

PlaceholderPurposeExampleValidation Notes

[AGENT_ID]

Identifies the agent that exceeded its SLA

invoice-classifier-v2

Must match a known agent ID in the registry; reject unknown IDs

[SLA_THRESHOLD_MS]

Maximum allowed execution time in milliseconds

30000

Must be a positive integer; reject zero or negative values

[ACTUAL_DURATION_MS]

Measured wall-clock execution time in milliseconds

45200

Must be greater than [SLA_THRESHOLD_MS]; reject if under threshold

[TASK_DESCRIPTION]

Human-readable summary of the task the agent was executing

Classify invoice batch #1423 for GL coding

Must be non-empty string; null triggers a missing-context warning

[PARTIAL_PROGRESS]

Structured record of completed subtasks and intermediate results

{"classified": 87, "total": 200, "last_id": "INV-0087"}

Must be valid JSON; parse and check for required fields before injection

[ERROR_LOG]

Last N error messages or exception traces from the agent

TimeoutError: heartbeat lost after 45s

May be null if no explicit error; null is allowed but must be noted in escalation record

[UPSTREAM_DEPENDENCIES]

List of agents or services that depend on this agent's output

["gl-posting-agent", "audit-reporter"]

Must be a JSON array; empty array is valid and means no downstream blockers

[ESCALATION_TARGETS]

Ordered list of possible escalation recipients with roles

["oncall-sre-pager", "fallback-classifier-v1"]

Must be a non-empty JSON array; reject if empty to prevent silent escalation failures

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Agent Timeout Escalation Prompt into a production agent orchestration layer with validation, retries, and human review.

The Agent Timeout Escalation Prompt is designed to be called by an orchestrator or supervisor agent when a worker agent exceeds its SLA threshold. The orchestrator should capture the worker's partial output, the elapsed wall-clock time, the SLA limit, and any tool-call logs before invoking this prompt. The prompt itself does not make the escalation decision—it produces a structured escalation recommendation that your application code must validate and act on. Treat the model's output as a decision-support artifact, not an autonomous trigger.

Wire the prompt into your orchestration layer as a synchronous call with a strict timeout of its own (e.g., 10 seconds). Pass the required placeholders: [AGENT_ID], [TASK_SUMMARY], [ELAPSED_TIME], [SLA_THRESHOLD], [PARTIAL_RESULTS], [TOOL_CALL_LOG], and [ESCALATION_TARGETS]. The model should return a JSON object matching the [OUTPUT_SCHEMA] you define—typically containing escalation_decision (boolean), urgency_level (low/medium/high/critical), partial_progress_assessment, user_impact_estimate, recommended_escalation_target, and reasoning. Validate this output in your application layer before routing: check that urgency_level is one of the allowed enum values, that recommended_escalation_target exists in your configured escalation registry, and that partial_progress_assessment does not fabricate completed work that the agent log doesn't support. If validation fails, retry once with the validation errors appended to the prompt context. If the retry also fails, fall back to a default escalation to the on-call human with a templated notification.

Log every invocation with the full prompt input, raw model output, validation result, and final routing decision. This audit trail is critical for SRE postmortems and for tuning SLA thresholds over time. For high-severity escalations (urgency high or critical), require human acknowledgment before the escalation target is notified—do not automate the notification path. Use a model that supports structured output (JSON mode or function calling) to reduce parsing failures. If you are using a model without native JSON mode, add a repair step using the Output Repair and Validation Prompts pillar to handle malformed responses. Avoid wiring this prompt directly into customer-facing surfaces; the escalation decision should always pass through an application-level circuit breaker that can suppress duplicate escalations, enforce cooldown periods, and respect maintenance windows.

Before deploying, run eval suites that test correct SLA breach detection (elapsed time above threshold should trigger escalation, below should not), appropriate urgency calibration (a 5-second overrun on a batch job should not produce critical urgency), and hallucination resistance in partial_progress_assessment (the model must not claim completion of steps absent from the tool-call log). Use the LLM Judge and Evaluation Rubrics pillar to build automated pass/fail checks on these dimensions. Start with a human-in-the-loop deployment where all escalations are reviewed for at least two weeks before enabling automated routing for low-urgency cases.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the required fields, types, and validation rules for the escalation decision object produced by the Agent Timeout Escalation Prompt. Use this contract to parse and validate the model's output before routing the escalation.

Field or ElementType or FormatRequiredValidation Rule

escalation_decision

enum: escalate | hold | resolve

Must be exactly one of the three allowed values. Reject any other string.

timeout_context.agent_id

string

Must match the [AGENT_ID] placeholder from the prompt input. Non-empty string required.

timeout_context.sla_threshold_seconds

integer

Must be a positive integer. Must match the [SLA_THRESHOLD_SECONDS] input value exactly.

timeout_context.actual_elapsed_seconds

integer

Must be a positive integer greater than sla_threshold_seconds. Reject if elapsed <= threshold.

partial_progress.completed_subtasks

array of strings

Must be a JSON array. Can be empty if no progress was made. Each element must be a non-empty string.

partial_progress.remaining_subtasks

array of strings

Must be a JSON array. Cannot be empty if escalation_decision is 'escalate'. Each element must be a non-empty string.

user_impact.severity

enum: low | medium | high | critical

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

user_impact.affected_user_count_estimate

integer or null

If null, user_impact.severity must be 'low'. If integer, must be >= 0. Reject negative numbers.

escalation_target.recommended_agent

string or null

Required if escalation_decision is 'escalate'. Must be a non-empty string matching a known agent ID. Null allowed for 'hold' or 'resolve'.

escalation_target.reason

string

Required if escalation_decision is 'escalate'. Must be a non-empty string explaining why this target was chosen. Null allowed for 'hold' or 'resolve'.

PRACTICAL GUARDRAILS

Common Failure Modes

Agent timeout escalations fail silently, escalate too late, or flood on-call with noise. These cards cover the most common failure patterns and the guardrails that prevent them.

01

SLA Threshold Misconfiguration

What to watch: Static timeout thresholds that don't account for task complexity, model latency variance, or upstream dependency slowness. A 30-second SLA for a simple classification is generous; for a multi-step research agent it's impossibly tight. Misconfigured thresholds cause false-positive escalations that desensitize responders. Guardrail: Define SLA tiers by task class and agent capability, not a single global timeout. Include a task_complexity field in the escalation payload so responders can judge whether the threshold was appropriate.

02

Missing Partial Progress Context

What to watch: The escalation prompt fires but the payload contains only 'agent timed out' with no intermediate results, completed subtasks, or evidence of what the agent accomplished before the timeout. The responder has no way to assess impact or decide whether to resume, retry, or abort. Guardrail: Require the agent to checkpoint partial progress at regular intervals. The escalation prompt template must include a [PARTIAL_PROGRESS] placeholder that is populated from the last checkpoint, with explicit 'unknown' markers for any section that wasn't captured.

03

Urgency Inflation

What to watch: Every timeout escalation is tagged as CRITICAL or P1 regardless of user impact. A timeout on a background batch job and a timeout on a customer-facing checkout flow should not produce the same urgency. Over-escalation causes alert fatigue and slows response to genuine incidents. Guardrail: Include a user_impact_estimate field in the escalation schema with defined levels: BLOCKING, DEGRADED, BACKGROUND. The prompt must require the agent to justify the selected level with observable evidence, not default to the highest severity.

04

Escalation Target Ambiguity

What to watch: The prompt produces 'escalate to on-call' without specifying which team, channel, or runbook applies. The escalation lands in a generic queue where no one owns it, or bounces between teams who each assume another group handles agent timeouts. Guardrail: The prompt template must include an [ESCALATION_TARGET] field that maps to a specific team, rotation, or webhook. Derive the target from the agent's ownership registry and the task domain. If the mapping is ambiguous, the prompt must flag the ambiguity rather than guessing.

05

Retry Loop Without State Check

What to watch: The escalation handler receives the timeout, assumes the agent's work was lost, and retries the entire task from scratch. The original agent eventually completes and writes its results, creating duplicate side effects or conflicting state. Guardrail: The escalation prompt must include an [IDEMPOTENCY_KEY] and instruct the responder to check for existing completion records before retrying. If partial results exist, the prompt should recommend resuming from the last checkpoint rather than restarting.

06

Silent Timeout Without Escalation Trigger

What to watch: The agent exceeds its SLA but no escalation fires because the timeout detection runs in a separate process that isn't wired to the escalation prompt. The task hangs indefinitely, the user sees a spinner, and no one knows until a customer complains. Guardrail: Implement a watchdog external to the agent that triggers the escalation prompt independently. The watchdog must have its own heartbeat check and dead-man's switch. If the watchdog itself fails to fire, a secondary monitor must alert on missing escalation events for in-flight tasks.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the Agent Timeout Escalation Prompt before deploying it in production. Each criterion targets a specific failure mode common in SLA-driven escalation logic.

CriterionPass StandardFailure SignalTest Method

SLA Breach Detection

Correctly identifies that [AGENT_EXECUTION_TIME] exceeds [SLA_THRESHOLD_SECONDS] and triggers an escalation decision.

Prompt treats a timeout as a success, ignores the SLA threshold, or escalates when execution time is within limits.

Unit test with a pair of inputs: one where execution time is 1 second over the threshold, and one where it is 1 second under.

Partial Progress Assessment

Accurately lists completed subtasks from [AGENT_PROGRESS_LOG] and marks them as Done, while identifying [REMAINING_TASKS] as Not Started or In Progress.

Output fabricates completed tasks not present in the log, or marks a task as Done when its status is ambiguous.

Provide a progress log with 3 completed tasks and 2 pending tasks. Assert that the output matches the log exactly with no additions.

User-Impact Estimate

Produces a severity rating (e.g., Low, Medium, High, Critical) that is consistent with the [USER_IMPACT_CONTEXT] provided.

Output assigns a Critical severity to a minor delay with a workaround, or Low severity to a complete user blockage.

Test with two scenarios: a minor reporting delay and a payment-processing outage. Check for correct ordinal ranking.

Escalation Target Selection

Recommends an escalation target from [AVAILABLE_AGENTS] that has the required capability to handle [REMAINING_TASKS].

Selects an agent whose capability set does not match the remaining work, or selects a human when an automated fallback is available and appropriate.

Provide a list of agents with specific capabilities. Verify the selected agent's capabilities intersect with the required skills for the remaining tasks.

Context Preservation

The [HANDOFF_PAYLOAD] contains all fields from the [INPUT_CONTEXT] without truncation or hallucination.

The handoff payload drops the original user query, loses intermediate results, or injects a summary that changes the factual meaning.

Diff the input context against the handoff payload. Assert that all critical fields (user_intent, session_id, partial_results) are byte-for-byte identical.

Urgency Calibration

The escalation message's tone and recommended response time are proportional to the [USER_IMPACT_CONTEXT] severity.

A low-severity timeout generates an urgent 'drop everything' message, or a critical outage generates a low-priority notification.

Use an LLM-as-judge with a pairwise comparison: provide the severity and the generated message, and ask if the tone is appropriate.

Abstention from Fabrication

The output explicitly states 'No data available' or 'Unknown' for any required field where the [AGENT_PROGRESS_LOG] provides no information.

The model guesses the reason for the timeout, invents a root cause, or creates a plausible but false completion status for a task.

Provide a progress log with a missing error code. Assert that the output contains the exact string 'Unknown' for the error_code field.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single model call and no external state. Replace [AGENT_ID] and [SLA_THRESHOLD_MS] with hardcoded test values. Skip the structured output schema and ask for a plain-text escalation decision with reasoning.

code
Agent [AGENT_ID] exceeded its [SLA_THRESHOLD_MS]ms timeout.
Partial progress: [PARTIAL_PROGRESS_SUMMARY]
User impact: [USER_IMPACT_ESTIMATE]

Decide: escalate, retry, or degrade. Explain why.

Watch for

  • Missing structured fields makes downstream routing unreliable
  • No retry count or idempotency checks, so duplicate escalations are likely
  • Overly broad instructions produce inconsistent urgency calibration
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.