Raxol.Agent.Action.Pipeline (Raxol Agent v2.6.0)

Copy Markdown View Source

Composes actions into sequential pipelines.

Each action's output is merged into a shared state map that the next action receives as params. The pipeline short-circuits on error.

Example

Pipeline.run(
  [ReadFile, AnalyzeCode, FormatReport],
  %{path: "lib/app.ex"},
  %{backend: mock_backend}
)
#=> {:ok, %{path: "lib/app.ex", content: "...", issues: [...], report: "..."}, []}

Summary

Functions

Run a pipeline of actions sequentially.

Types

effect()

@type effect() :: Raxol.Agent.Directive.t()

pipeline()

@type pipeline() :: [step()]

step()

@type step() :: module() | {module(), map()}

Functions

run(steps, initial_params, context \\ %{})

@spec run(pipeline(), map(), map()) ::
  {:ok, map(), [effect()]} | {:error, {module(), term()}}

Run a pipeline of actions sequentially.

initial_params seeds the shared state. Each action's {:ok, result} is merged into the state for the next step. Commands from all steps are accumulated.

Returns {:ok, final_state, all_commands} or {:error, {step_module, reason}}.