# Agent parameters

Every field of an Agent request, the processors and the model tiers, and everything a run returns.

| Call | Does | Cost |
|---|---|---|
| `POST https://api.millionshort.com/v1/agent` | Starts a run. Answers `202` with the run | Metered: see [Pricing](https://millionshort.com/docs/agent/pricing) |
| `GET https://api.millionshort.com/v1/agent/{id}` | Status, progress and steps; the result once the run has ended | Free |
| `GET https://api.millionshort.com/v1/agent/{id}/results` | The result alone. `202` with `"ready": false` while the run is going | Free |
| `GET https://api.millionshort.com/v1/agent/{id}/events` | The steps as server-sent events | Free |
| `DELETE https://api.millionshort.com/v1/agent/{id}` | Cancels the run | Free; work already done is charged |

## Request

Only `prompt` is required. Any field not listed here is a `400 INVALID_PARAM`.

### The question

| Field | Type | Default | Example | Notes |
|---|---|---|---|---|
| `prompt` | string, 3 to 4,000 characters | required | `"prompt": "Which provinces changed their minimum wage in 2026, and to what?"` | The question, or the task. Say what you want to know, and for when |
| `urls` | array of URLs, 1 to 10 | none | `"urls": ["https://example.org/report-2026"]` | Pages to read first, before any search. They pass the same URL rules, `robots.txt` and limits per site as [Extract](https://millionshort.com/docs/extract/parameters) |
| `schema` | object: a JSON Schema | none | `"schema": { "type": "object", "properties": { "founded": { "type": "integer" } } }` | Must have `"type": "object"` and `properties`. The result then comes back as `output` in this shape, and `answer` is `null`. See [With a schema](#with-a-schema) |

### Where the run may look

Each of these applies to every search the run makes.

| Field | Type | Default | Example | Notes |
|---|---|---|---|---|
| `sources` | array of [source slugs](https://millionshort.com/docs/search/sources), 1 or more | the run chooses among all of them | `"sources": ["web", "news"]` | The sources the run may search |
| `space` | string | none | `"space": "curated:home-cooking"` | A [Space](https://millionshort.com/docs/search/spaces): its sites and filters apply to every search. The request's own `include_domains` and `exclude_domains` win over the Space's |
| `remove_top_sites` | integer, 0 to 1,000,000 | `0` | `"remove_top_sites": 1000` | [Removes the N most popular sites](https://millionshort.com/docs/search/remove-top-sites) from every search |
| `include_domains` | array of strings, 1 to 20 | none | `"include_domains": ["canada.ca", "ontario.ca"]` | Search only these sites |
| `exclude_domains` | array of strings, 1 to 50 | none | `"exclude_domains": ["pinterest.com"]` | Leave these sites out |
| `start_date` | string, `YYYY-MM-DD` | none | `"start_date": "2026-01-01"` | Only results from this day on, on the sources that carry dates |

### How much work, and who writes

| Field | Type | Default | Example | Notes |
|---|---|---|---|---|
| `processor` | `lite`, `standard` or `pro` | `standard` | `"processor": "lite"` | How much work the run may do. A ceiling on work, not a price. See [Processors](#processors) |
| `model` | `auto` or one of the tiers in [Models](#models) | `auto` | `"model": "balanced"` | The model that writes the answer, by tier. Any other value is a `400` |
| `max_credits` | integer, 10 up to your plan's per-run cap | The lesser of your plan's per-run cap and what the tier needs: 40, 120 and 1,500 for `lite`, `standard` and `pro`, raised to the least the chosen tier needs | `"max_credits": 60` | The most the run may cost. Held when the run starts. Above your plan's per-run cap, the request is refused with `400 INVALID_PARAM`. See [The per-run cap](#the-per-run-cap) and [The cap](https://millionshort.com/docs/agent/pricing#the-cap-is-a-hold) |

### The per-run cap

`max_credits` may be at most your plan's per-run cap: Free 200, Starter 1,000, Growth 2,500, Scale 5,000, Business 10,000, Enterprise by agreement.

- **Above the cap, nothing starts.** The request is refused with `400 INVALID_PARAM`. The message names the cap, `error.details.plan_max_credits` carries it, and nothing is held or charged.
- **Left out,** `max_credits` is the lesser of your plan's cap and what the tier needs: the processor's own default, raised to the least the chosen tier needs.
- **Every run is charged at least 5 credits** when it ends `completed` or `incomplete`. [Pricing and limits](https://millionshort.com/docs/agent/pricing) has the prices: searches and pages at their list prices, and model tokens per 1,000 by tier.

### Being told

| Field | Type | Default | Example | Notes |
|---|---|---|---|---|
| `webhook_id` | string | none | `"webhook_id": "wh_01jd3v9k2m8q4r6s0t1u2v3w4x"` | An active [webhook](https://millionshort.com/docs/webhooks) endpoint of your team. An `agent.completed` event is delivered there when the run ends |

### The Idempotency-Key header

| Header | Type | Example | Notes |
|---|---|---|---|
| `Idempotency-Key` | string, up to 255 characters | `Idempotency-Key: fares-2026-11-20` | Optional. Honoured for 24 hours |

- The same key with the same body returns the run that key already made, as it stands now. Nothing new starts and nothing more is held. That answer is `200`, not `202`.
- The same key with a different body is a `409 IDEMPOTENCY_CONFLICT`.
- "The same body" means the same bytes. Send the JSON the same way when you retry.

## Processors

`processor` sets the most a run may do. A run often does less: it stops searching when it has what the question needs.

| Processor | Searches | Pages read | Follow-up searches | Second pass over citations | Writes on | Default `max_credits` |
|---|---|---|---|---|---|---|
| `lite` | up to 3 | up to 6 | none | no | `fast` | 40 |
| `standard` | up to 6 | up to 12 | up to 2 | yes | `fast` | 120 |
| `pro` | up to 12 | up to 24 | up to 4 | yes | `balanced` | 1,500 |

- **Follow-up searches** come after the first round of reading. The run asks what the question still needs and searches for that.
- **The second pass** reads each statement beside its quotes once more, and removes the statements the quotes do not show. See [How citations are enforced](https://millionshort.com/docs/agent#how-citations-are-enforced).
- **The default `max_credits`** is raised to the least the chosen tier needs when that is higher (`lite` with `balanced` and no `max_credits` holds 125), and cut to your plan's per-run cap when the cap is lower.

[Choosing a processor](https://millionshort.com/docs/agent/guides#choose-a-processor-a-model-and-a-cap) has advice.

## Models

`model` chooses which model writes the answer. You choose a tier, not a model by name: which model runs a tier is ours to choose, and it can change.

| `model` | What it is | Price of its tokens | Input, per 1,000 tokens | Output, per 1,000 tokens | Least `max_credits` |
|---|---|---|---|---|---|
| `auto` | The processor's own: `fast` on `lite` and `standard`, `balanced` on `pro` | as that tier |  |  |  |
| `fast` | The quickest and the cheapest (the default on `lite` and `standard`) | 1× | 0.4 | 2 | 10 |
| `balanced` | A larger model, at a higher price (the default on `pro`) | 20× | 8 | 40 | 125 |
| `best` | Our top-tier model, at the highest price | 40× | 16 | 80 | 245 |

- **`auto` is the default,** and it is right for most runs.
- **The multiplier** is the price of a tier's tokens against those of `fast`. A run that writes on a dearer tier pays that price for the writing step only.
- **Planning and checking always run on `fast`,** whatever `model` says. Only the writing step changes.
- **A dearer tier needs a higher cap.** `max_credits` under the tier's least value is a `400`, because less could not pay for an answer. On a plan whose per-run cap is under that value, the tier cannot be used at all: see [Errors](https://millionshort.com/docs/agent/errors#requests-that-are-refused).
- Output tokens include the model's thinking.

## The run

Every call returns the run in `data`, in the usual envelope with `request_id`, `usage` and `warnings`.

| Field | Type | Notes |
|---|---|---|
| `id` | string | `agt_` and 26 characters. Names the run in every other call |
| `status` | string | See [Status](#status) |
| `processor` | string | As asked for, or `standard` |
| `model` | string | The model that writes. `auto` is shown as the model it became |
| `max_credits` | number | The cap of this run, after any rise to what the tier needs or cut to the plan's per-run cap |
| `request` | object | The request as it was understood: the processor, the model, the cap and the fields you sent. `schema` is shown as `true` |
| `progress` | object | Where the run is: `step`, `searches`, `pages_read`, `model_calls`, and `credits` spent so far |
| `stop_reason` | string or null | Why the run ended. `null` until it has, and it stays `null` on a `failed` run: `error` says why. See [Stop reasons](#stop-reasons) |
| `webhook_id` | string or null | The endpoint named at the start |
| `created_at`, `started_at`, `finished_at` | timestamps | `started_at` and `finished_at` are `null` until they happen |
| `error` | object | On a `failed` run only: `code` and `message` |
| `steps` | array | What the run has done so far. On `GET /v1/agent/{id}`. See [Steps](#steps) |

Once the run has ended, `GET /v1/agent/{id}` also carries the result:

| Field | Type | Notes |
|---|---|---|
| `answer` | string or null | The answer, with `[n]` markers. Every statement has at least one. `null` with `schema`, and when nothing could be supported |
| `output` | object or null | With `schema`: the answer as data, in your shape |
| `citations` | array | One entry for each `[n]`. See [Citations](#citations) |
| `sources` | array | Every page the writer was given. See [Sources](#sources) |
| `uncited_removed` | integer | Statements removed because no quote of theirs was kept |
| `verified` | boolean | On `standard` and `pro` only: `true` when the second pass over the citations was made. `false` when it could not be afforded, reached or read; the quote check alone then stands, and the answer is kept. Absent on `lite`, and on a `standard` or `pro` run that ended before it reached the second pass |
| `field_citations` | object | With `schema`: each cited field of `output`, and its citation numbers |
| `uncited_fields` | array of strings | With `schema`: the filled top-level fields that no checked quote supports |
| `not_answered` | string | When the writer could tell: what the pages read did not answer |
| `schema_error` | string | With `schema`: why no `output` could be given |
| `attribution` | object | On a run that looked places up: the credit line (`text`, `url`) every [Places](https://millionshort.com/docs/places) answer carries. Show it, or a link to the page it names, wherever you show the answer. No parameter removes it |

`sources` lists the pages the writer was given. When the pages read do not fit in the writing step (in what is left of `max_credits`, or in one model call), the last ones are left out of the run: they are not in `sources`, and nothing can cite them. The writer is given each page up to a length: 6,000 characters on `lite`, 8,000 on `standard` and `pro`.

Runs are kept for 30 days after they end.

### Status

| `status` | Meaning |
|---|---|
| `queued` | Accepted, not started yet |
| `running` | Working. `progress` says where |
| `cancelling` | A cancel was asked for and the current step is stopping |
| `completed` | Ended with an answer. `stop_reason` is `done` |
| `incomplete` | Ended early. It carries what it has, which may be an answer, a partial one or none. `stop_reason` says why |
| `failed` | Ended without a result and without a charge: a fault on our side, which includes a run that was not started within 30 minutes, or a team that could not cover the run when it ended. `error` says which. `stop_reason` stays `null` |
| `cancelled` | Ended because you cancelled it |

The last four are endings: a run in one of them does not change again.

### Stop reasons

| `stop_reason` | Goes with | Meaning |
|---|---|---|
| `done` | `completed` | The run finished |
| `budget` | `incomplete` | The next step would have gone past `max_credits` |
| `time` | `incomplete` | The run reached 10 minutes |
| `no_sources` | `incomplete` | The searches found nothing the run could read |
| `no_support` | `incomplete` | Pages were read, and no statement could be supported by a quote |
| `no_answer` | `incomplete` | The model would not, or could not, write an answer in a form that can be checked |
| `cancelled` | `cancelled` | You cancelled it |

[Errors](https://millionshort.com/docs/agent/errors#runs-that-end-incomplete) says what to try for each.

### Steps

Each entry of `steps` has `seq`, a number that only goes up, `type`, and `at`, when it happened. The rest depends on the type.

| `type` | Also carries |
|---|---|
| `started` | `processor`, `model` |
| `plan` | `searches`: the searches planned, each with `query` and `source`. `places`, when the question names somewhere |
| `search` | `query`, `source`, `results`, and `new`: how many of them the run had not seen. A search that could not be served has `skipped` and is not charged |
| `places` | The lookup, and `results` |
| `read` | `asked` and `read`: pages asked for, and pages that came back |
| `gap_check` | `searches`: the follow-up searches. On `standard` and `pro` |
| `write` | `statements` and `quotes_checked`. With `schema`: `schema_valid` and `fields_with_quotes` |
| `verify` | `checked` and `unsupported`: the second pass. On `standard` and `pro` |
| `check` | `statements_kept` and `statements_removed`. With `schema`: `fields_cited` and `fields_uncited` |

The steps say what the run did, not what it read: page text is never in a step. The list keeps the most recent steps of a long run. Treat the fields beyond `seq`, `type` and `at` as information for a person or a log; new ones can be added.

### Citations

| Field | Type | Notes |
|---|---|---|
| `n` | integer | The number of the `[n]` marker. `citations[n-1]` is citation `n` |
| `url` | string or null | The page. `null` for a citation of places |
| `title` | string or null | |
| `source` | string | The source the page came from |
| `quote` | string | The words of the page that support the statement: one unbroken run of the text we fetched, at least 3 words and 12 characters |

### Sources

| Field | Type | Notes |
|---|---|---|
| `url` | string or null | |
| `title` | string or null | |
| `source` | string | |
| `how` | string | Where the text came from: `search` (it came with the search result), `cached` (a stored copy), `live` (fetched for this run) or `places` |
| `cited` | boolean | Whether the answer cites it |

### With a schema

- `schema` is a JSON Schema whose top level is `"type": "object"` with `properties`. Describe a field with `description` when its name does not say enough: the writer reads it.
- `output` follows the schema. A field the pages did not answer can be left out or `null`, as your schema allows.
- `field_citations` has an entry for each cited field, with its citation numbers: `"founded": [1, 3]`.
- A top-level field counts as cited when a quote was kept for it or for a value inside it: a quote for `items[0].price` cites `items`. Read `field_citations` to see which values those were.
- `uncited_fields` lists the top-level fields that are filled and have none. They are returned so that you can see them, and named so that you do not mistake them for checked ones.
- `citations` and `sources` are as for a text answer.

### Usage

`usage` is in the envelope, beside `data`. It is all zeros and empty objects until the run ends, because a run is charged once, at its end. `progress.credits` is the running figure before then.

| Field | Notes |
|---|---|
| `credits` | What the run was charged |
| `cost_usd` | The same amount in US dollars |
| `breakdown` | The charge by line. See below |
| `steps` | The counts behind it: `searches`, `pages_read`, `places_lookups`, `model_calls`, `input_tokens`, `output_tokens` |

| Line of `breakdown` | What it is |
|---|---|
| `search` | The searches, per source searched |
| `search_content` | The page text that came with search results |
| `extract_cached` | Pages read from a stored copy |
| `extract_live` | Pages fetched live |
| `places` | Places lookups |
| `model_input`, `model_output` | The model's tokens, in and out |
| `minimum` | What was added to bring a small `completed` or `incomplete` run up to the least such a run is charged. Never on a cancelled run |
| `over_cap_not_charged` | Negative. The part of a step that cost more than it was sized for. It is not charged, and the cap stands |

A line that is zero is left out. [Pricing and limits](https://millionshort.com/docs/agent/pricing) has the price of each.

## The result alone

```text
GET https://api.millionshort.com/v1/agent/{id}/results
```

| Field | Notes |
|---|---|
| `id`, `status` | As on the run |
| `ready` | `false` while the run is going: the answer is `202`, with a `Retry-After` header. `true` once it has ended |
| `stop_reason`, `answer`, `output`, `citations`, `sources`, `uncited_removed` | Once `ready` is `true`. As on the run, with `verified`, `field_citations`, `uncited_fields`, `not_answered`, `schema_error` and `attribution` where they apply |

## The event stream

```text
GET https://api.millionshort.com/v1/agent/{id}/events
```

Server-sent events. `?after=<seq>` skips the steps up to that number.

| Event | `data` |
|---|---|
| `agent.step` | One [step](#steps) |
| `agent.done` | `id`, `status`, `stop_reason` and `usage`. Sent once, when the run has ended |

A stream closes after `agent.done`, or after 5 minutes, whichever comes first. A team may have 2 open at once (`429 RATE_LIMITED` beyond). There is also a limit shared by all teams: when it is full the answer is `429 CAPACITY`, and you should poll instead. The [quickstart](https://millionshort.com/docs/agent/quickstart#5-follow-the-steps-as-they-happen) shows one being read.

## The webhook event

`agent.completed` is delivered to `webhook_id` when the run ends, whatever its ending. Its `data` has `id`, `status`, `stop_reason` and `credits_used`. [Webhooks](https://millionshort.com/docs/webhooks) says how deliveries are signed and retried.

## Limits

| Limit | Value |
|---|---|
| Runs going at once, per team | 3 |
| Event streams open at once, per team | 2 |
| The longest a run may take | 10 minutes |
| The longest one event stream stays open | 5 minutes |
| The longest a run waits to be started | 30 minutes; after that it ends `failed`, free |
| How long a run is kept after it ends | 30 days |
| `prompt` | 3 to 4,000 characters |
| `urls` | up to 10 |
| `include_domains`, `exclude_domains` | up to 20 and 50 |
| `max_credits` | 10 or more, up to the plan's per-run cap; above it, `400 INVALID_PARAM` naming the cap |
| `Idempotency-Key` | up to 255 characters, honoured for 24 hours |

Polling is free and does not count against your plan's requests a minute. It has a limit of its own, high enough for a poll every second on each of your runs; past it a poll is `429 RATE_LIMITED` with `Retry-After`.
