Jido.Agent.Strategy.Direct
(Jido v2.0.0-rc.4)
View Source
Default execution strategy that runs instructions immediately and sequentially.
This strategy:
- Executes each instruction via
Jido.Exec.run/1 - Merges results into agent state
- Applies state operations (e.g.,
StateOp.SetState) to the agent - Returns only external directives to the caller
- Optionally tracks instruction execution in Thread when
thread?is enabled
This is the default strategy and provides the simplest execution model.
Thread Tracking
When thread? option is enabled via ctx[:strategy_opts][:thread?] or if a thread
already exists in agent state, the strategy will:
- Ensure a Thread exists in agent state
- Append
:instruction_startentry before each instruction - Append
:instruction_endentry after each instruction (with status :ok or :error)
Example:
agent = Agent.cmd(agent, MyAction, strategy_opts: [thread?: true])