When One Tool Route Breaks, Your Agent Should Find Another

When One Tool Route Breaks, Your Agent Should Find Another

Aident AI

A turquoise ribbon curves around a coral obstruction through an amber opening and continues as a cobalt band.

When One Tool Route Breaks, Your Agent Should Find Another

An AI agent should not keep retrying a broken tool route just because the provider behind it is still the right provider. It should preserve the job, classify the failure, rediscover an equivalent route, compare the two contracts, preflight the replacement, and rerun only when the new path is observably safe.

We tested that recovery pattern on one concrete job: list the current open pull requests for the Aident repository. The first Aident Loadout route, a hosted GitHub CLI Action, failed because its hosted backup had expired. The agent did not retry it. It searched the live catalog, found a connected GitHub Action for the same read, inspected its schema, preflighted a three-result request at exactly $0.00, and completed the replacement call in 13.461 seconds.

GitHub was not down. The job was not impossible. One execution route was unavailable. That distinction is the entire point.

Fail Over the Job, Not the Tool Name

Bad recovery logic starts with a tool identifier:

cli:gh:pr_list failed -> call cli:gh:pr_list again

Useful recovery logic starts with an acceptance test:

Job: list three current open pull requests for Aident-AI/aident.ai
Required output: number, title, state, draft status, updated time
Allowed effect: read only
Maximum price: $0.00 for this check
Freshness: current at execution time

The acceptance test survives when a package, connector, hosted runtime, or provider adapter changes. A tool name does not.

The First Route Failed

The original route was a hosted GitHub CLI Action selected during the blog lifecycle preflight. It was an appropriate route for listing pull requests, but execution failed because the hosted runtime backup had expired.

That error supplied three important facts:

  1. the provider request had not produced the required result;

  2. repeating the same hosted route would not repair its backup state; and

  3. the job itself could still be served by another GitHub integration.

The correct response was route discovery, not exponential backoff.

The Replacement Route

The agent searched Aident Loadout by job:

aident capabilities search \
  --query "list open GitHub pull requests for a repository using a connected account" \
  --types '["action"]' \
  --limit 12

The current catalog returned composio:github_tools:github_list_pull_requests as the leading match. Its description required both repository owner and repository name. The inspected input schema exposed nine properties, including owner, repo, state, per_page, page, sort, and direction.

The catalog conservatively labeled the Action as operation type write with risk level 2 even though its provider job was a list operation. We preserved that metadata rather than silently changing it. Failover is not permission to weaken the replacement contract.

Compare Routes Before Switching

An alternative is valid only if it satisfies the same job and does not introduce a new unacceptable boundary.

Check

First route

Replacement route

Decision

Provider job

List repository pull requests

List repository pull requests

Equivalent

Target

One owner and repository

One owner and repository

Equivalent

Effect

Intended read

Provider list operation, catalog marked write/risk 2

Preserve review boundary

Account

Existing GitHub access

Connected GitHub account alias

Verify before execution

Result limit

Bounded

per_page: 3

Equivalent

Price

Execution unavailable

Exact $0.00 preflight

Within ceiling

Output proof

No result

Three current pull requests

Acceptance test passed

This comparison prevents a dangerous shortcut: replacing a narrow provider Action with a generic HTTP request that has broader credentials, unknown pricing, or a different account.

Preflight the Exact Replacement

The replacement input was:

{
  "owner": "Aident-AI",
  "repo": "aident.ai",
  "state": "open",
  "per_page": 3,
  "page": 1,
  "sort": "updated",
  "direction": "desc"
}

Preflight reported valid input and an exact free estimate:

inputValid: true
estimatedCredits: 0
estimatedUsd: $0.00

Only then did the agent execute the replacement once. The call completed in 13.461 seconds and returned three current pull requests with their numbers, titles, state, draft status, and timestamps.

The output also contained far more GitHub metadata than the acceptance test needed. The agent reduced the result to the five required fields instead of carrying full pull request bodies, branch objects, users, labels, and repository metadata into the rest of the session.

The Six-Gate Failover Rule

Use these gates in order.

1. Classify the failure

Decide whether the problem is invalid input, authentication, approval, budget, transient transport, state conflict, ambiguous completion, or route availability. The existing AI agent tool failure matrix owns that classification.

