API

SparkAgentThread

Operations

Every route this entity exposes. Each route links to its own reference on this page.

Method Route SDK operation Returns
POST /api/v1/organizations/{organization_id}/agents/{id}/spark/threads create Native agent lifecycle response
POST /api/v1/organizations/{organization_id}/agents/{id}/spark/threads/{thread_id}/archive create Thread archive state confirmed; history is retained
POST /api/v1/organizations/{organization_id}/agents/{id}/spark/threads/{thread_id}/compact create Native agent lifecycle response
POST /api/v1/organizations/{organization_id}/agents/{id}/spark/threads/{thread_id}/snooze create Snooze confirmed by the runtime. New activity in the thread also wakes it
GET /api/v1/organizations/{organization_id}/agents/{id}/spark/threads list Native agent lifecycle response

Examples

One example per SDK, generated from the API model. The argument names are the parameters and fields of this entity, and the values are placeholders. The examples are not compiled or executed.

Golang

Construct client as shown in the Golang setup, then call the operations:

spark_agent_threads, err := client.SparkAgentThread(nil).List(map[string]any{"agent_id": "example", "organization_id": "example"}, nil)
if err != nil {
    panic(err)
}
fmt.Println(spark_agent_threads)
created, err := client.SparkAgentThread(nil).Create(map[string]any{"agent_id": "example", "organization_id": "example"}, nil)
if err != nil {
    panic(err)
}
fmt.Println(created)

Lua

Construct client as shown in the Lua setup, then call the operations:

local spark_agent_threads, err = client:SparkAgentThread():list({ agent_id = "example", organization_id = "example" })
local created, err = client:SparkAgentThread():create({ agent_id = "example", organization_id = "example" })

PHP

Construct client as shown in the PHP setup, then call the operations:

$spark_agent_threads = $client->SparkAgentThread()->list(["agent_id" => "example", "organization_id" => "example"]);
$created = $client->SparkAgentThread()->create(["agent_id" => "example", "organization_id" => "example"]);

Python

Construct client as shown in the Python setup, then call the operations:

spark_agent_threads = client.SparkAgentThread().list({"agent_id": "example", "organization_id": "example"})
created = client.SparkAgentThread().create({ "agent_id": "example", "organization_id": "example" })

Ruby

Construct client as shown in the Ruby setup, then call the operations:

spark_agent_threads = client.SparkAgentThread.list({ "agent_id" => "example", "organization_id" => "example" })
created = client.SparkAgentThread.create({ "agent_id" => "example", "organization_id" => "example" })

TypeScript

Construct client as shown in the TypeScript setup, then call the operations:

const spark_agent_threads = await client.SparkAgentThread().list({ agent_id: "example", organization_id: "example" })
const created = await client.SparkAgentThread().create({ agent_id: "example", organization_id: "example" })

Fields

Field Type Required Description
archive_deletes_sandbox boolean No Archive Deletes Sandbox
archived boolean Yes Archived
attention one,object,null Yes Why the person should open this thread: a pending question, the agent asking for attention, or a run that did not finish.
can_archive boolean Yes Can Archive
can_compact boolean Yes Can Compact
can_snooze boolean Yes Can Snooze
coordination_status one,string,null No Durable work not represented by a native run: a queued input or an outstanding thread report.
execution any No device_folder threads also report state and path; sandbox threads run on their own machine with the coding agent in harness.
first_input any No First Input
first_input_key string No Idempotency-Key that finds the first message through input_delivery.
first_input_requester_membership_id string No Membership the first message was sent as, for input_delivery.
group string Yes Rails-owned list group, in precedence order: attention, active run, coordination custody, then done.
has_active_run boolean Yes Has Active Run
id string Yes Id
inherit_context boolean No Include the source conversation through its last completed reply.
is_main boolean Yes Is Main
kind string Yes Kind
message string No The thread's first message.
older boolean Yes Nothing needs the person here, it is not working, and it has not changed for a day; the list folds it under Older.
parent_conversation_id string No Optional source conversation belonging to this agent.
parent_conversation_title string No Source conversation title, resolved independently of this page.
requester_membership_id string No Requester Membership Id
snoozed_until one,string,null Yes When a snoozed thread returns to its usual group; null when it is not snoozed.
thread object Yes Thread
title string No Title
updated_at one,string,null Yes Updated At

