Docs · AI Fix

How AI Fix works

When your bot crashes, the platform offers a one-click "Fix with AI" button. Behind the button: Claude reads your code, your traceback, and your bot's recent context, then proposes a diff. This page explains what's inside the box, what it catches well, and where to be careful.

In this guide

  1. How it works under the hood
  2. What AI Fix is good at
  3. Where AI Fix struggles
  4. When to trust the suggestion
  5. Rate limits & cost
  6. Privacy & what gets sent

How it works under the hood

The flow, end to end:

  1. Your bot raises an unhandled exception. The runtime captures the traceback, the bot's code, and the last ~50 log lines.
  2. The dashboard shows a red banner with the error and a Fix with AI button.
  3. You click it. The platform sends a POST to watchdogbot.cloud/api/ai/fix with: your code, the traceback, recent logs, and the bot's metadata (exchange, framework version, language version).
  4. The backend prompts Claude with a tightly scoped system prompt: "You are debugging a Python trading bot. Output JSON with the proposed code change and an explanation. Do not change unrelated lines."
  5. Claude responds with a structured diff and a short explanation. The dashboard shows the diff inline. You click Apply, the file is updated, and you can restart the bot.

Approximate latency: 3–8 seconds end to end depending on Claude's response time.

What AI Fix is good at

Based on real usage, AI Fix has the highest success rate on these error categories:

Error classHit rateWhy it works
SyntaxError / IndentationError~95%Mechanical — Claude sees the line and fixes it
TypeError / AttributeError~85%Usually a missing None check or wrong type assumption
KeyError on dict access~80%Suggest .get() with a default, or check the key exists first
ImportError (subtle ones)~75%For dependency package-name mismatches (the auto-installer handles the simple cases)
Async/await mistakes~70%asyncio errors have a clear structural fix
HTTP response parsing~65%Common — bot assumes the API always returns a number, sometimes it returns null

Overall success rate across real user reports: roughly 70%.

Where AI Fix struggles

AI Fix is a code-level debugger, not a strategist. It will not help with:

Heuristic: If the error message points to a specific line of YOUR code, AI Fix usually helps. If the error message is generic ("Connection reset", "rate limit exceeded", "timeout"), the fix is operational, not code.

When to trust the suggestion

Three quick checks before clicking Apply:

  1. Read the diff. Even if it's three lines. Claude occasionally "fixes" the symptom by silently catching the exception, which masks the real bug. If the diff is just except Exception: pass, reject it.
  2. Check that unrelated logic isn't touched. A good AI Fix changes exactly the broken thing. If it rewrites a function that was working, something is off.
  3. Run in demo mode first. WatchDog Bot has wd.is_demo() for exactly this — restart in demo, verify the fix actually runs end-to-end without errors, then promote to live.

If the suggested fix looks wrong, you can re-ask AI Fix with extra context (a longer log excerpt, or a comment explaining what you actually intended). The dashboard lets you edit the prompt context before re-submitting.

Rate limits & cost

AI Fix is included in every WatchDog Bot subscription. There's a soft cap of 50 calls per 24-hour window per user to prevent runaway scripted abuse. In normal use no one hits this — most users call AI Fix once or twice a week.

If you do hit the limit, you'll see "AI Fix daily limit reached. Try again in N hours." The counter resets on a rolling 24h basis.

Privacy & what gets sent

When you click Fix with AI, the platform sends to Claude:

What does not get sent:

Claude processes the request through Anthropic's API under their standard terms. Anthropic does not train on API data unless explicitly opted in. We don't retain the prompt or response on our backend longer than the request lifetime (~30 seconds) — only an audit row in app_errors recording the call happened and whether it succeeded.

Bottom line: The model sees your code, not your money. We designed AI Fix so a leak to Anthropic would expose your strategy IP but never your trading capital.


Try AI Fix on your next bug

Included in every WatchDog Bot subscription. Free trial, no credit card.

Start Free Trial →

Related reading