Jido.Composer.Orchestrator.Strategy (Jido Composer v0.4.0)

Copy Markdown View Source

Jido.Agent.Strategy implementation for LLM-driven orchestration.

Implements a ReAct-style (Reason + Act) loop: call LLM, execute tool calls, feed results back, repeat until final answer or iteration limit.

All side effects are dispatched via directives — the strategy itself is pure.

Error Handling

Error reasons are stored as structured data in strat.result (not stringified via inspect/1), preserving error types for callers that pattern-match on them. LLM-facing error context (tool results, conversation messages) continues to use string representations since the LLM consumes text.

All error paths close open observability spans (agent, iteration) to ensure telemetry is emitted even on failure.

Summary

Functions

Returns replay directives for restoring in-flight operations from checkpoint state.

Strategy-specific closure stripping for checkpoint serialization.

Functions

replay_directives_from_state(state)

@spec replay_directives_from_state(map()) :: [struct()]

Returns replay directives for restoring in-flight operations from checkpoint state.

Called by Checkpoint.replay_directives/1 via function_exported?/3 delegation.

strip_for_checkpoint(state)

@spec strip_for_checkpoint(map()) :: map()

Strategy-specific closure stripping for checkpoint serialization.

Called by Checkpoint.prepare_for_checkpoint/1 via delegation. Strips closures from nested structures (e.g., approval_gate.approval_policy) in addition to top-level function values.