create

POST /api/v1/organizations/{organization_id}/agents/{id}/spark/threads

Operation ID: post_api_v1_organizations_organization_id_agents_id_spark_threads.

Authentication: bearer token (bearerAuth).

Parameters

Parameter In Type Required Description
organization_id path string Yes
id path string Yes
Idempotency-Key header string Yes

Request body

application/json

Property Type Required Description
execution object or object No
inherit_context boolean No Include the source conversation through its last completed reply. Defaults to true when a source is supplied. Without a source, the conversation starts with no inherited history regardless of this value.
message string No The thread's first message. Without a title, Rails names the thread from it; the message is then sent as the thread's first turn under a key derived from Idempotency-Key, so a retried creation does not send it twice.
parent_conversation_id string No Optional source conversation belonging to this agent. Omit to start a standalone conversation with no inherited history.
requester_membership_id string No
title string No

Responses

200: Native agent lifecycle response

application/json

Property Type Required Description
first_input object or object No
first_input_key string No Idempotency-Key that finds the first message through input_delivery. Present with first_input.
first_input_requester_membership_id string No Membership the first message was sent as, for input_delivery. Absent when it is bound to none.
thread object Yes
thread.archive_deletes_sandbox boolean No
thread.archived boolean Yes
thread.attention object,null Yes Why the person should open this thread: a pending question, the agent asking for attention, or a run that did not finish.
thread.attention.kind enum: question, agent, failed Yes
thread.attention.text string Yes
thread.can_archive boolean Yes
thread.can_compact boolean Yes
thread.can_snooze boolean Yes
thread.coordination_status enum: queued, waiting, null No Durable work not represented by a native run: a queued input or an outstanding thread report.
thread.execution object No device_folder threads also report state and path; sandbox threads run on their own machine with the coding agent in harness.
thread.execution.base_branch string No The branch a sandbox thread's machine cloned, when it was started from one.
thread.execution.branch string No The branch a sandbox thread's last workspace check saw. Absent after newer activity, until the next check.
thread.execution.device_id string,null No
thread.execution.device_name string,null No
thread.execution.environment object No The repository's current setup state, only for a sandbox thread that started without a ready environment.
thread.execution.environment.can_check_branch boolean No Whether this person can check this repository's environment recipe on a branch through Prepare. Needs a bot they manage and only they can use, in an organization with sandbox threads. Only in the repositories read.
thread.execution.environment.can_prepare boolean Yes Whether this person can start preparing the environment now. False while it is preparing, building or ready, unless a ready environment has a failed_update, and for people who cannot manage the bot.
thread.execution.environment.failed_update object No Only when ready. The repository's newest recipe on its default branch failed to build, so threads still start from the ready revision. Prepare builds it again.
thread.execution.environment.failed_update.failure_code string No
thread.execution.environment.failed_update.revision_id string Yes
thread.execution.environment.failure_code string No
thread.execution.environment.revision_id string No
thread.execution.environment.setup object No The latest setup run until a recipe revision exists, only when this bot ran it; other bots see the status alone. Prepare with a branch answers with the branch check it started.
thread.execution.environment.setup.branch string No The branch a check builds and proves. Only in the answer to the Prepare that started the check; the repositories read never shows a check.
thread.execution.environment.setup.conversation_id string No The setup or check thread's conversation, once it started
thread.execution.environment.setup.failed_step string No
thread.execution.environment.setup.failure_reason string No
thread.execution.environment.setup.pull_request_url string No
thread.execution.environment.status enum: none, preparing, building, failed, awaiting_trunk, unsupported, ... Yes none has no recipe build yet; preparing is a setup run writing the recipe; unsupported declares something bots cannot use, such as secrets; ready is the promoted revision thread sandboxes start from.
thread.execution.harness enum: codex, claude, pi No
thread.execution.kind enum: device_folder, sandbox Yes
thread.execution.model string No The model a sandbox thread the agent started runs, from its recorded selection.
thread.execution.model_label string No The display name of model, such as Claude Opus 5.5. Name the thread's author with it, not the coding agent.
thread.execution.path string No
thread.execution.repository_id string No The repository a sandbox thread's machine clones, when it has one.
thread.execution.repository_name string No The name of repository_id.
thread.execution.state string No
thread.group enum: needs, failed, working, queued, waiting, done Yes Rails-owned list group, in precedence order: attention, active run, coordination custody, then done. A snoozed thread lists as done, after every other row, and never folds under Older; snoozed_until marks it. Rows retain server order; only done rows may fold under Older.
thread.has_active_run boolean Yes
thread.id string Yes
thread.is_main boolean Yes
thread.kind enum: conversation, subagent Yes
thread.older boolean Yes Nothing needs the person here, it is not working, and it has not changed for a day; the list folds it under Older.
thread.parent_conversation_id string No Source conversation to return to.
thread.parent_conversation_title string No Source conversation title, resolved independently of this page.
thread.snoozed_until string,null (date-time) Yes When a snoozed thread returns to its usual group; null when it is not snoozed. Clients list rows with this set in their own Snoozed group.
thread.title string Yes
thread.updated_at string,null Yes
201: Native agent lifecycle response

