Type Alias AutomaticContinuationOption

AutomaticContinuationOption: { automatic_continuation?: boolean }

SDK-only option of interactions.create() controlling automatic continuation of long decodes.

Type declaration

  • Optionalautomatic_continuation?: boolean

    Defaults to true. When true, the SDK automatically resumes decoding across multiple continuation hops whenever a response or stream stops at the per-request decode token limit (status: 'requires_continuation' with a continuation_token) until the interaction completes, reaches incomplete (e.g. max_output_tokens), requires action, or fails. Pass automatic_continuation: false to disable: the single server response is then returned untouched (so callers can drive continuation themselves), with a one-time console warning when it stops at requires_continuation.

    • For stream: true, the events of all continuation hops are yielded verbatim and in order on the returned Stream, including each hop's interaction.created and intermediate interaction.completed (with status: 'requires_continuation'); check status on interaction.completed events rather than treating the first one as the end of the output. A hop that drops before any output was yielded since its latest checkpoint is resumed from that checkpoint (up to 3 consecutive reconnects without progress).
    • For unary calls, each continuation hop is a separate interaction on the server that only contains that hop's output. The SDK merges the hops into one Interaction: steps are concatenated in hop order, usage token counts are summed across hops (with usage.initial_input_tokens set to the first hop's input tokens), and all other fields (id, status, ...) come from the final hop; the final hop's id can be passed as previous_interaction_id to continue the conversation. continuation_ids lists the ids of every hop in order (the last one is id); note that interactions.get(id) and interactions.delete(id) act on the final hop only. previous_interaction_id, created and input come from the first hop.
    • With store enabled (the default), each continuation hop sends the hop that issued the continuation_token as previous_interaction_id and omits input (the server already has it). With store: false, the original input is resent with the token.
    • Client-side continuation is skipped for background: true and agent interactions (agent / agent_config), whose loops are managed by the server. background: true with an explicit automatic_continuation: false is rejected.
    • Timeouts: a numeric per-request timeout_ms (or timeout) in the request options is a wall-clock budget for the whole create() call. Each hop is sent with the time left, and once it runs out the call stops with a ContinuationInterruptedError (see below) so the work so far can be resumed. The client-level httpOptions.timeout and the retry options apply to each hop separately: transient errors on a continuation hop retry that hop using the latest continuation_token without restarting from the initial request.
    • Billing note: with background: false, each continuation hop re-prefills the conversation and generated prefix, so input tokens are billed on every hop (and summed in usage.total_input_tokens). If an unrecoverable error occurs after one or more hops have completed, those completed hops are still billed. For server-managed continuation without client-side hop loops, use background: true (with store: true).
    • Errors: a failure on the first request is thrown as usual. A failure after progress (a later hop, or a stream after a resumable checkpoint) is thrown as ContinuationInterruptedError (with the failure as cause) carrying continuationToken, interactionId and continuationIds, plus partialInteraction (the completed hops merged, for unary calls), so the output already produced is not lost and the call can be resumed manually. Running out of the per-request timeout after progress is reported the same way.