Agent instructions
AuraScore 81/100

Dynamic Tool Recovery and Agentic Re-Planning Framework

Formulate dynamic tool self-correction, alternative path selection, and deterministic recovery plans for autonomous agent failures.

Utilize this template when agent tool executions are prone to transient API failures, unexpected parameter schemas, or edge-case runtime errors. It generates an actionable recovery and automated re-planning blueprint.

Template

Role: Staff Agentic Reliability Engineer focused on resilient self-correcting agent runtimes and dynamic replanning workflows.

Context

  • Execution pipeline: {{execution_pipeline_name}}
  • Primary tool catalog: {{primary_toolset_inventory}}
  • Alternative and fallback services: {{fallback_service_matrix}}
  • Re-planning loop allowance: {{max_replanning_iterations}}
  • Observability and trace backend: {{observability_telemetry_sink}}
  • Human intervention criteria: {{human_approval_threshold}}

Task

Construct a resilient dynamic re-planning and tool recovery plan that enables {{execution_pipeline_name}} to self-diagnose execution errors, formulate alternative tool execution paths, and gracefully escalate unrecoverable states.

Method

  1. Analyze the primary tools in {{primary_toolset_inventory}} to identify fragile operations, common HTTP/database status codes, and deterministic error payloads.
  2. Map secondary APIs, decomposed query paths, and alternative tools in {{fallback_service_matrix}} for every primary tool failure mode.
  3. Design a structured error-reflection prompt protocol that forces the agent to classify failures (e.g., Schema Error, Rate Limit, Auth, Stale Entity, Missing Data).
  4. Formulate the dynamic re-planning loop detailing how the agent mutates arguments, splits tasks, or switches to alternate tools within {{max_replanning_iterations}}.
  5. Establish hard boundaries where dynamic replanning terminates immediately and triggers escalation based on {{human_approval_threshold}}.
  6. Detail state preservation rules to ensure partial task achievements are not lost or re-executed during re-planning turns.
  7. Construct logging schemas to emit recovery traces, failed attempts, argument mutations, and final resolution paths directly to {{observability_telemetry_sink}}.

Constraints

  • MUST enforce a hard halt when re-planning attempts reach {{max_replanning_iterations}}.
  • MUST NOT attempt automated retries on non-idempotent operations without verifying state idempotency keys.
  • Re-planning logic MUST require the agent to generate an explicit rationale before switching from primary to fallback tools.
  • Keep tool retry latency overhead bounded to prevent pipeline timeouts.

Output format

1. Tool Error Taxonomy & Classification Engine

(Table mapping Failure Category, Typical Code, Root Cause, and Agent Reflex Action)

2. Primary-to-Fallback Tool Substitution Matrix

(Mapping each tool in {{primary_toolset_inventory}} to its fallback in {{fallback_service_matrix}})

3. Reflection & Re-Planning Step Logic

(Sequential execution algorithm for reflection, argument mutation, and alternate tool invocation)

4. Circuit Breakers & Escalation Protocol

(Explicit triggers matching {{human_approval_threshold}} that pause execution for human review)

5. Telemetry & Failure Trace Specification

(JSON payload schema for events dispatched to {{observability_telemetry_sink}})

Self-review

  • Verify every entry in {{primary_toolset_inventory}} has an actionable fallback in {{fallback_service_matrix}} or an explicit terminal failure rule.
  • Confirm that re-planning cycles cannot exceed {{max_replanning_iterations}} under any condition.
  • Validate that human escalation paths in {{human_approval_threshold}} completely halt automated execution loops.
AuraScore breakdown
81/100Provisional
Instruction clarity15/15 · Strong

Explicit role, a named task, and discrete steps the model can follow.

Context architecture12/12 · Strong

Background, inputs and variables the model needs before it starts.

Constraint engineering10/12 · Adequate

Hard boundaries — what the model must and must not do.

Output specification6/14 · Thin

A named, field-level shape for the response.

Reasoning structure10/10 · Strong

Ordered work items that force analysis before an answer.

Model compatibility10/10 · Strong

Length and structure that travel across frontier models.

Token efficiency5/10 · Thin

Signal density — instruction weight without padding.

Reusability7/7 · Strong

Documented variables so the scaffold adapts to new inputs.

Robustness5/5 · Strong

Quality bar, assumptions and behaviour when inputs are thin.

Observed performance1/5 · Thin

How much real usage the template has behind it.

ai-agents
agents-instructions
autonomous-agents-workflows
dynamic-replanning
fault-tolerance
agent-reliability