Do not fail over an invalid request. Every route will reject the same missing business input.

2. Freeze the job contract

Record the target, desired output, allowed side effects, freshness, price ceiling, and success checks before searching for another route.

Without this step, the agent can declare success after completing an easier but different job.

3. Rediscover by verb and object

Search for "list open pull requests for one repository," not merely "GitHub." A specific query improves the chance that the alternative matches the operation and output shape.

4. Inspect the replacement contract

Compare:

  • required integration and account alias;

  • input schema and defaults;

  • operation type and risk level;

  • price model and funding route;

  • pagination and output schema; and

  • provider-specific constraints.

Stop if the replacement needs broader access or cannot express the original target.

5. Preflight the mapped input

Field names often differ across routes. Build the replacement input from its current schema, then validate and price that exact input. Do not paste arguments from the failed tool into a different Action and hope the adapter interprets them.

6. Execute once and run the acceptance test

Run the smallest safe request. Compare the normalized output with the frozen job contract. Preserve the failed route, selected alternative, quote, duration, account alias, and outcome in the receipt.

When Automatic Failover Is Safe

Automatic route switching can be reasonable when all of these are true:

  • the operation is read-only;

  • the first failure proves no side effect occurred;

  • both routes use the intended account and resource boundary;

  • the replacement is no more expensive than the approved ceiling;

  • its contract can express the same job;

  • the output is independently verifiable; and

  • retry and failover share one attempt budget.

Listing three pull requests met those conditions.

When the Agent Must Stop

Do not automatically switch routes for:

  • emails, messages, posts, or notifications;

  • payments, purchases, or credit-consuming media generations;

  • creates, updates, deletes, merges, deployments, or publications;

  • a timeout after the provider may have accepted a write;

  • a replacement account with a different owner or permission scope;

  • an unavailable or unbounded replacement price; or

  • an alternative that exposes a raw provider credential.

For an ambiguous write, first search by idempotency key, operation ID, or stable external reference. A second route can duplicate the side effect just as easily as a second retry.

Keep Credential Failover Out of the Prompt

Route redundancy should not mean copying API keys into the agent so it can call providers directly. Use connected accounts, workload identity, or Vault-managed credentials and expose named operations instead.

The credential-safety guide explains that boundary. The agent can choose among reviewed routes without ever receiving a reusable provider secret.

Progressive Disclosure Still Matters

The recovery search in this cycle also showed why the agent should not load every alternative contract before a failure occurs.

A broad GitHub capability search returned 50 candidate metadata entries. The compact name-and-description projection measured 14,508 UTF-8 bytes including its terminal newline. After selection, the one replacement Action's name, description, and input schema measured 4,612 bytes on the same basis and exposed nine input properties.

Those are payload measurements from one Loadout run, not model token counts and not a universal context-saving percentage. The host decides what enters model context. The useful pattern is progressive disclosure: search broadly, inspect one contract, and return one bounded result.

For the full context workflow, read Your Agent Does Not Need 50 MCP Servers. It Needs Tool Search.

Give Your Agent a Failover Runbook

Follow https://aident.ai/SETUP.md

Complete this read-only job even if the first tool route is unavailable. Freeze
the target, required output fields, allowed side effects, freshness, and price
ceiling. If the first route fails, classify the failure and do not retry it
unchanged unless the failure is transient and safe. Search Loadout for an
equivalent route, inspect its current schema, account, risk, and pricing, map the
input, preflight it, and execute once only if every boundary is equivalent or
narrower. Return the failed route, replacement route, quote, duration, and
acceptance-test result. Stop before any write, credential change, approval, or
unbounded spend

Set up Aident Loadout and test one read-only route recovery.

Sources and Method Notes

  • GitHub REST API: Pull requests

  • Model Context Protocol: Tools

  • Aident Loadout setup

  • Aident Loadout execution evidence from August 30, 2026: the hosted GitHub CLI route failed because its backup had expired; live discovery selected composio:github_tools:github_list_pull_requests; exact preflight returned zero credits and $0.00; one execution completed in 13.461 seconds and returned three current pull requests. This proves one bounded recovery, not universal provider failover reliability.

