Skip to content
Hoody.com

The agent Jobs endpoints let you poll the status and result of async work dispatched by the agent — workflow runs, long tool calls, dispatch jobs — and cancel pending work or clean up terminal records. Use them whenever you need to observe an in-flight job, retrieve a finished payload, or stop work that has not yet terminated.

Returns the gateway-minted job record: state, owning session, correlated workflow run id, terminal payload, and timestamps. run_id is null during the brief dispatch window for workflow runs before correlation completes.

NameInTypeRequiredDescription
idpathstringYesPath identifier.
X-Hoody-CwdheaderstringNoPer-request working-directory scope: the .hoody project layer / record cwd / tool+workflow cwd. Required by routes that resolve a cwd (e.g. POST /todos; createTodo also accepts a body cwd).
X-Hoody-Config-DirheaderstringNoPer-request --config-dir override selecting which on-disk .hoody install a stateless read/write resolves (HoodyPaths).
X-Hoody-ContainerheaderstringNoPer-request bound remote container (omitted = local). Rejected (400) on routes with no container dimension.
X-Hoody-RealmheaderstringNoPer-request realm selector: global or a 24-hex id (also accepted as ?realm=). Rejected (400 realm_scope_unsupported) on active-only / no-realm routes.
realmquerystringNoPer-request realm selector — the query alias of the X-Hoody-Realm header (read only when the header is absent): global or a 24-hex id. Rejected (400 realm_scope_unsupported) on active-only / no-realm routes.
{
"job_id": "01HXXXXXXXXXXXXXXXXXXXXXX",
"kind": "session.workflow",
"session_id": "sess_01HXXXXXXXXXXXXXXXXXXXXXX",
"run_id": "run_01HXXXXXXXXXXXXXXXXXXXXXX",
"status": "succeeded",
"result": {
"answer": "Add a unique index on (tenant_id, email) to enforce dedup at the storage layer."
},
"created_at": "2025-01-15T10:30:00.000Z",
"updated_at": "2025-01-15T10:30:42.123Z"
}
const job = await client.agent.jobs.getJob("01HXXXXXXXXXXXXXXXXXXXXXX");
console.log(job.status, job.result);
// With optional per-request headers / query params:
await client.agent.jobs.getJob("01HXXXXXXXXXXXXXXXXXXXXXX", {
realm: "global",
});

Returns the result of a completed job, or the running status. Dispatch jobs are observed on the session stream — the result endpoint returns terminal status only.

NameInTypeRequiredDescription
idpathstringYesPath identifier.
X-Hoody-CwdheaderstringNoPer-request working-directory scope: the .hoody project layer / record cwd / tool+workflow cwd. Required by routes that resolve a cwd (e.g. POST /todos; createTodo also accepts a body cwd).
X-Hoody-Config-DirheaderstringNoPer-request --config-dir override selecting which on-disk .hoody install a stateless read/write resolves (HoodyPaths).
X-Hoody-ContainerheaderstringNoPer-request bound remote container (omitted = local). Rejected (400) on routes with no container dimension.
X-Hoody-RealmheaderstringNoPer-request realm selector: global or a 24-hex id (also accepted as ?realm=). Rejected (400 realm_scope_unsupported) on active-only / no-realm routes.
realmquerystringNoPer-request realm selector — the query alias of the X-Hoody-Realm header (read only when the header is absent): global or a 24-hex id. Rejected (400 realm_scope_unsupported) on active-only / no-realm routes.
{
"status": "succeeded",
"result": {
"answer": "Add a unique index on (tenant_id, email) to enforce dedup at the storage layer."
},
"session_id": "sess_01HXXXXXXXXXXXXXXXXXXXXXX"
}
const result = await client.agent.jobs.getJobResult("01HXXXXXXXXXXXXXXXXXXXXXX");
console.log(result.status, result.result);

Cancels a pending / running async job, or deletes a succeeded / failed / canceled job’s immutable historical record. A pending/running job transitions to canceled and its work is stopped at the source: a sessionless run (headless / long tool call) has its bounded context cancelled; a session dispatch / workflow turn is stopped via session.cancel (the active turn is cancelled, the session and its background tasks are spared). A terminal job’s record is removed.

NameInTypeRequiredDescription
idpathstringYesPath identifier.
X-Hoody-CwdheaderstringNoPer-request working-directory scope: the .hoody project layer / record cwd / tool+workflow cwd. Required by routes that resolve a cwd (e.g. POST /todos; createTodo also accepts a body cwd).
X-Hoody-Config-DirheaderstringNoPer-request --config-dir override selecting which on-disk .hoody install a stateless read/write resolves (HoodyPaths).
X-Hoody-ContainerheaderstringNoPer-request bound remote container (omitted = local). Rejected (400) on routes with no container dimension.
X-Hoody-RealmheaderstringNoPer-request realm selector: global or a 24-hex id (also accepted as ?realm=). Rejected (400 realm_scope_unsupported) on active-only / no-realm routes.
realmquerystringNoPer-request realm selector — the query alias of the X-Hoody-Realm header (read only when the header is absent): global or a 24-hex id. Rejected (400 realm_scope_unsupported) on active-only / no-realm routes.
{
"status": "ok",
"canceled": true,
"deleted": false
}
// Cancel a pending/running job, or delete a terminal job's record:
const outcome = await client.agent.jobs.deleteJob("01HXXXXXXXXXXXXXXXXXXXXXX");
if (outcome.canceled) {
// transitioned to "canceled"
} else if (outcome.deleted) {
// terminal record removed
}