Skip to content

Guides

Fix agents

When your own coding agent keeps going around in circles on the same error, hand it to a specialist. A fix agent reads the error and the files involved, and returns the cause, a patch and a way to check it, for a price you approve first.

Model availability

Each tier runs on a model alias. While no model is connected behind a tier, GET /v1/fix/agents shows it with available: false and a quote for it fails with provider_unavailable. Nothing is charged.

The agents

AgentForTakesReturnsStatus
Quick FixOne error and its stack trace in, the cause and a small patch out.Error message, stack trace, the files it points atCause, patch, how to check itAvailable
Build DoctorInstall, build and deploy failures: npm, pnpm, Next.js, Vite, Docker, Vercel.Build log, package.json, lockfile, config filesCause, patch, the command that should passAvailable
Type FixerA wall of TypeScript errors, fixed at the root instead of one by one.tsc output, the files involvedGrouped causes, one patchPhase 5
Dependency DoctorVersion conflicts, peer dependencies and breaking changes after an upgrade.Install log, manifest, lockfileVersions to pin or change, migration notesPhase 5
Test FixerA failing test: is the code wrong, or the test?Test output, the test, the code under testVerdict, patch to the right sidePhase 5
Deep DebugA bug across many files that your own agent keeps going around in circles on.Symptom, what was tried, the repo files involvedRoot cause, multi-file patch, verification planLater

Measured on real errors

On a set of 60 real errors run on the Balanced tier, Quick Fix returned a correct patch for 30 of 30 and Build Doctor for 27 of 30. A patch counts as correct when it applies to the files sent and removes the cause of the error.

Tiers and prices

Every agent runs on one of three tiers. The tier sets the model alias, and each agent has a price range per tier.

TierModel aliasQuick FixBuild DoctorGood for
Economyinferiq/fast$0.02–$0.035$0.065–$0.15Clear, common errors. Cheapest.
Balancedinferiq/balanced$0.035–$0.10$0.15–$0.45The default. Most bugs land here.
Strongestinferiq/best$0.10–$0.28$0.36–$1.50Tangled bugs across many files.
  • The quote’s maximum is the top of the range. Its estimate depends on how much there is to read.
  • You’re charged for the work the run did, the tokens it read and wrote, from the bottom of the range up to the maximum. Never more than the maximum.
  • A run that fails is charged nothing. It still gets a receipt.

What to send

A fix is only as good as what the agent can read. Say in a few sentences what’s going wrong, paste the error as it was printed, and attach the files it points at. In the console, files are attached from your computer; over the API the description goes in description and files in files, as a path and its text.

Quick Fix

Describe: what you were doing when it broke, what you expected to happen, what you already tried. For example: “The orders page crashes for new accounts right after login. Accounts with orders are fine. It started after I moved the fetch into a useOrders hook. I tried a ?. on orders, but then the page stays blank.”

Paste: The error message and its full stack trace, copied from your terminal or the browser console.

  • Start at the error line and copy down to the end of the stack trace.
  • Keep the lines that point into your own code, like src/… or app/….
  • One error per fix. If there are several, start with the first one.
A good paste
TypeError: Cannot read properties of undefined (reading 'map')
    at OrderList (src/components/order-list.tsx:14:22)
    at renderWithHooks (react-dom.development.js:16305:18)
AttachWhy
The files in the stack traceLike src/components/order-list.tsx. The agent reads the lines the error points at.
Files those import, if the bug may be thereTypes, hooks or helpers the failing code relies on.

Build Doctor

Describe: what changed before it broke: an upgrade, a new package, a config edit, where it fails: locally, in ci or on your host, what you already tried. For example: “npm run build fails on Vercel since I upgraded Next.js from 15 to 16. It still builds on my laptop. I already deleted node_modules and the lockfile and reinstalled.”

Paste: The whole output of the command that failed: npm install, npm run build, docker build, or your host’s build log.

  • Copy from the command itself down to the line where it exits with an error.
  • Keep the warnings above the error: they often name the package that broke.
  • For a very long log, the last 200 lines are usually enough.
A good paste
> next build
./app/(shop)/cart/page.tsx:3:10
Type error: Module '"next/navigation"' has no exported member 'useRouterState'.
Error: Command "npm run build" exited with 1
AttachWhy
package.jsonAlways. It says which versions you asked for.
Your lockfilepackage-lock.json, pnpm-lock.yaml, yarn.lock or bun.lock. Only the installed versions are read from it.
The file named in the errorLike app/(shop)/cart/page.tsx.
The config involvednext.config.js, vite.config.ts, tsconfig.json, Dockerfile or vercel.json, when the error mentions it.
File types
Any text file: source code (.ts, .tsx, .js, .jsx, .mjs, .py, .go, .rs, .java, .php, .rb, .vue, .svelte…), config (.json, .yaml, .toml) and Dockerfiles.
Leave out
Leave out .env and key files (they’re refused), node_modules, build output like dist/ or .next/, and images or other binary files.
Limits in the console
Up to 10 files, 200 KB each. Lockfiles may be up to 1.5 MB, since only the versions they pin are read.
Limits per request
Quick Fix reads up to 60,000 characters and Build Doctor up to 160,000, log and files together, after lockfiles are reduced. The whole request may be up to 2 MB.

