# Agent

> Ask Kipp, DarkCrawl's agent, a question. It reads onion pages, chooses which links to follow and returns one answer with its sources.

Kipp is DarkCrawl’s agent, and it only reads: it never posts, logs in or fills in a form other than a site’s own search.

`POST /v2/agent` starts a Kipp job. You give the prompt and, if you like, the pages to start from and a JSON schema for the answer. DarkCrawl reads those pages over Tor, lets a model choose which links to follow, and returns one answer with the stored captures it rests on. It needs a model provider on the server, and answers `503 AI_UNAVAILABLE` without one.

**curl**

```bash
curl -X POST https://api.darkcrawl.dev/v2/agent \
  -H "Authorization: Bearer $DARKCRAWL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"Where did the mirror list move?","urls":["http://exampleonionq7x2mfk4lzr5w3ty6hbnc2jdu7avs4ekp5gw3xmlq2zr.onion/notice"]}'
```

**Python**

```python
import os
import requests

resp = requests.post(
    "https://api.darkcrawl.dev/v2/agent",
    headers={"Authorization": "Bearer " + os.environ["DARKCRAWL_API_KEY"]},
    json={
        "prompt": "Where did the mirror list move?",
        "urls": ["http://exampleonionq7x2mfk4lzr5w3ty6hbnc2jdu7avs4ekp5gw3xmlq2zr.onion/notice"],
    },
    timeout=330,
)
print(resp.json())
```

**Node**

```javascript
const resp = await fetch("https://api.darkcrawl.dev/v2/agent", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.DARKCRAWL_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "prompt": "Where did the mirror list move?",
    "urls": [
      "http://exampleonionq7x2mfk4lzr5w3ty6hbnc2jdu7avs4ekp5gw3xmlq2zr.onion/notice"
    ]
  }),
  signal: AbortSignal.timeout(330000),
});
console.log(await resp.json());
```

```json
{
  "success": true,
  "id": "01K0EXAMPLEJOB00000000000A",
  "threadId": "01K0EXAMPLETHREAD00000000A",
  "threadTurn": 1
}
```

The reply holds the job’s `id`, and the `threadId` and `threadTurn` of the thread it belongs to. Poll the status until it is no longer `processing`.

**curl**

```bash
curl https://api.darkcrawl.dev/v2/agent/JOB_ID \
  -H "Authorization: Bearer $DARKCRAWL_API_KEY"
```

**Python**

```python
import os
import requests

resp = requests.get(
    "https://api.darkcrawl.dev/v2/agent/JOB_ID",
    headers={"Authorization": "Bearer " + os.environ["DARKCRAWL_API_KEY"]},
    timeout=330,
)
print(resp.json())
```

**Node**

```javascript
const resp = await fetch("https://api.darkcrawl.dev/v2/agent/JOB_ID", {
  headers: {
    Authorization: "Bearer " + process.env.DARKCRAWL_API_KEY,
  },
  signal: AbortSignal.timeout(330000),
});
console.log(await resp.json());
```

```json
{
  "success": true,
  "status": "completed",
  "data": {
    "answer": "The mirror list moved to the forum thread on the second page [1]."
  },
  "expiresAt": "2026-12-26T10:00:00+00:00",
  "creditsUsed": 0,
  "sources": [
    {
      "n": 1,
      "url": "http://exampleonionq7x2mfk4lzr5w3ty6hbnc2jdu7avs4ekp5gw3xmlq2zr.onion/forum/thread/1",
      "scrapeId": "01K0EXAMPLECAPTURE0000000B",
      "fetchedAt": "2026-11-26T10:00:00+00:00",
      "sha256Markdown": "9f2c000000000000000000000000000000000000000000000000000000000000",
      "title": "Mirror list"
    }
  ],
  "pagesRead": 2,
  "steps": 3,
  "readWithAccount": false,
  "threadId": "01K0EXAMPLETHREAD00000000A",
  "threadTurn": 1
}
```

## What Kipp can do