Refresh this article when Loadout changes discovery, preflight, account routing, risk metadata, hosted CLI recovery, or Audit receipts, or when repeated route-recovery cohorts support a measured reliability claim.

Home

Home

Home

Integrations

Integrations

Integrations

Vault

Vault

Vault

Audit

Audit

Audit

Arana Grande

Arana Grande

Arana Grande

Free

Free

Free

30-day audit summary

30-day audit summary

30-day audit summary

Daily action-call volume and the latest receipts from the Loadout audit trail.

Daily action-call volume and the latest receipts from the Loadout audit trail.

Daily action-call volume and the latest receipts from the Loadout audit trail.

View Audit

View Audit

View Audit

Loadout usage

Loadout usage

Loadout usage

617 action calls in the last 30 days

617 action calls in the last 30 days

617 action calls in the last 30 days

May 19 - Jun 17

May 19 - Jun 17

May 19 - Jun 17

10 active days

10 active days

10 active days

Less

Less

Less

More

More

More

Recent activity

Recent activity

Recent activity

Latest action-call receipts from connected agents

Latest action-call receipts from connected agents

Latest action-call receipts from connected agents

Apr 23, 09:23 AM

Apr 23, 09:23 AM

Apr 23, 09:23 AM

Shopify

Shopify

Shopify

Creates Or Updates An Asset For A Theme

Creates Or Updates An Asset For A Theme

Creates Or Updates An Asset For A Theme

Success

Success

Success

Apr 23, 09:21 AM

Apr 23, 09:21 AM

Apr 23, 09:21 AM

Shopify

Shopify

Shopify

Update Products Param Product Id

Update Products Param Product Id

Update Products Param Product Id

Success

Success

Success

Apr 23, 08:53 AM

Apr 23, 08:53 AM

Apr 23, 08:53 AM

Shopify

Shopify

Shopify

Update Products Param Product Id

Update Products Param Product Id

Update Products Param Product Id

Failed

Failed

Failed

Apr 22, 22:13 PM

Apr 22, 22:13 PM

Apr 22, 22:13 PM

Shopify

Shopify

Shopify

Create Product Image

Create Product Image

Create Product Image

Success

Success

Success

Apr 22, 22:12 PM

Apr 22, 22:12 PM

Apr 22, 22:12 PM

Shopify

Shopify

Shopify

Create Product Image

Create Product Image

Create Product Image

Success

Success

Success

Connected integration coverage

Connected integration coverage

Connected integration coverage

162

162

162

of 753 accessible connected

of 753 accessible connected

of 753 accessible connected

Callable actions

Callable actions

Callable actions

1,126

1,126

1,126

Vault credentials

Vault credentials

Vault credentials

8

8

8

Explore what's possible

Explore what's possible

Explore what's possible

See all Integrations

See all Integrations

See all Integrations

Google Ads

Google Ads

Google Ads

All available Goolge Ads tools via...

All available Goolge Ads tools via...

All available Goolge Ads tools via...

X (twitter)

X (twitter)

X (twitter)

All available X tools via...

All available X tools via...

All available X tools via...

Github

Github

Github

All available Github tools via...

All available Github tools via...

All available Github tools via...

Notion

Notion

Notion

All available Notion tools via...

All available Notion tools via...

All available Notion tools via...

Slack

Slack

Slack

All available Slack tools via...

All available Slack tools via...

All available Slack tools via...

Firecrawl

Firecrawl

Firecrawl

All available Firecrawl tools via...

All available Firecrawl tools via...

All available Firecrawl tools via...

753 integrations are available for loadouts.

753 integrations are available for loadouts.

753 integrations are available for loadouts.

The one tool

for every tool

your agent needs.

Give any AI agent real capabilities in seconds. Connect 27,000+ tools once, skip the setup headache, and let your agents execute.

Try Aident Loadout

Empower your Codex or OpenClaws to get real jobs done. Connect 27,000+ tools in one prompt, and let your agents deliver real results.

Try Aident Loadout

Empower your Codex or OpenClaws to get real jobs done. Connect 27,000+ tools in one prompt, and let your agents deliver real results.

Try Aident Loadout

Empower your Codex or OpenClaws to get real jobs done. Connect 27,000+ tools in one prompt, and let your agents deliver real results.