BackgroundOptions
Defined in: agents/src/runs.ts:82
Extends
Section titled “Extends”BackgroundBase
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Properties
Section titled “Properties”agent: Agent<T>;Defined in: agents/src/runs.ts:83
createContinuation?
Section titled “createContinuation?”optional createContinuation?: (input) => Promise<BackgroundContinuationResult>;Defined in: agents/src/runs.ts:105
Optional durable, owner-scoped create-or-reconcile capability. Required only to cancel a suspended logical run. Also used for answers when supplied. Never substitute a local cache or an idempotency flag for atomic host storage. See BackgroundContinuationInput.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
BackgroundContinuationInput |
Returns
Section titled “Returns”Promise<BackgroundContinuationResult>
Inherited from
Section titled “Inherited from”BackgroundBase.createContinuationenqueue
Section titled “enqueue”enqueue: (id) => Promise<void>;Defined in: agents/src/runs.ts:112
Await durable queue acceptance. A worker calls runs.drive(id, background.handlers). The host must also run runs.sweep on boot and periodically, and drain on shutdown.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
id |
string |
Returns
Section titled “Returns”Promise<void>
Inherited from
Section titled “Inherited from”BackgroundBase.enqueueevents?
Section titled “events?”optional events?: EventDurability;Defined in: agents/src/runs.ts:109
Coalesced progress uses emit by default. Awaited mode needs Run.append (server 0.21+).
Inherited from
Section titled “Inherited from”BackgroundBase.eventshistoryLimit?
Section titled “historyLimit?”optional historyLimit?: number;Defined in: agents/src/runs.ts:125
How many of the session’s newest messages start loads.
Inherited from
Section titled “Inherited from”BackgroundBase.historyLimitkind: string;Defined in: agents/src/runs.ts:99
Dedicated handler key for this agent version.
Inherited from
Section titled “Inherited from”BackgroundBase.kindmemory?
Section titled “memory?”optional memory?: (owner) => | MemoryBinding| Promise<MemoryBinding>;Defined in: agents/src/runs.ts:123
Authenticate scopes in start and again in the worker. A changed erasure revision refuses resume; this factory never recalls notes or ingests a completed run automatically.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
owner |
string |
Returns
Section titled “Returns”| MemoryBinding
| Promise<MemoryBinding>
Inherited from
Section titled “Inherited from”BackgroundBase.memoryonSegment?
Section titled “onSegment?”optional onSegment?: SegmentHook;Defined in: agents/src/runs.ts:116
Awaited before execution and after the SDK journal settles. May repeat after worker loss; the host must deduplicate/reconcile external effects. This is not host-row commit proof.
Inherited from
Section titled “Inherited from”BackgroundBase.onSegmentpolicy
Section titled “policy”policy: (context) => | BackgroundPolicy| Promise<BackgroundPolicy>;Defined in: agents/src/runs.ts:113
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
context |
BackgroundContext |
Returns
Section titled “Returns”| BackgroundPolicy
| Promise<BackgroundPolicy>
Inherited from
Section titled “Inherited from”BackgroundBase.policyprepareHistory?
Section titled “prepareHistory?”optional prepareHistory?: (history) => | AgentMessage[]| Promise<AgentMessage[]>;Defined in: agents/src/runs.ts:127
Runs once in start, before the run is saved. See RunOptions.prepareHistory.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
history |
AgentMessage[] |
Returns
Section titled “Returns”| AgentMessage[]
| Promise<AgentMessage[]>
Inherited from
Section titled “Inherited from”BackgroundBase.prepareHistoryruns: BackgroundRuns;Defined in: agents/src/runs.ts:101
Injected create must resolve after its transaction commits. Only then is enqueue called.
Inherited from
Section titled “Inherited from”BackgroundBase.runssession?
Section titled “session?”optional session?: (owner, id) => | Session| Promise<Session>;Defined in: agents/src/runs.ts:120
Trusted. Return the session id names, after checking that owner may use it: an id
from a request is not authorization. start reads its history inside the authenticated
request; the worker gets it again, with the stored owner, to append the turn.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
owner |
string |
id |
string |
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”BackgroundBase.session