ALF pipeline for orchestrated tool dispatch.
When DispatchTools encounters a tool call that has a registered dispatch
recipe, it invokes this pipeline instead of calling the resolver directly.
The pipeline orchestrates sub-tool execution using ALF's native components:
- Switch routes between passthrough (simple tools) and recipe dispatch
- Composer fans out one dispatch into N parallel sub-tool calls
- Stage + count: executes sub-tools concurrently via GenStage workers
- Composer fans in N results into one composed output
Architecture
This pipeline generalises the pattern of bespoke dispatchers that hardcode tool orchestration as sequential function calls. ToolDispatch makes it declarative via ALF components.
Pipeline Structure
ResolveStrategy → Switch(:dispatch_route)
├─ :passthrough → [DirectResolve]
└─ :recipe → [BuildPlan, ExecuteSerial, FanOutParallel,
ExecuteOneCall(count:3), CollectResults, ComposeOutput]
Summary
Functions
Switch routing function — called at runtime for each event.
Starts the pipeline if not already running.
Functions
@spec components() :: [map()]
@spec dispatch_route( LlmCore.Agent.ToolDispatch.Event.t(), keyword() ) :: :recipe | :passthrough
Switch routing function — called at runtime for each event.
Returns the branch key based on the event's strategy field, which
was set by ResolveStrategy.
Starts the pipeline if not already running.
Options
:sync—truefor sequential execution (tests),falsefor async parallel execution (production). Default:false.
Returns
:ok— pipeline is running{:error, reason}— pipeline failed to start
@spec flow(map(), list(), Keyword.t()) :: Enumerable.t()
@spec start() :: :ok
@spec start(list()) :: :ok
@spec started?() :: true | false
@spec stream(Enumerable.t(), Keyword.t()) :: Enumerable.t()