Menu

Agent

Agent errors

A request that is refused is an HTTP error and costs nothing. A run that started and could not finish is not an error; its status says how it ended.

Copy as MarkdownOpen in ChatGPT (opens in a new tab)Open in Claude (opens in a new tab)

There are two kinds of trouble, and they look different.

Requests that are refused

Status and codeWhenWhat to do
400 INVALID_PARAMA field the API does not take; no prompt, or one outside 3 to 4,000 characters; a schema that is not an object schema with properties; a model or processor that is not on the list; a value of the wrong type or out of rangeFix the request. message names the field
400 INVALID_PARAM with details.plan_max_creditsmax_credits is above your plan's per-run cap (Free 200, Starter 1,000, Growth 2,500, Scale 5,000, Business 10,000, Enterprise by agreement). The message names the cap; details has max_credits as sent and plan_max_credits, the capSend a cap at or under details.plan_max_credits, or leave it out
400 INVALID_PARAM with details.min_max_creditsmax_credits is under what the chosen tier needs to write an answer at allSend at least details.min_max_credits, or choose a cheaper tier
400 UNSUPPORTED_OPTIONThe tier needs a cap your plan's per-run cap cannot reach. details has model, min_max_credits and plan_max_creditsChoose another tier, or a plan with a higher per-run cap
401 AUTH_MISSING_KEY, 401 AUTH_INVALID_KEYNo Authorization header, or a key that is malformed, revoked or expiredSend a valid key
404 JOB_NOT_FOUNDNo run with that id for your team. Another team's run is answered the same wayCheck the id
404 SPACE_NOT_FOUNDThe space named at the start is not a Space you can useCheck the slug, or leave space out
409 IDEMPOTENCY_CONFLICTThe Idempotency-Key was already used, in the last 24 hours, with a different bodyUse a new key for a new request. To retry, send the same bytes
429 INSUFFICIENT_CREDITSYour credits do not cover max_credits, which is held when a run startsLower max_credits, or add credits
429 RATE_LIMITED3 runs are already going for your team; or 2 event streams are already open; or polls are coming too fastWait retry_after_seconds. For runs, wait for one to end. For streams, close one or poll
429 CAPACITYOpening an event stream when every stream we offer, across all teams, is in usePoll GET /v1/agent/{id} instead. The run is not affected
JSON
{
  "error": {
    "code": "INVALID_PARAM",
    "message": "max_credits must be at least 125 for model \"balanced\": less cannot pay for an answer.",
    "retry_after_seconds": null,
    "details": { "param": "max_credits", "model": "balanced", "min_max_credits": 125 }
  },
  "request_id": "req_01JD4FAB5P9V2X6Z8B0C"
}

A cap above the plan's, on the Free plan:

JSON
{
  "error": {
    "code": "INVALID_PARAM",
    "message": "max_credits of 300 is above this plan's per-run cap of 200. Send 200 or less, or leave max_credits out; a plan with a higher cap allows more.",
    "retry_after_seconds": null,
    "details": { "param": "max_credits", "max_credits": 300, "plan_max_credits": 200 }
  },
  "request_id": "req_01JD4FAC7R2W4Y6A8C1D"
}

Nothing is held for it, and nothing is charged.

In the SDKs, 400 INVALID_PARAM is a ValidationError, 400 UNSUPPORTED_OPTION an UnsupportedOptionError, a 404 a NotFoundError, 429 INSUFFICIENT_CREDITS an InsufficientCreditsError, 429 RATE_LIMITED a RateLimitError and 429 CAPACITY a CapacityError. Each carries details and retry_after_seconds.

Notes:

Errors says which errors are worth retrying, for every endpoint.

Runs that end incomplete

An incomplete run ended before it was done. stop_reason says why. It is charged for the work it did, at least 5 credits, and it is not an error: read what it carries.

stop_reasonWhat happenedWhat it carriesTry next
budgetThe next step did not fit in what was left of max_creditsUsually an answer, written from what was read before the cap. It may cover less of the questionRaise max_credits, or use a smaller processor or a cheaper tier
timeThe run reached 10 minutesNo answerAsk a narrower question, or use a smaller processor
no_sourcesThe searches found nothing the run could readNo answerWiden the scope: fewer include_domains, a smaller remove_top_sites, more sources, an earlier start_date. Or name pages in urls
no_supportPages were read, and no statement could be supported by a quote from themNo answer. sources lists what was read, and not_answered may say what was missingRephrase the question to what pages state outright, or widen the scope
no_answerThe model would not, or could not, write an answer in a form that can be checkedNo answer. sources lists what was readRun it again. If it repeats, rephrase the question

A run that ended on budget with an answer is still held to the same checks: every statement in it has a quote.

A run that ends completed can still say that one check was not made. On standard and pro, verified: false means the second pass over the citations could not be afforded, reached or read. The answer is kept, every quote in it was still found in its page, and only the second reading is missing. Run it again, or with a higher max_credits, if you need that pass.

Runs that fail

failed means the run ended with no result and no charge. Whatever was held is handed back. Nearly always the fault is ours: a worker stopped, the model or our own service could not be reached, or the run waited 30 minutes without being started. One case is not ours: a run whose error.code is INSUFFICIENT_CREDITS ended when the team could not cover it. Nothing was charged for that either.

Runs that are cancelled

cancelled means you sent DELETE /v1/agent/{id}.

Checking a run in code

Treat the four endings differently, and read stop_reason on incomplete:

Example
Python
import os

from millionshort import MillionShort, RateLimitError, ValidationError

client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"])

try:
    run = client.start_agent("What changed in Northbridge Transit fares in 2026?", max_credits=60)
except ValidationError as error:
    # details says what the limit is: plan_max_credits or min_max_credits
    raise SystemExit(f"{error.message} {error.details}")
except RateLimitError as error:
    raise SystemExit(f"Too many runs at once. Try again in {error.retry_after_seconds} seconds.")

done = client.wait_agent(run.id)
if done.status == "completed":
    print(done.answer)
elif done.status == "incomplete":
    print("Ended early:", done.stop_reason)
    if done.answer:
        print(done.answer)
elif done.status == "failed":
    # nothing was charged; the run id and the start's request id are what to send us
    print("Failed:", done.error["message"], run.id, run.request_id)
else:
    print("Cancelled.")
print(done.usage.credits)

This page as Markdown ยท llms.txt