Tool errors are marketing errors: building resilient agent actions
AI-assisted research. This note was prepared with the assistance of AI tools. It may contain errors and is not professional advice. See our Legal Disclosures.
Agents act through tools, and tools fail. As more marketing work moves from people clicking buttons to agents calling APIs, the routine errors of distributed systems start to show up as customer-facing mistakes.
An API times out, a platform rejects a payload, a record is locked by another integration, or a quota runs out. In most software these are ordinary events with ordinary handling.
In marketing they have visible consequences. A campaign reaches part of an audience, a budget rises on one platform but not its pair, or a nurture sequence starts twice for the same contact.
This post covers how we design agent actions so that technical failures stay technical.
Four ways a failure becomes visible
Failures in agent tool use tend to take four shapes. Knowing which one you are looking at tells you which defense was missing.
Partial completion. A multi-step action fails midway and leaves systems inconsistent. The audience was built, the email was scheduled for some segments, and the suppression list was never applied.
Duplicate actions. A retry repeats an action that succeeded the first time. The classic case is a timeout after the platform accepted a send, followed by a retry that sends again.
Silent failure. An action fails and the agent continues as if it succeeded. This can come from tools that return a vague response the agent reads optimistically, or from instructions that push so hard for completion that the agent reports success regardless.
Cascading failure. A downstream agent acts on the missing or wrong output of an upstream one. A budget agent shifts spend toward a campaign that never launched, because the launch step reported success.
Retries are where duplicates come from
A typical path to a duplicate send is a call that timed out on the client after it succeeded on the server. The agent sees an error, retries in good faith, and the platform processes the same request twice.
The fix is dull and dependable. Give each customer-facing action an idempotency key derived from what makes it unique, such as the campaign, the audience snapshot, and the scheduled time. Pass the key to tools that support it, and record it yourself for tools that do not, checking for it before acting. A retry with the same key then becomes a lookup instead of a second send.
Key design matters. A key built from a timestamp generated at call time is new on each retry and prevents nothing. A key that is too coarse, such as the campaign ID alone, blocks a legitimate resend to a corrected audience. Derive keys from the business intent of the action, and document what each one covers.
Principles for resilient actions
Idempotency handles duplicates. These five principles cover the other failure shapes:
- Check before acting: confirm the action has not already run, using the key or a status lookup on the target system.
- Prefer atomic actions: use tools that complete fully or not at all, and where that is impossible, define compensating steps for each stage.
- Verify after acting: read back the result, such as the scheduled send, the audience count, or the new budget value, instead of trusting the call's return.
- Report honestly: state in the agent's instructions that reporting a failure or an uncertain outcome is always better than claiming success.
- Fail safely: when the state is unclear, stop and escalate, since a paused campaign is easier to fix than a half-launched one.
Verification deserves emphasis because it catches what the other principles miss. A platform can accept a request and then apply it differently than expected, for example by dropping contacts that fail validation without raising an error. Reading back the audience count after scheduling turns that into a visible discrepancy instead of a surprise in the results.
A worked example: scheduling a send
Consider a hypothetical lifecycle agent that schedules a promotional email to a segment. The action has three stages: snapshot the audience, create the send, and schedule it. Each failure point should behave as follows.
- If the snapshot fails, nothing customer-facing has happened, so retry with backoff and then escalate.
- If creating the send times out, look up the idempotency key before retrying, since the send may already exist.
- If scheduling fails, leave the created send in draft and report it rather than deleting and recreating it.
- After scheduling succeeds, read back the scheduled time and recipient count and compare them with the snapshot.
- If the counts differ beyond a threshold you set in advance, pause the send and ask a person.
Modeling these stages explicitly, with allowed transitions between them, is easier with the approach in state machines for campaign orchestration. The state machine makes "half done" a named state with a defined next step, instead of an accident someone discovers later.
Designing tools for resilience
Much of resilience comes from tool design rather than agent instructions. An agent cannot be careful with a tool that hides what happened. We recommend that customer-facing tools meet five requirements:
- Structured results: return success or failure with error categories the agent can act on, such as retryable, invalid input, or conflict.
- Idempotency keys: accept a key so repeated calls do not repeat effects.
- Status checks: expose the state of long-running operations instead of blocking until a timeout.
- Undo operations: offer explicit reversal or compensating actions where the action is reversible.
- Dry runs: separate validation from execution, so an agent can check a payload before committing it.
Error categories matter more than they appear to. "Request failed" invites a retry. "Audience contains suppressed contacts" invites a fix. See tool design for agents for more on keeping the tool surface small and clear.
Test failure, not just success
Agent tests usually cover the happy path. Add fault injection: make tools fail before the action, during it, and after it succeeds but before the response arrives. That last case is the one that produces duplicates, and it is the one least likely to happen by accident in a test environment.
For each injected fault, check that the agent detects the failure, avoids a duplicate, reports accurately, and leaves systems consistent. Track the results over time as a small resilience suite alongside your quality evals. This matters most before your busiest quarter, when load makes timeouts and limits more likely and raises the cost of each mistake.
The question we are working on now is recovery across agents. One agent can be made careful about its own actions. Getting a chain of agents to agree on what actually happened after a failure, without a person reconciling it by hand, is harder. We expect it to shape how hubs record and share action state.
How to apply this: pick one customer-facing action, such as scheduling an email, and inject a failure at each stage, including after success but before the response. Check that the system avoids duplicates, reports accurately, and stays consistent.
Related research
Agents should notice ambiguity before they guess: designing for vague requests
Real marketing requests are often vague or contradictory. Agents that notice ambiguity and respond sensibly beat agents that guess with confidence.
Small models, big jobs: matching model size to marketing tasks
Not every marketing task needs the most capable model available. Matching model size to the task can improve speed and cost without a loss in quality.
Agent personas are not characters: defining roles that hold up
Giving an agent a name and a personality is easy. Giving it a role with clear responsibilities, boundaries, and standards is what makes it dependable.
Put this research to work
Marketix turns these patterns into software: agents, automated workflows, and a hub that keeps people in control. Sign up for early access.
