Learn R Programming

aisdk (version 1.1.0)

MissionStep: MissionStep Class

Description

A single execution unit within a Mission. Each step wraps an executor (Agent, AgentTeam, Flow, or plain R function) and handles its own retry loop with error-history injection.

Arguments

Public fields

id

Unique step identifier.

description

Natural language description of what this step does.

executor

Agent | AgentTeam | Flow | function to perform the step.

status

Current status: "pending"|"running"|"done"|"failed"|"retrying".

max_retries

Maximum retry attempts before escalation. Default 2.

retry_count

Number of retries attempted so far.

timeout_secs

Optional per-step timeout in seconds. NULL = no timeout.

parallel

If TRUE, this step may run concurrently with other parallel steps.

depends_on

Character vector of step IDs that must complete before this step.

result

The text result from the executor on success.

error_history

List of failure records, each containing attempt, error, and timestamp.

Methods


Method new()

Initialize a MissionStep.

Usage

MissionStep$new(
  id,
  description,
  executor = NULL,
  max_retries = 2,
  timeout_secs = NULL,
  parallel = FALSE,
  depends_on = NULL
)

Arguments

id

Unique step ID (e.g., "step_1").

description

Natural language task description.

executor

Agent, AgentTeam, Flow, or R function.

max_retries

Maximum retries before stall escalation. Default 2.

timeout_secs

Optional per-step timeout. Default NULL.

parallel

Can run in parallel with other parallel steps. Default FALSE.

depends_on

Character vector of prerequisite step IDs. Default NULL.


Method run()

Execute this step once (no retry logic; handled by Mission).

Usage

MissionStep$run(session, model, context = NULL)

Arguments

session

A ChatSession for shared state.

model

Model ID string.

context

Optional error-injection context string.

Returns

Character string result, or stops with an error.


Method print()

Print method.

Usage

MissionStep$print()


Method clone()

The objects of this class are cloneable with this method.

Usage

MissionStep$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.