swink-agent-patterns
Multi-agent pipeline patterns for swink-agent — compose sequential, parallel, and loop pipelines over an agent factory.
Features
Pipeline::sequential— chain agents, optionally passing each step's output as the next step's contextPipeline::parallel— fan out to N agents concurrently with aMergeStrategy(Concat,First,Fastest { n },Custom { aggregator })Pipeline::loop_— iterate one agent until anExitCondition(ToolCalled,OutputContainsregex, orMaxIterations)PipelineExecutor— drives a pipeline via a pluggableAgentFactorywith lifecycle events (PipelineEvent)PipelineRegistry— name → pipeline lookup for dynamic dispatch (e.g. routing tools to sub-pipelines)PipelineTool— expose a pipeline to the outer agent as a regularAgentToolSimpleAgentFactory— register agent builder fns by name for quick prototyping
Quick Start
[]
= "0.8"
= "0.8"
= { = "1", = ["full"] }
use Arc;
use CancellationToken;
use ;
async
Architecture
Pipeline is an enum (Sequential, Parallel, Loop) of pure data — each variant references agent steps by name, not by instance. PipelineExecutor materializes agents on demand via the AgentFactory trait, so expensive setup (credentials, tool registration) happens once per run rather than once per step. PipelineEvent emits lifecycle hooks (StepStarted, StepCompleted, PipelineCompleted) so callers can stream progress into a UI or audit log without cracking the executor open.
No unsafe code (#![forbid(unsafe_code)]). Pipelines are Clone + Serialize — you can persist a pipeline definition to disk and recreate it.
Part of the swink-agent workspace — see the main README for workspace overview and setup.