Raxol.Agent.Strategy behaviour (Raxol Agent v2.6.0)

Copy Markdown View Source

Behaviour for agent execution strategies.

A strategy controls HOW an agent processes a command (action invocation). The agent decides WHAT to do; the strategy decides HOW to execute it.

Built-in strategies:

Summary

Callbacks

Execute a command (action or pipeline) using this strategy.

Optional: initialize strategy-specific state.

Types

command()

@type command() :: {module(), map()} | [{module(), map()}]

context()

@type context() :: map()

effect()

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

result()

@type result() :: {:ok, state()} | {:ok, state(), [effect()]} | {:error, term()}

state()

@type state() :: map()

Callbacks

execute(command, state, context)

@callback execute(command(), state(), context()) :: result()

Execute a command (action or pipeline) using this strategy.

  • command is {ActionModule, params} or a list of steps.
  • state is the agent's current model/state.
  • context carries backend config, available actions, etc.

init(keyword)

(optional)
@callback init(keyword()) :: {:ok, term()}

Optional: initialize strategy-specific state.