Background subagents and job collection

DataMind Oda can hand part of a task to a subagent that runs in the background. The subagent keeps working while the chat carries on, and its result is collected later as a job. This page covers how such a run starts, how its output is collected, and how it is stopped.

How a background run starts

When Oda delegates work to a background subagent, the delegation call returns at once with the line started background subagent job <id>, and the run keeps going while the chat carries on.

The delegation call itself, its description and prompt fields, and how a run that waits returns its result are in Delegating work to subagents.

Collect a run's output

Oda reads a background run with its job tools: job_output returns a job's output, and job_list shows the jobs of the chat. A background job belongs to the chat that started it, and it is read from there.

A finished run reads as the subagent's final text followed by one status line:

Around those lines:

Until the job is read, its output lives only in the job's record; nothing about it reaches the chat on its own. For the job list and the activity monitor in the app, see Background runs and jobs.

Stop a run

To stop a run before it finishes, Oda stops its job with job_kill. The stop takes a short reason; when none is given, the reason is background subagent task killed. A stopped job then reads as killed with that reason, for example [status: killed, no longer needed].

When a run instead ends with a problem of its own, it reads as failed. Subagent failures and diagnostics collects the messages a run can produce and what they mean.

One-shot or continuable

A delegation tool starts one of two shapes, and each brings its result back a different way:

The default shape is one-shot, and the background mode is set per delegation tool; Subagent settings covers the limits around it. How a continuable subagent reports its outcome is in Subagent settlement and results.

Questions, answered

How does a background run's result come back?

As a job. Oda reads the job with job_output, and a finished run returns the subagent's final text with [status: completed]. The result does not come back through the delegation call that started the run.

What happens to a background run's output if it is never collected?

It stays in the job's record in the chat that started it, and nothing about it reaches the chat on its own. When the job is read, the output is delivered once; a later read reports (no new output) with the final status.

When does a background subagent read as failed?

When the run ends with a problem instead of finishing. The line carries the run's stop reason and a diagnostic, in the form [status: failed, <stop reason>; diagnostic: <text>]. If cleaning up after the failure also fails, the line adds ; dispose failed: <error>.

Why does a stopped run read as killed and not failed?

Because it was cancelled from the chat, not ended by a problem inside the run. A killed line carries the reason given when it was stopped, like [status: killed, no longer needed], and no diagnostic. A run that ends with a problem of its own reads as failed.

Can a background subagent be stopped while it runs?

Yes. Oda stops its job with job_kill, which takes a short reason; when none is given, the reason is background subagent task killed. The job then reads as killed with that reason.

Is a background subagent the same as a continuable subagent?

No. A one-shot background run returns a job that Oda collects with the job tools; a continuable subagent returns only its id and reports back with a single settlement notice. See Continuable subagents.

Why was a background run refused?

Background runs are switched off for the delegation tool. The option is not offered on the call, and a call that still asks for one is refused with run_in_background is disabled for this tool instance (enableRunInBackground: false).

What does (no new output) mean?

The job's output was already delivered. A later read repeats the final status line and adds nothing, so the output is never delivered twice.