Multi-Agent System Patterns
Explore runnable templates for orchestrating multiple agents with GL AIP.
When to use this section: You need proven coordination patterns before customising them for production.
Audience: Engineers designing workflows and PMs creating workflows from requirements.
Use these examples to compare architectures (sequential, parallel, router, hierarchical, aggregator, loop) and understand when to apply each one.
Prerequisites
Python 3.11 or 3.12
uv package manager installed
This repository cloned locally:
git clone git@github.com:GDP-ADMIN/glaip-sdk.gitEnvironment variables defined in
.env:OPENAI_API_KEY=your-openai-key-here
Getting Started
Ready-to-run implementations of these patterns are available in the GL SDK Cookbook.
git clone git@github.com:GDP-ADMIN/gl-sdk-cookbook.git
cd glaip/examples/multi-agent-system-patterns
uv sync
cp .env.example .env # then edit with your credentialsRun any pattern example with uv, for example the sequential workflow:
Orchestration Approaches
These patterns demonstrate two orchestration approaches, each suited for different workflow types:
gllm-pipeline (Linear Workflows)
Patterns with linear, non-cyclic workflows use gllm-pipeline for orchestration. gllm-pipeline provides a declarative API with features like:
Parallel execution - Run multiple agents simultaneously
Sequential workflows - Chain agents where output flows to the next
Conditional routing - Direct queries to specialized agents based on logic
State management - Track data flow through the pipeline using Pydantic models
Patterns using gllm-pipeline:
Sequential, Parallel, Router, Aggregator
To use these patterns, install gllm-pipeline-binary version 0.4.13:
Sub-Agent Delegation (Cyclic Workflows)
Patterns with cyclic workflows or feedback loops use sub-agent delegation instead. This approach allows parent agents to:
Make autonomous decisions based on sub-agent responses
Loop back to previous steps for refinement
Implement quality checks and conditional branching
Control iteration limits to prevent infinite loops
Patterns using sub-agent delegation:
Hierarchical (coordinator decides based on sub-agent outputs)
Loop (optimizer iterates based on executor feedback)
These patterns define sub-agents via the agents parameter when creating the coordinator/optimizer agent.
AgentComponent Wrapper
Patterns using gllm-pipeline (Sequential, Parallel, Router, Aggregator) use the AgentComponent wrapper to integrate glaip_sdk.Agent with gllm-pipeline. This wrapper is now built into the SDK and can be accessed via the .to_component() method.
Note: Sub-agent delegation patterns (Hierarchical, Loop) do not use this wrapper - they use the native agents parameter instead.
Usage
The AgentComponent handles:
Converting agents to pipeline-compatible components
Compiling structured pipeline state (context, history) into a cohesive prompt
Executing agents asynchronously within the pipeline
Managing runtime configuration overrides
For more details on advanced usage, see the Agent as Component guide.
Example Structure
Every pattern page shares the same layout so you can skim quickly:
Overview of when the pattern works best
Demo scenario you can run immediately
Diagram showing agent relationships
Implementation steps with code snippets
Run commands and required environment variables
Sample output for validation
Notes and related documentation
Pattern Library
Related Documentation
Agents guide — Agent lifecycle, nesting, and runtime overrides.
Tools guide — Upload Python tools and reuse catalog assets.
Automation & scripting — Run pattern scripts inside CI pipelines or cron jobs.
Security & privacy — Apply memory, PII, and artifact-sharing controls across agents.
Last updated