Skip to content

@usine/core/attempt

One try of a step on a worker. outcome is none while the attempt is in flight. salvage records what the executor preserved of the workspace after an unsuccessful end; the next attempt of the same Run resumes from a pushed salvage.

  • Schema.Class

new Attempt(…args): Attempt

Parameter Type
…args [props: object, options?: MakeOptions]

Attempt

readonly agent: string & Brand<"AgentName">

readonly brain: BrainSpec

readonly id: string & Brand<"AttemptId">

readonly number: number & Brand<"AttemptNumber">

readonly operatorIntervened: boolean

readonly outcome: Option<AttemptSucceeded | AttemptFailed | AttemptCanceled>

readonly parentModel: Option<string & Brand<"ModelId">>

readonly runId: string & Brand<"RunId">

readonly salvage: Option<SalvagePushed | SalvageRetained>

readonly startedAt: Utc

readonly stepName: string & Brand<"StepName">

readonly task: string & Brand<"AttemptTask">

readonly worker: string & Brand<"WorkerName">


The effective task and roster Agent an operator assigns to a Run’s later Attempts.

  • Schema.Class

new AttemptContext(…args): AttemptContext

Parameter Type
…args [props: object, options?: MakeOptions]

AttemptContext

readonly agent: Agent

readonly parentModel: Option<string & Brand<"ModelId">>

readonly task: string & Brand<"AttemptTask">

AttemptId = typeof AttemptId.Type

Identity of one execution try; each retry receives a new identity under the same Run and Step.


AttemptNumber = typeof AttemptNumber.Type

1-based position of a try under its step. Retries are attempt N+1 under the same step, and the auto-retry cap counts total attempts.


AttemptTask = typeof AttemptTask.Type

Task text given to the agent after loop interpolation or an operator’s edit-and-retry amendment.

const AttemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">

Identity of one execution try; each retry receives a new identity under the same Run and Step.


const AttemptNumber: Schema.brand<Schema.Int, "AttemptNumber">

1-based position of a try under its step. Retries are attempt N+1 under the same step, and the auto-retry cap counts total attempts.


const AttemptTask: Schema.brand<Schema.String, "AttemptTask">

Task text given to the agent after loop interpolation or an operator’s edit-and-retry amendment.


const shouldAutoRetry: (options) => boolean

The auto-retry law: only an infra failure retries, and only while the attempt number is below maxAutoAttempts (ADR 0002). number is the failed try’s position; maxAutoAttempts includes the first try.

Parameter Type
options { failure: AttemptFailure; maxAutoAttempts: AttemptNumber; number: AttemptNumber; }
options.failure AttemptFailure
options.maxAutoAttempts AttemptNumber
options.number AttemptNumber

boolean