application/json

Property Type Required Description
first_input object or object No
first_input_key string No Idempotency-Key that finds the first message through input_delivery. Present with first_input.
first_input_requester_membership_id string No Membership the first message was sent as, for input_delivery. Absent when it is bound to none.
thread object Yes
thread.archive_deletes_sandbox boolean No
thread.archived boolean Yes
thread.attention object,null Yes Why the person should open this thread: a pending question, the agent asking for attention, or a run that did not finish.
thread.attention.kind enum: question, agent, failed Yes
thread.attention.text string Yes
thread.can_archive boolean Yes
thread.can_compact boolean Yes
thread.can_snooze boolean Yes
thread.coordination_status enum: queued, waiting, null No Durable work not represented by a native run: a queued input or an outstanding thread report.
thread.execution object No device_folder threads also report state and path; sandbox threads run on their own machine with the coding agent in harness.
thread.execution.base_branch string No The branch a sandbox thread's machine cloned, when it was started from one.
thread.execution.branch string No The branch a sandbox thread's last workspace check saw. Absent after newer activity, until the next check.
thread.execution.device_id string,null No
thread.execution.device_name string,null No
thread.execution.environment object No The repository's current setup state, only for a sandbox thread that started without a ready environment.
thread.execution.environment.can_check_branch boolean No Whether this person can check this repository's environment recipe on a branch through Prepare. Needs a bot they manage and only they can use, in an organization with sandbox threads. Only in the repositories read.
thread.execution.environment.can_prepare boolean Yes Whether this person can start preparing the environment now. False while it is preparing, building or ready, unless a ready environment has a failed_update, and for people who cannot manage the bot.
thread.execution.environment.failed_update object No Only when ready. The repository's newest recipe on its default branch failed to build, so threads still start from the ready revision. Prepare builds it again.
thread.execution.environment.failed_update.failure_code string No
thread.execution.environment.failed_update.revision_id string Yes
thread.execution.environment.failure_code string No
thread.execution.environment.revision_id string No
thread.execution.environment.setup object No The latest setup run until a recipe revision exists, only when this bot ran it; other bots see the status alone. Prepare with a branch answers with the branch check it started.
thread.execution.environment.setup.branch string No The branch a check builds and proves. Only in the answer to the Prepare that started the check; the repositories read never shows a check.
thread.execution.environment.setup.conversation_id string No The setup or check thread's conversation, once it started
thread.execution.environment.setup.failed_step string No
thread.execution.environment.setup.failure_reason string No
thread.execution.environment.setup.pull_request_url string No
thread.execution.environment.status enum: none, preparing, building, failed, awaiting_trunk, unsupported, ... Yes none has no recipe build yet; preparing is a setup run writing the recipe; unsupported declares something bots cannot use, such as secrets; ready is the promoted revision thread sandboxes start from.
thread.execution.harness enum: codex, claude, pi No
thread.execution.kind enum: device_folder, sandbox Yes
thread.execution.model string No The model a sandbox thread the agent started runs, from its recorded selection.
thread.execution.model_label string No The display name of model, such as Claude Opus 5.5. Name the thread's author with it, not the coding agent.
thread.execution.path string No
thread.execution.repository_id string No The repository a sandbox thread's machine clones, when it has one.
thread.execution.repository_name string No The name of repository_id.
thread.execution.state string No
thread.group enum: needs, failed, working, queued, waiting, done Yes Rails-owned list group, in precedence order: attention, active run, coordination custody, then done. A snoozed thread lists as done, after every other row, and never folds under Older; snoozed_until marks it. Rows retain server order; only done rows may fold under Older.
thread.has_active_run boolean Yes
thread.id string Yes
thread.is_main boolean Yes
thread.kind enum: conversation, subagent Yes
thread.older boolean Yes Nothing needs the person here, it is not working, and it has not changed for a day; the list folds it under Older.
thread.parent_conversation_id string No Source conversation to return to.
thread.parent_conversation_title string No Source conversation title, resolved independently of this page.
thread.snoozed_until string,null (date-time) Yes When a snoozed thread returns to its usual group; null when it is not snoozed. Clients list rows with this set in their own Snoozed group.
thread.title string Yes
thread.updated_at string,null Yes
401: Unauthorized
403: Forbidden
404: Not found
422: Unprocessable entity
502: Bad gateway

