{"_id":"@agentxin-ai/plugin-tool-retry","name":"@agentxin-ai/plugin-tool-retry","dist-tags":{"latest":"0.0.4"},"versions":{"0.0.4":{"name":"@agentxin-ai/plugin-tool-retry","version":"0.0.4","author":{"name":"AgentXinAI","url":"https://agentxinai.cn"},"license":"AGPL-3.0","repository":{"type":"git","url":"git+https://github.com/agentxin-ai/agentxin-plugins.git"},"bugs":{"url":"https://github.com/agentxin-ai/agentxin-plugins/issues"},"type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{"./package.json":"./package.json",".":{"@agentxin-plugins-starter/source":"./src/index.ts","types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"dependencies":{"tslib":"^2.3.0"},"peerDependencies":{"zod":"3.25.67","@agentxin-ai/plugin-sdk":"^3.8.0","chalk":"4.1.2","@nestjs/common":"^11.1.6","@metad/contracts":"^3.8.0","@langchain/core":"0.3.72"},"_id":"@agentxin-ai/plugin-tool-retry@0.0.4","description":"`@agentxin-ai/plugin-tool-retry` retries failed tool executions for AgentXin agents using JSON-serializable middleware configuration. It preserves the core LangChain retry behavior while fitting AgentXin's UI-driven plugin model.","homepage":"https://github.com/agentxin-ai/agentxin-plugins#readme","_nodeVersion":"22.22.0","_npmVersion":"10.9.4","dist":{"integrity":"sha512-3WGF0JPZ7oe+cBX1fGfkBmqOydaRLD9oiucf5prKEmIneIdDKo0x1xMIKjTygOiNS8BYwuX+rJryKClhp73mpQ==","shasum":"fc6986c65f7242bdd0d947efe2cdd74868941cea","tarball":"https://registry.npmjs.org/@agentxin-ai/plugin-tool-retry/-/plugin-tool-retry-0.0.4.tgz","fileCount":2,"unpackedSize":4589,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFyMrWcJ24oI2JNjQq27bDcq1ImkuH6AxpPFTUUNBa9CAiEA9c44Jc6g4xKbFKwauHNpQE1bB98PGx1lTmYhCxnRBB0="}]},"_npmUser":{"name":"agentxin-ai","email":"1304040880@qq.com"},"directories":{},"maintainers":[{"name":"agentxin-ai","email":"1304040880@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/plugin-tool-retry_0.0.4_1773917418418_0.8804346433263033"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-19T10:50:18.347Z","0.0.4":"2026-03-19T10:50:18.549Z","modified":"2026-03-19T10:50:18.777Z"},"maintainers":[{"name":"agentxin-ai","email":"1304040880@qq.com"}],"description":"`@agentxin-ai/plugin-tool-retry` retries failed tool executions for AgentXin agents using JSON-serializable middleware configuration. It preserves the core LangChain retry behavior while fitting AgentXin's UI-driven plugin model.","homepage":"https://github.com/agentxin-ai/agentxin-plugins#readme","repository":{"type":"git","url":"git+https://github.com/agentxin-ai/agentxin-plugins.git"},"author":{"name":"AgentXinAI","url":"https://agentxinai.cn"},"bugs":{"url":"https://github.com/agentxin-ai/agentxin-plugins/issues"},"license":"AGPL-3.0","readme":"# AgentXin Plugin: Tool Retry Middleware\n\n`@agentxin-ai/plugin-tool-retry` retries failed tool executions for AgentXin agents using JSON-serializable middleware configuration. It preserves the core LangChain retry behavior while fitting AgentXin's UI-driven plugin model.\n\n## Key Features\n\n- Retries tool failures with configurable retry count, exponential backoff, bounded jitter, and declarative error matching.\n- Can target all tools or only a configured set of tool names.\n- Returns a `ToolMessage` with `status: \"error\"` in `continue` mode so the agent can react gracefully.\n- Rethrows the last error in `error` mode after retries are exhausted.\n- Registers as a global middleware plugin so the strategy is available platform-wide.\n\n## Installation\n\n```bash\npnpm add @agentxin-ai/plugin-tool-retry\n# or\nnpm install @agentxin-ai/plugin-tool-retry\n```\n\n## Quick Start\n\n1. Register the plugin:\n   ```sh\n   PLUGINS=@agentxin-ai/plugin-tool-retry\n   ```\n2. Add a middleware entry using strategy `ToolRetryMiddleware`.\n3. Configure retries:\n   ```json\n   {\n     \"type\": \"ToolRetryMiddleware\",\n     \"options\": {\n       \"toolNames\": [\"search_database\", \"query_sales_report\"],\n       \"maxRetries\": 2,\n       \"initialDelayMs\": 1000,\n       \"backoffFactor\": 2,\n       \"maxDelayMs\": 60000,\n       \"jitter\": true,\n       \"retryAllErrors\": false,\n       \"retryableErrorNames\": [\"TimeoutError\"],\n       \"retryableStatusCodes\": [500, 503],\n       \"retryableMessageIncludes\": [\"temporarily unavailable\"],\n       \"onFailure\": \"continue\"\n     }\n   }\n   ```\n\n## Configuration\n\n| Field | Type | Description | Default |\n| ----- | ---- | ----------- | ------- |\n| `toolNames` | string[] | Tool names to retry. Empty means all tools. | `[]` |\n| `maxRetries` | number | Number of retry attempts after the initial failure. `0` disables retries. | `2` |\n| `initialDelayMs` | number | Delay before the first retry attempt, in milliseconds. | `1000` |\n| `backoffFactor` | number | Exponential multiplier applied per retry attempt. `0` keeps a constant delay. | `2` |\n| `maxDelayMs` | number | Upper bound for the computed retry delay. | `60000` |\n| `jitter` | boolean | Adds a bounded random factor to each delay to reduce synchronized retries. | `true` |\n| `retryAllErrors` | boolean | Retry every thrown error when `true`. | `true` |\n| `retryableErrorNames` | string[] | Retry only matching `error.name` values when `retryAllErrors=false`. | `[]` |\n| `retryableStatusCodes` | number[] | Retry matching HTTP-style status codes from `status`, `statusCode`, or `response.status`. | `[]` |\n| `retryableMessageIncludes` | string[] | Retry when the error message contains any configured fragment. Matching is case-insensitive. | `[]` |\n| `onFailure` | `\"continue\"` \\| `\"error\"` | Return a `ToolMessage` or rethrow after retries are exhausted. | `\"continue\"` |\n\n## LangChain Differences\n\n- Function-based `retryOn`, function-based `onFailure`, and BaseTool instance filtering are not supported in v1.\n- Tool selection is done with plain tool-name strings so middleware configuration stays serializable.\n- Retry attempts directly re-invoke the tool handler; no extra workflow execution wrapper is added because the SDK does not expose a tool-attempt tracking primitive.\n\n## Development & Testing\n\n```bash\nNX_DAEMON=false pnpm -C /path/to/agentxin-plugins/agentxinai exec nx build @agentxin-ai/plugin-tool-retry\nNX_DAEMON=false pnpm -C /path/to/agentxin-plugins/agentxinai exec nx test @agentxin-ai/plugin-tool-retry\n```\n\nTypeScript output is emitted to `middlewares/tool-retry/dist`.\n","readmeFilename":"README.md","_rev":"1-f6fdc76ead422758baffcd47c490f16d"}