Create Research Task
stage queued. The task then runs in the background. For the plan, create, poll, and read flow, see Run a Research Task.Authorization
Path parameters
…/knowledge-fs/spaces/<knowledge base ID>), and the segment after /datasets/new/ in the address bar.Headers
Optional key that makes creation safe to retry. Use 8 to 255 printable ASCII characters without leading or trailing whitespace; a malformed key answers 400.
Repeating the same key and body with the same API key returns the original task, in its current state, with 202 instead of creating another. Keys are unique within the workspace: reusing a key with a different body, from another API key, in another knowledge base, or for another operation answers 409.
Length: 8–255
Body
application/jsonSpend ceiling in USD. Enforced while the task runs, not at creation. The task is accepted even when the Plan Research Task estimate exceeds it. Before each model call, the task checks the call's worst-case cost against the budget, and it is canceled instead of making a call that could pass the budget.
A call can still cost more than its worst-case estimate, so cost.totalUsd can end above budgetUsd. A budget cancellation before the generating stage leaves the task with no answer. Worst-case costs usually run well above the plan's estimates, so when you need an answer, set the ceiling well above estimates.costUsd.max, and higher still for a large topK.
A task stopped by its budget ends in stage canceled.
Range: >= 0
Checked once, at creation, against the plan's estimates. A task whose estimates exceed a limit is rejected with 422. Omitting limits skips these checks. Use budgetUsd to bound spending while the task runs.
An estimate equal to its limit passes. Size these against the estimates from Plan Research Task.
Free-form object stored with the task and returned as metadata. Keys that start with __knowledgeFs are reserved and dropped.
Include a unique value such as client_request_id to recognize the task if the creation response is lost. This helps you find the task. To make a retry return the original task instead of creating another, send Idempotency-Key.
fast, deep, or research (see Retrieval Depth). Omit it to use the knowledge base's default depth, retrieval.default_mode in Get Knowledge Base Settings.fastdeepresearchnullLength: max 16000Pattern: \S
Range: 1–50
Responses
stage is queued, mode is the resolved depth, and cost.totalUsd is 0. A repeat with the same Idempotency-Key and body returns the original task in its current state.null when none was set.completed, failed, or canceled, in epoch milliseconds. null while the task is running.Failure code, the same value as failure.code. Present only when stage is failed, and null otherwise, including for canceled tasks.
On a failed research task, failure.code is one of RESEARCH_TASK_CAPABILITY_REVOKED, RESEARCH_TASK_DISPATCH_DEAD, RESEARCH_TASK_EXECUTION_ATTEMPTS_EXHAUSTED, RESEARCH_TASK_FAILED, RESEARCH_TASK_PERMISSION_SNAPSHOT_INVALID, or RESEARCH_TASK_RUNTIME_SNAPSHOT_INVALID.
Error details. Present only when stage is failed, and null otherwise. Members without a value are null here. traceId is the task ID.
When action is retry, create a new task with Create Research Task.
research_task_id in the task operations.null when the request carried no limits. A member that was not sent is null. Convert the keys back to camelCase before sending them to Create Research Task again.metadata object sent at creation, without keys that start with __knowledgeFs.fast, deep, or research.Where the task is in its lifecycle. Tasks move forward one stage at a time:
queued: accepted, waiting for a worker.planning: resolving the retrieval plan.retrieving: searching the knowledge base. A retrieval checkpoint may be written.analyzing: reading and weighing the retrieved chunks.generating: writing the answer. The final result is written during this stage.completed: finished. Read its results with List Research Task Results.failed: stopped with an error. Seeerrorandfailure.canceled: stopped by Cancel Research Task or by the budget.paused: The task is paused. Check any failure details with the deployment operator, or cancel it.
completed, failed, and canceled are terminal.
topK, or the knowledge base's TOP K when omitted.