A read-only snapshot of a background job, returned by job_read(),
job_run() and job_cancel(). Read fields with $. It holds plain data
only, never an agent, chat, tools, callbacks or credentials.
Usage
AgentJob(
path,
revision,
id,
status,
task,
owner_id,
definition_revision,
context_revision,
usage_limits,
usage,
associations = list(),
manifest = list(),
allocation = list(),
reservations = list(),
pending_approval = NULL,
pending_decision = NULL,
transitions = list(),
events = list(),
result = NULL,
error = NULL,
cleanup = list(),
runtime = list(),
graph = NULL,
source = list(),
control = list()
)Arguments
- path
The job directory.
- revision
Revision number; it goes up with each update.
- id
Job ID.
- status
One of
"queued","running","resuming","approval_pending","completed","failed","cancelled"or"indeterminate". The last four are final.- task
The task text.
- owner_id
The
owner_idgiven tojob_create().- definition_revision
The
definition_revisiongiven tojob_create().- context_revision
The
context_revisiongiven tojob_create().- usage_limits
UsageLimits for the job.
- usage
AgentUsage so far.
- associations
The
associationslist given tojob_create().- manifest
The agent setup saved by
job_create(), whichjob_run()checks the rebuilt agent against.- allocation
The usage limits set aside when the job was created.
- reservations
Whether that allocation is still held or has been released.
- pending_approval
Details of the approval the job is waiting for, including its
path, orNULL.- pending_decision
The approval decision being applied (
decision,tool_input,recorded_at), orNULL.- transitions
Status changes, each with
from,to,atandreason. Only the latest 128 are kept.- events
Simplified run events: at most the latest 512, fewer if needed to stay within the storage limit.
- result
Summary of the final AgentResult (
response,stop_reason,usageand so on), orNULL.- error
Summary of the error that ended the job (
class,messageand so on), orNULL.- cleanup
Who is responsible for cleaning up the job's resources, and whether cleanup has run.
- runtime
State saved while the job ran, such as the tool calls it executed.
- graph
Usage and limits of the retained agent graph, or
NULLfor a single agent.- source
IDs of the agents, sessions and runs involved.
- control
Cancellation state: whether
job_cancel()was called, and its reason.