How a fix runs

  1. Ask for a quote

    Send the error log and the files it points at, and pick an agent and a tier. You get an estimate and a hard maximum. Quotes are free and last five minutes.

  2. Approve it

    Approving holds the maximum from your balance. If your available balance (your balance minus what’s held for other runs and requests) is below the maximum, the run won’t start and the quote stays usable.

  3. The agent works

    Each agent follows its own procedure. Quick Fix finds the stack frames in your own code and reads those files. Build Doctor reads package.json and the lockfile, lists the versions actually installed of the packages in the error, and checks them for known breaking changes. The lockfile’s text isn’t sent to the model, only those versions.

  4. The patch is checked

    Every hunk of the patch must match the files you sent. If one doesn’t, the agent is asked once to correct it. A patch that still doesn’t match comes back marked patch_applies: false with low confidence. The patch and the verify steps are also scanned for things a fix never needs (see below).

  5. You get the result and a receipt

    You’re charged the run’s actual cost and the rest of the hold is released. The receipt shows the quote, the hold, the charge and your balance before and after.

API

Fix calls need a key with the fix scope. If the key is limited to certain models, it must allow the tier’s alias (for example inferiq/balanced for Balanced), or the quote fails with model_not_allowed. See Authentication.

GET /v1/fix/agents
curl $INFERIQ_BASE_URL/fix/agents \
  -H "Authorization: Bearer $INFERIQ_API_KEY"

{
  "object": "list",
  "data": [
    {
      "id": "quick-fix",
      "name": "Quick Fix",
      "steps": ["Reading the error and stack trace", "Opening the files it points at", "Finding the cause and writing a patch", "Checking the patch"],
      "max_input_chars": 60000,
      "max_files": 10,
      "tiers": [
        { "id": "economy", "model": "inferiq/fast", "available": true, "price": { "min_micro": 20000, "max_micro": 35000 } },
        { "id": "balanced", "model": "inferiq/balanced", "available": true, "price": { "min_micro": 35000, "max_micro": 100000 } },
        { "id": "strongest", "model": "inferiq/best", "available": true, "price": { "min_micro": 100000, "max_micro": 280000 } }
      ]
    },
    { "id": "build-doctor", … }
  ]
}
POST /v1/fix/quote
curl $INFERIQ_BASE_URL/fix/quote \
  -H "Authorization: Bearer $INFERIQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent": "build-doctor",
    "tier": "balanced",
    "description": "npm run build fails on Vercel since I upgraded Next.js to 16. It still builds locally.",
    "log": "Type error: Module \"next/navigation\" has no exported member useRouterState …",
    "files": [
      {"path": "package.json", "content": "…"},
      {"path": "package-lock.json", "content": "…"},
      {"path": "app/(shop)/cart/page.tsx", "content": "…"}
    ]
  }'

HTTP/1.1 201 Created
{
  "object": "fix.run",
  "id": "fix_Q2vR8sLm4TxN0bWk",
  "agent": "build-doctor",
  "tier": "balanced",
  "status": "quoted",
  "title": "Type error: Module \"next/navigation\" has no exported member useRouterState …",
  "source": "api",
  "model": "inferiq/balanced",
  "steps": ["Reading the build log", "Checking package.json and the installed versions", "Finding the cause and writing a patch", "Checking the patch"],
  "quote": { "estimate_micro": 196000, "max_micro": 450000, "expires_at": "2026-10-17T14:37:00.000Z" },
  "cost_micro": 0,
  "receipt_id": null,
  "result": null,
  "error": null,
  "created_at": "2026-10-17T14:32:00.000Z",
  "started_at": null,
  "finished_at": null,
  "duration_ms": null,
  "input": { "chars": 18420, "files": 3, "secrets_removed": 0, "left_out": [] }
}
agent
Required. quick-fix or build-doctor.
tier
Optional. economy, balanced (default) or strongest.
description
Optional, up to 4,000 characters. In your own words: what you were doing, what you expected, what happened and what you tried. The agent reads it before the log. Secrets are removed from it too.
log
Required. The error output, as plain text.
files
Optional. Up to 10 files with content, as { path, content }. A path without content tells the agent the error mentions it. Send only what the error points at; more input raises the estimate.
input.secrets_removed
How many secrets were replaced with [redacted] before anything was stored.
input.left_out
Files dropped because they only hold secrets, such as .env or key files.

Quick Fix reads up to 60,000 characters and Build Doctor up to 160,000, log and files together. Over that, or over 2 MB per request, the quote fails with context_too_large.

POST /v1/fix/runs
curl $INFERIQ_BASE_URL/fix/runs \
  -H "Authorization: Bearer $INFERIQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"quote_id": "fix_Q2vR8sLm4TxN0bWk"}'

