Skip to main content
POST
Create Agent Thread

Permissions

Requires Agents and workflows API and Use agents and workflows permissions. If these permissions are not available to select, contact support@harvey.ai.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

multipart/form-data
agent_id
string<uuid>
required

The agent to run in the new thread.

Example:

"01a0d9c9-3334-7036-ad4a-d14db13b93ba"

prompt
string
required

The instruction for the agent to execute.

Required string length: 1 - 4000
Example:

"Summarize the termination rights in this agreement. For each, state who may exercise it, the notice period, and any cure period."

client_matter_id
string

Client matter to attribute the work to. Accepts either the matter's id or name. Required if your workspace requires a client matter on every query.

Required string length: 1 - 128
Example:

"2024-0147"

files
file[]

A document for the agent to read. Repeat the field once per document. Up to 50 files, 100 MB per file and 100 MB across the whole request. A file whose type or size is not accepted refuses the entire request.

Response

Thread created.

A thread and the agent run it holds.

id
integer

The unique identifier of the agent thread.

status
enum<string>

Lifecycle state of a thread. COMPLETED, ERRORED and CANCELLED are terminal.

Available options:
PENDING,
IN_PROGRESS,
COMPLETED,
ERRORED,
CANCELLED
agent_id
string<uuid> | null

The agent this thread ran. Null until the agent begins executing.

client_matter_id
string<uuid> | null

The client matter this thread is attributed to, as a UUID, even if you supplied a name. Null when none was supplied.

harvey_url
string<uri>

Link to the thread in the Harvey web app, for handing the work to a person.

created_at
string<date-time>

When the thread was created.

output
object | null

What the agent produced. Null until status is terminal, and on a thread that produced no answer.

error
string | null

Why the thread did not complete. Null unless status is ERRORED or CANCELLED.

files
object[]

The documents you attached, each with the processing status recorded for it. Generated files live under output.files instead.