POST /api/v1/organizations/{organization_id}/agents/{id}/spark/threads/{thread_id}/archive

Operation ID: post_api_v1_organizations_organization_id_agents_id_spark_threads_thread_id_archive.

Authentication: bearer token (bearerAuth).

Parameters

Parameter In Type Required Description
organization_id path string Yes
id path string Yes
thread_id path string Yes

Request body

application/json

Property Type Required Description
archived boolean Yes

Responses

200: Thread archive state confirmed; history is retained

application/json

Property Type Required Description
archived boolean Yes
deletable_workspace_id string No Exact workspace the manager can review for a separate deletion after archiving.
thread_id string Yes
401: Unauthorized
403: Forbidden
404: Not found
422: Unprocessable entity
502: Bad gateway

POST /api/v1/organizations/{organization_id}/agents/{id}/spark/threads/{thread_id}/compact

Operation ID: post_api_v1_organizations_organization_id_agents_id_spark_threads_thread_id_compact.

Authentication: bearer token (bearerAuth).

Parameters

Parameter In Type Required Description
organization_id path string Yes
id path string Yes
thread_id path string Yes

Request body

application/json

The request body is object.

Responses

200: Native agent lifecycle response

application/json

Property Type Required Description
status enum: completed, unchanged Yes
thread_id string Yes
401: Unauthorized
403: Forbidden
404: Not found
409: The conversation is busy (conversation_busy) or compaction could not finish (compaction_failed)

application/json

Property Type Required Description
code string No
error string Yes
422: Unprocessable entity
502: Bad gateway

POST /api/v1/organizations/{organization_id}/agents/{id}/spark/threads/{thread_id}/snooze

Operation ID: post_api_v1_organizations_organization_id_agents_id_spark_threads_thread_id_snooze.

Authentication: bearer token (bearerAuth).

Parameters

Parameter In Type Required Description
organization_id path string Yes
id path string Yes
thread_id path string Yes

Request body

application/json

Property Type Required Description
snoozed_until string,null (date-time) Yes A future time when the thread returns to its usual group, or null to wake it now.

Responses

200: Snooze confirmed by the runtime. New activity in the thread also wakes it

application/json

Property Type Required Description
snoozed_until string,null (date-time) Yes
thread_id string Yes
401: Unauthorized
403: Forbidden
404: Not found
422: Unprocessable entity
502: Bad gateway