{
  "object": "fix.run",
  "id": "fix_Q2vR8sLm4TxN0bWk",
  "status": "completed",
  "model": "qwen/qwen3.8-27b",
  "quote": { "estimate_micro": 196000, "max_micro": 450000, "expires_at": "2026-10-17T14:37:00.000Z" },
  "cost_micro": 188500,
  "receipt_id": "rcpt_hT3kWq9ZbN2xLp5R",
  "result": {
    "cause": "`useRouterState` was never part of `next/navigation`; it comes from TanStack Router …",
    "patch": "--- a/app/(shop)/cart/page.tsx\n+++ b/app/(shop)/cart/page.tsx\n@@ -1,8 +1,8 @@\n …",
    "verify": ["Run `npm run build`: type checking passes."],
    "confidence": "high",
    "patch_applies": true,
    "patch_problems": [],
    "warnings": []
  },
  "error": null,
  "usage": { "input_tokens": 6820, "output_tokens": 912 },
  "balance": { "before_micro": 12500000, "after_micro": 12311500 },
  "started_at": "2026-10-17T14:32:40.000Z",
  "finished_at": "2026-10-17T14:33:01.000Z",
  "duration_ms": 21000,
  …
}

Without stream the call answers once the run is done, usually within a minute. With stream: true it sends server-sent events: one step per step in the agent’s steps list, then done with the run.

POST /v1/fix/runs · stream: true
curl -N $INFERIQ_BASE_URL/fix/runs \
  -H "Authorization: Bearer $INFERIQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"quote_id": "fix_Q2vR8sLm4TxN0bWk", "stream": true}'

data: {"type":"step","index":0}

data: {"type":"step","index":1}

data: {"type":"step","index":2}

data: {"type":"step","index":3}

data: {"type":"done","run":{"object":"fix.run","id":"fix_Q2vR8sLm4TxN0bWk","status":"completed",…}}

If the run can’t start, the stream sends one error event instead:

Run refused
data: {"type":"error","error":{"message":"Available balance $0.120000 doesn't cover this fix's maximum of $0.450000. Add funds, or pick a cheaper tier.","type":"insufficient_quota","code":"insufficient_balance","retryable":false,"request_id":null}}

GET /v1/fix/runs/{id} returns the run with its status (quoted, running, completed, failed or expired) and, for 24 hours, its result. Use it if your connection drops during a run: the run finishes either way, and its receipt is written.

A quote runs once. Running it again fails with invalid_request, and running it after five minutes fails with quote_expired. From an editor, the same flow runs through the MCP server: inferiq_quote, then inferiq_fix once you approve the price (Connect your tool).

The result

result.cause
Why it fails, in a few sentences, naming files and lines.
result.patch
A unified diff. Nothing is applied for you. Empty when no code change is needed.
result.verify
One to four steps or commands that confirm the fix.
result.confidence
high, medium or low. Always low when the patch doesn’t match your files.
result.patch_applies
true when every hunk matched the files you sent, false when one didn’t, null when there was nothing to check (no patch, or it edits files you didn’t send).
result.warnings
What the safety scan found, each with a level (danger or caution) and a message. Empty when nothing was flagged. Confidence is always low when there’s a danger warning.
cost_micro
What you were charged, in micro-dollars (1,000,000 = $1).
receipt_id
The fix.run receipt. Its fix object holds the agent, tier, title and quote.
error
On a failed run: the code and message. A failed run costs nothing.

What a fix agent never does

  • Run commands or change files on your machine. It returns a patch; you or your own agent apply it.
  • Keep your code. It’s kept only until the run ends or the quote expires. Results are deleted after 24 hours; receipts keep only metadata.
  • Charge more than the maximum you approved.
  • Treat instructions inside your logs or files as orders. Error output is data, not instructions.

Code, logs and files can contain text written to steer an AI (prompt injection), for example in a dependency’s output or a file someone else wrote. Inferiq guards against it in three ways:

  • Your input is fenced with tags that change on every run, so text inside it can’t pose as instructions, and the agent is told to use it only as evidence. Invisible characters (zero-width, Unicode tags, bidi overrides) are removed first, and you’re told when there were any.
  • Every patch and verify step is scanned before you get it. Danger: downloading and running scripts, sending environment variables, secrets or cookies over the network, reverse shells, install scripts in package.json, deleting files outside the project, editing CI, git or shell config you didn’t send, writing outside the project, or hiding code in encoded strings. Caution: dependencies from outside the npm registry, TLS checks turned off, edits to files you didn’t send, long encoded blobs.
  • If the scan finds danger, the agent is asked once to fix the error without it. If it still can’t, you get the patch with warnings, low confidence and a red notice on the Fix page: read it before applying anything.
  • The explanation is checked too: links to sites that aren’t usual developer sites are flagged, an answer that repeats the agent’s hidden instructions is removed, and invisible bidi characters added by a patch (“Trojan Source”) count as danger.

Before anything is stored or sent to a model, Inferiq replaces common secret patterns (API keys, tokens, passwords, private keys, passwords in connection strings) with [redacted], and leaves out .env and key files entirely. The quote tells you how many were removed. Still, don’t paste secrets.