Tool Call Retry for Openclaw

An automated retry and error correction engine designed to stabilize LLM tool calls and external API interactions.

ayalili
v1.0.1
Mar 10, 2026
1
2.6k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install tool-call-retry

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install tool-call-retry using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Tool Call Retry?

The Tool Call Retry skill is a robust reliability layer for AI agents, specifically engineered to solve the instability of LLM-generated tool calls. By implementing a sophisticated retry mechanism with exponential backoff, it ensures that transient network issues or temporary service outages do not derail your agent's workflow.

Beyond simple retries, this Openclaw Skills contribution provides a self-healing framework. It can validate output formats in real-time and execute custom error-handling logic, such as using an LLM to fix malformed arguments (like SQL syntax errors) before re-attempting the execution. It offers a zero-overhead way to transform brittle agent actions into high-availability production services.

Tool Call Retry Use Cases

  • Stabilizing external API and third-party service calls within AI agent workflows.
  • Automatically fixing LLM-generated tool call formatting or syntax errors.
  • Implementing high-reliability execution chains for mission-critical autonomous agents.
  • Preventing duplicate actions in financial or stateful systems using idempotency keys.

How Tool Call Retry Works

  1. The skill receives a target tool function and its initial arguments.
  2. It executes the function and monitors for exceptions or validation failures via the validatorFn.
  3. If an error occurs, the errorHandlerFn analyzes the failure to decide whether to abort or attempt a fix.
  4. If a fix is possible (e.g., repairing a SQL string), the arguments are updated for the next attempt.
  5. The system applies an exponential backoff delay to prevent overwhelming the target service.
  6. Upon reaching the maxRetries limit or a successful execution, it returns the final result or an error state.

Tool Call Retry Setup

To integrate this capability into your project using Openclaw Skills, use the following configuration within your environment:

# Install the skill package
npm install @openclaw/tool-call-retry

Basic implementation in your agent code:

import { skills } from 'openclaw';

const result = await skills.toolCallRetry({
  toolFn: yourFunction,
  args: { data: "example" },
  maxRetries: 3
});

Tool Call Retry Data Schema & Taxonomy

The skill utilizes a structured configuration object to manage the retry lifecycle. Below is the metadata taxonomy used by Openclaw Skills:

Parameter Type Required Default Description
toolFn Function Yes - The async tool function to execute.
args any No {} Arguments passed to the tool function.
maxRetries number No 3 Maximum retry attempts (Range: 1-10).
initialDelayMs number No 1000 Initial delay before first retry (100-10000ms).
validatorFn Function No ()=>true Custom logic to validate if the result is successful.
errorHandlerFn Function No undefined Logic to repair arguments or abort the retry loop.
idempotencyKey string No undefined Unique key to ensure the function only runs once successfully.

Tool Call Retry Advanced Features

  • Exponential Backoff Algorithm: Intelligently scales wait times between retries to optimize recovery and protect downstream services.
  • Error Self-Healing: Power users can pipe errors back to an LLM within the errorHandlerFn to dynamically fix code or syntax errors mid-stream.
  • Idempotency Support: Guarantees that identical calls with the same idempotency key are not executed multiple times, ensuring data integrity.
  • Type-Safe Validation: Fully integrated with Zod for rigorous runtime parameter and result validation with minimal performance overhead (<1ms).

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*