roundRequired
number
One-based logical round number, stable when an interrupted phase is replayed.
phaseRequired
"attempt" | "check"
Current callback phase: attempt produces a candidate; check verifies it.
quotaOptional
WorkflowQuotaPause | undefined
Quota pause resumed by this attempt, with the captured conversation and retained branch when known; present only on the first attempt after the pause and never persisted separately.
interactionOptional
TaskInteractionContext | undefined
Durable state and suspension operations, supplied only for tasks declaring an interaction.
idempotencyKeyRequired
string
Effect key scoped to execution, task, logical round and phase; stable across replay of that phase. External deduplication remains caller-owned.
observationOptional
ObservationHub | undefined
Task-scoped hub with workflow execution, task key and attempt; pass it to custom nested work such as speculate.
signalRequired
AbortSignal
Aborted when the workflow stops or this round’s timeoutMs expires.
attemptRequired
number
Cumulative workflow attempt number for this loop, incremented for new rounds and replayed phases. Both callbacks in an uninterrupted round share it.
executionIdRequired
string
Identity of the workflow execution, preserved across checkpoint resumption.
reportUsageRequired
(usage: Usage) => void
Synchronously add usage from this phase to the workflow budget, including failed model requests. Usage is not inferred from arbitrary callback results.
reportUsageOnceOptional
((receipt: string, usage: Usage) => void) | undefined
Deduplicate a durable usage receipt within this task. Scope receipts to each distinct charged operation; a replayed paid request requires a new receipt.
checkpointOptional
(() => Promise<void>) | undefined
Save the workflow state now; does nothing without a checkpoint.
valueRequired
<T>(dependency: Task<T>) => T
Read the completed output of a task listed in this task’s declared dependencies.