A practical demonstration of LLM workflow patterns and agent architectures inspired by Anthropic's "Building Effective Agents" article.
This project offers interactive examples and implementations of LLM workflow patterns and agent architectures, drawing inspiration from Anthropic's blog post "Building Effective Agents" (December 2024) and resources like Agent Recipes.
All examples are built around KETL Mtn. Apparel, a focused outdoor apparel company known for their "Pack Light. Do More." philosophy. Using their product catalog (stored in common/ketlmtn_data/), we demonstrate how different LLM patterns solve real challenges in e-commerce, from customer service and content creation to quality control and global market reach. The example implementations use Python 3.12+, Groq's LLM API, and Arize Phoenix for tracing and observability.
The repository includes the following patterns:
Creating a workflow where the output of one LLM call becomes the input for the next, forming a sequential chain. In KETL Mtn.'s customer service, this handles queries like "I need a comfortable pair of pants that I can hike in but also wear to casual office work" by first filtering for relevance (suggesting the Tomfoolery Chino Travel Pants), then looking up specific product details (stretchy fabric, zipper pockets, stain resistance), and finally formatting a helpful response.
Executing multiple LLM tasks concurrently to reduce total processing time. For KETL Mtn.'s global expansion, this pattern efficiently translates product descriptions (like their popular Nofry Sun Hoodie UPF 30+) into multiple languages simultaneously, ensuring consistent messaging across markets without creating content bottlenecks.
Directing user queries to specialized handlers based on the type of information requested. When customers ask about the lifetime repair program for their Vent Lightweight Active Pants, sizing details for the Alpine Dip-N-More Boardshorts, or KETL Mtn.'s sustainability practices, this pattern ensures questions reach the appropriate knowledge base and specialist handler.
Implementing an iterative improvement cycle where content is repeatedly generated, evaluated, and refined. This pattern helps KETL Mtn. create compelling sales pitches by iteratively generating and refining content until it perfectly balances persuasiveness with their "Built for Adventure. Designed for Everyday." brand voice. For example, generating a sales pitch for their Tomfoolery Chino Travel Pants that highlights both technical features and lifestyle benefits while maintaining brand authenticity.
Orchestrator-Workers (In Development)
Using a coordinator LLM to manage a team of specialized worker LLMs. Pattern concept developed, implementation being refined for efficiency.
Autonomous Agent (Coming Soon)
Advanced pattern combining multiple approaches for more autonomous decision-making and task execution. Currently in development.
- Python 3.12+
- uv for package management
- Groq API key
-
Clone the repository:
git clone https://github.com/yourusername/llm-composition-patterns.git cd llm-composition-patterns -
Create and activate a virtual environment:
uv venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install dependencies:
uv add -r requirements.txt
-
Set up environment variables:
cp .env.example .env # Edit .env to add your API keys
Choose a pattern and run its example:
# Example for the Parallelization pattern
python -m src.llm_composition_patterns.patterns.parallelization.examplesrc/llm_composition_patterns/patterns/: Implementation of different patternsparallelization/: Parallelization patternprompt_chaining/: Prompt chaining patternrouting/: Routing patternevaluator_optimizer/: Evaluator-optimizer patternorchestrator_workers/: Orchestrator-workers pattern (coming soon)
common/: Shared utilities and modelsgroq_helpers.py: Helper functions for Groq APImodels.py: Shared Pydantic modelsketlmtn_helpers.py: Utilities for KETL Mtn. examplesarize_phoenix_setup.py: Tracing setupketlmtn_data/: Sample data files
All examples use OpenTelemetry with Arize Phoenix for tracing. To view traces:
- Set up your Phoenix API key in the
.envfile - Run any example
- View traces in the Arize Phoenix dashboard
For local development, you can also run Phoenix locally:
docker run -p 6006:6006 arizephoenix/phoenix:latestThis project is licensed under the MIT License - see the LICENSE file for details.