list

GET /api/v1/organizations/{organization_id}/agents/{id}/spark/threads

Operation ID: spark_threads_api_v1_organization_persistent_agent.

Authentication: bearer token (bearerAuth).

Parameters

Parameter In Type Required Description
organization_id path string Yes
id path string Yes
archived query enum: exclude, only No
cursor query string No
conversation_id query string No
local_cursor query string No

Responses

200: Native agent lifecycle response

application/json

Property Type Required Description
archived_count integer,null No Exact total of archived conversations for this agent, including subagents but excluding workflow task, cron and system sessions. Null or omitted when the runtime cannot establish the complete total without an unbounded archive read; never a loaded-page count.
can_create boolean Yes
local_activities object Yes First page only: states of local threads listed on later pages, by local thread id, so a refresh keeps paged rows current.
local_archived_count integer Yes Local Claude Code and Codex threads archived on their computers.
local_next_cursor string,null Yes
local_scope_key string,null Yes
local_status_pending boolean Yes A computer is reporting newer local thread statuses; read the page again shortly.
local_threads array of object Yes
local_threads[].archived boolean Yes Archived on its computer: hidden from the active list and shown with the archived threads.
local_threads[].can_archive boolean Yes This requester can archive or restore it, and the computer's Desktop supports archiving.
local_threads[].can_disconnect_relay boolean No
local_threads[].can_end boolean Yes
local_threads[].can_interrupt boolean Yes
local_threads[].can_send boolean Yes
local_threads[].created_at string Yes
local_threads[].device_id string Yes
local_threads[].device_name string Yes
local_threads[].end object or null Yes
local_threads[].full_title string Yes The native name or first prompt in full, for a tooltip.
local_threads[].id string Yes
local_threads[].last_activity_at string,null (date-time) Yes
local_threads[].native_thread_id string Yes
local_threads[].parent_conversation_id string,null Yes
local_threads[].provider enum: codex, claude Yes
local_threads[].relay_disconnected_at string,null (date-time) No
local_threads[].relay_participant object No
local_threads[].relay_participant.aliases array of object Yes
local_threads[].relay_participant.aliases[].creating_operation_id string Yes Original operation that registered this alias, retained when its address is reused. Inspect with agent.rename_status.
local_threads[].relay_participant.aliases[].forward_until string,null Yes
local_threads[].relay_participant.aliases[].name string Yes
local_threads[].relay_participant.can_rename boolean Yes
local_threads[].relay_participant.canonical_name string Yes
local_threads[].relay_participant.management_actions array of object or object Yes
local_threads[].relay_participant.name string Yes
local_threads[].relay_participant.observation_action object,null Yes
local_threads[].relay_participant.observation_action.arguments object Yes
local_threads[].relay_participant.observation_action.arguments.operation_id string Yes
local_threads[].relay_participant.observation_action.name enum: agent.rename_status Yes
local_threads[].relay_participant.pending_operation_id string,null Yes
local_threads[].relay_participant.pending_retirement_id string,null Yes
local_threads[].relay_participant.scope_key string Yes
local_threads[].relay_participant.source_operation_id string Yes
local_threads[].relay_participant.version integer Yes
local_threads[].section enum: current, done, offline Yes Server-assigned section in the ordered computer thread directory.
local_threads[].status enum: running, waiting, stopped, failed, done, idle, ... Yes What the native thread is doing. Null until the computer reports it, or when its helper can't. Threads beyond the newest 50 keep the state from when their page loaded.
local_threads[].task_configured boolean Yes
local_threads[].title string Yes Short title: the native name, or the first prompt's first line without the agent's task preamble.
main_thread_id string Yes
next_cursor string,null Yes
selected_thread object or null Yes
threads array of object Yes
threads[].archive_deletes_sandbox boolean No
threads[].archived boolean Yes
threads[].attention object,null Yes Why the person should open this thread: a pending question, the agent asking for attention, or a run that did not finish.
threads[].attention.kind enum: question, agent, failed Yes
threads[].attention.text string Yes
threads[].can_archive boolean Yes
threads[].can_compact boolean Yes
threads[].can_snooze boolean Yes
threads[].coordination_status enum: queued, waiting, null No Durable work not represented by a native run: a queued input or an outstanding thread report.
threads[].execution object No device_folder threads also report state and path; sandbox threads run on their own machine with the coding agent in harness.
threads[].execution.base_branch string No The branch a sandbox thread's machine cloned, when it was started from one.
threads[].execution.branch string No The branch a sandbox thread's last workspace check saw. Absent after newer activity, until the next check.
threads[].execution.device_id string,null No
threads[].execution.device_name string,null No
threads[].execution.environment object No The repository's current setup state, only for a sandbox thread that started without a ready environment.
threads[].execution.environment.can_check_branch boolean No Whether this person can check this repository's environment recipe on a branch through Prepare. Needs a bot they manage and only they can use, in an organization with sandbox threads. Only in the repositories read.
threads[].execution.environment.can_prepare boolean Yes Whether this person can start preparing the environment now. False while it is preparing, building or ready, unless a ready environment has a failed_update, and for people who cannot manage the bot.
threads[].execution.environment.failed_update object No Only when ready. The repository's newest recipe on its default branch failed to build, so threads still start from the ready revision. Prepare builds it again.
threads[].execution.environment.failed_update.failure_code string No
threads[].execution.environment.failed_update.revision_id string Yes
threads[].execution.environment.failure_code string No
threads[].execution.environment.revision_id string No
threads[].execution.environment.setup object No The latest setup run until a recipe revision exists, only when this bot ran it; other bots see the status alone. Prepare with a branch answers with the branch check it started.
threads[].execution.environment.setup.branch string No The branch a check builds and proves. Only in the answer to the Prepare that started the check; the repositories read never shows a check.
threads[].execution.environment.setup.conversation_id string No The setup or check thread's conversation, once it started
threads[].execution.environment.setup.failed_step string No
threads[].execution.environment.setup.failure_reason string No
threads[].execution.environment.setup.pull_request_url string No
threads[].execution.environment.status enum: none, preparing, building, failed, awaiting_trunk, unsupported, ... Yes none has no recipe build yet; preparing is a setup run writing the recipe; unsupported declares something bots cannot use, such as secrets; ready is the promoted revision thread sandboxes start from.
threads[].execution.harness enum: codex, claude, pi No
threads[].execution.kind enum: device_folder, sandbox Yes
threads[].execution.model string No The model a sandbox thread the agent started runs, from its recorded selection.
threads[].execution.model_label string No The display name of model, such as Claude Opus 5.5. Name the thread's author with it, not the coding agent.
threads[].execution.path string No
threads[].execution.repository_id string No The repository a sandbox thread's machine clones, when it has one.
threads[].execution.repository_name string No The name of repository_id.
threads[].execution.state string No
threads[].group enum: needs, failed, working, queued, waiting, done Yes Rails-owned list group, in precedence order: attention, active run, coordination custody, then done. A snoozed thread lists as done, after every other row, and never folds under Older; snoozed_until marks it. Rows retain server order; only done rows may fold under Older.
threads[].has_active_run boolean Yes
threads[].id string Yes
threads[].is_main boolean Yes
threads[].kind enum: conversation, subagent Yes
threads[].older boolean Yes Nothing needs the person here, it is not working, and it has not changed for a day; the list folds it under Older.
threads[].parent_conversation_id string No Source conversation to return to.
threads[].parent_conversation_title string No Source conversation title, resolved independently of this page.
threads[].snoozed_until string,null (date-time) Yes When a snoozed thread returns to its usual group; null when it is not snoozed. Clients list rows with this set in their own Snoozed group.
threads[].title string Yes
threads[].updated_at string,null Yes
total_archived_count integer,null Yes archived_count plus local_archived_count, computed by Rails for the Archived heading. Null whenever archived_count is unknown.
401: Unauthorized
403: Forbidden
404: Not found
422: Unprocessable entity
502: Bad gateway