The model never acts freely. At each step the code builds a short numbered menu: links from the pages read that stay on the services of your URLs, a next page, a site’s own GET search form, a search of the stored captures, and “answer”. The model picks a number. It writes no URL, and the code checks the pick again before anything runs.

Kipp sends only `GET` requests. It never types into a form other than a site’s own search, clicks a button, posts, logs in or out, or solves a CAPTCHA. Every page it opens is stored as a capture.

## Options

The body is strict: an unknown field is `400 BAD_REQUEST`, before any page is read.

| Option                  | What it does                                                                                                                                                                                  |
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `prompt`                | The question. 1 to 10,000 characters. Required.                                                                                                                                               |
| `urls`                  | The pages to start from. Each is checked as a batch scrape URL is. One refused URL refuses the request, with the list in `details.invalidURLs`. Without `urls`, the job starts from a search. |
| `schema`                | A JSON Schema for the answer. `data` then holds a value that fits it; without one, `data` is `{"answer": "<text>"}`.                                                                          |
| `strictConstrainToURLs` | `true` reads exactly the URLs you give, once each, then merges them into one answer. It needs `urls`.                                                                                         |
| `threadId`              | The `threadId` of an earlier job, to ask a follow-up. See below.                                                                                                                              |

A `/*` at the end of a URL reads within that site. `maxCredits`, `model` and `effort` are accepted and ignored: DarkCrawl uses no credits, and the model chain is the server’s. `webhook` answers `400 NOT_IMPLEMENTED`: poll the status instead. So do `mode`, `exchange`, `location`, `zeroDataRetention`, `threatProtection`, `auditMetadata` and `safe`.

## The answer

- `status` is `processing`, `completed` or `failed`. `data` is there only when `completed`.
- `sources` lists the stored captures the answer cites, numbered in the order they were read, with each page’s `scrapeId` and the hash of its Markdown. The code proves each cited page was read and stored. It cannot prove each sentence follows from the page, so check the captures before you rely on an answer.
- `pagesRead`, `steps` and `warning` count the work. `warning` appears when the answer cites no page.
- `expiresAt` says when the job is deleted. After it, every route answers `404`.
- A job that stops at a limit reads `failed` with an `error` that names it, and a `stopReason` of `step_limit`, `page_limit`, `time_limit` or `spend_limit`. When one more model call could still be made, `partial` holds the best answer from what was read. No request can raise a limit.
- A cancelled job reads `failed` with `error: "Agent was cancelled"`.

## Follow-up questions

Send `threadId` with a new `prompt` to ask a follow-up. Fields you leave out come from the previous turn: `urls`, `schema` and `strictConstrainToURLs`. The thread remembers earlier questions, answers and cited pages, and does not read a page again. `GET /v2/agent/threads/{threadId}` lists a thread’s runs, and `?includeData=true` adds their answers. A `threadId` DarkCrawl did not issue is a `400`, an unknown thread a `404`, and a thread whose last turn is still `processing` a `409`.

## Cancel

`DELETE /v2/agent/{job_id}` stops a job at its next check. A job that has finished answers `409`.

## Limits

A run counts as one request, reserves its pages, and counts toward the plan’s agent runs a day. Its model calls count toward the day’s AI use. It can also reach the requests, pages and jobs running at once of the plan. A status read is not a request, but it has a limit of its own. The values are on [Rate limits](https://darkcrawl.dev/docs/api-reference/rate-limits/).

## Reference

- [POST /v2/agent](https://darkcrawl.dev/docs/api-reference/agent/post-v2-agent/)
- [`GET /v2/agent/{job_id}`](https://darkcrawl.dev/docs/api-reference/agent/get-v2-agent-job-id/)
- [`DELETE /v2/agent/{job_id}`](https://darkcrawl.dev/docs/api-reference/agent/delete-v2-agent-job-id/)
- [`GET /v2/agent/threads/{thread_id}`](https://darkcrawl.dev/docs/api-reference/agent/get-v2-agent-threads-thread-id/)
