> This page is for Server SDKs.

> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# set_tool_resend_dedupe

> Turn on or off the answer to a transport retry with the first attempt's result.

[ref-agentbase]: /docs/server-sdks/reference/python/agents/agent-base

[add-tool-middleware]: /docs/server-sdks/reference/python/agents/agent-base/add-tool-middleware

Turn the dedupe of transport retries on or off. It's on by default.

SignalWire sends a tool request again, with the same `tool_call_id`, after a
timeout, a failed connection, or a 5xx response, so a slow tool could run twice.
The dedupe answers such a retry with the first attempt's result, and a retry that
arrives while the first attempt is still running waits for it.

* A retry is a request with the same `call_id`, `tool_call_id`, and function name.
  A call the model makes again has a new `tool_call_id` and runs.
* A request without a `tool_call_id` always runs.
* A handler that raises is answered with a result saying the tool failed before it
  finished, and that result is kept: a retry gets it, and the handler doesn't run
  again. An exception raised in middleware, including a `ToolRefusal`, isn't kept,
  so a retry runs the call again.
* The underlying `signalwire.core.tool_middleware.ResendDedupe` stores results for `ttl` seconds (default `600.0`) and keeps up to `max_entries` results (default `1024`).
* The record is kept in the agent's process. With several processes or replicas, a
  retry that reaches another one runs the tool again, so make tools that change
  things safe to run twice.

The dedupe runs first, before any [middleware][add-tool-middleware].

## Parameters

**`enabled`** `bool` — default: True

`False` runs every request, retries included.

---

## Returns

[`AgentBase`][ref-agentbase] -- Self for method chaining.

## Example

```python {4}
from signalwire import AgentBase

agent = AgentBase(name="idempotent", route="/idempotent")
agent.set_tool_resend_dedupe(False)   # run every request, retries included

agent.serve()
```