A collection of practical examples demonstrating LangChain's Runnable architecture for building modular, scalable, and production-ready LLM applications.
This repository explores the core Runnable components introduced in LangChain and demonstrates how they can be combined to create flexible AI workflows.
The examples focus on:
- Sequential execution pipelines
- Parallel task execution
- Conditional routing
- Custom business logic integration
- Data transformation workflows
These concepts form the foundation of modern LangChain application development and are widely used in production AI systems.
Execute multiple components in sequence.
Use Cases
- Multi-step reasoning
- Data processing pipelines
- Summarization workflows
- Content generation chains
Run multiple tasks simultaneously and collect their outputs.
Use Cases
- Parallel prompt execution
- Multi-analysis pipelines
- Performance optimization
Pass original inputs through the chain while augmenting them with additional outputs.
Use Cases
- Context preservation
- Metadata enrichment
- Intermediate result tracking
Integrate custom Python logic directly into LangChain workflows.
Use Cases
- Data preprocessing
- Output transformation
- Business rule implementation
Route requests dynamically based on conditions.
Use Cases
- Conditional workflows
- Input classification
- Intelligent routing systems
LangChain-Runnables/
│
├── runnable_sequence.py
├── runnable_parallel.py
├── runnable_passthrough.py
├── runnable_lambda.py
├── runnable_branch.py
│
├── .env
├── requirements.txt
└── README.md
- Python
- LangChain
- Hugging Face Inference API
- Prompt Templates
- Output Parsers
- Runnable Architecture
Clone the repository:
git clone https://github.com/shivharebhupendra/LangChain-Runnables.gitMove into the project directory:
cd LangChain-RunnablesCreate a virtual environment:
python -m venv venvActivate the environment:
venv\Scripts\activatesource venv/bin/activateInstall dependencies:
pip install -r requirements.txtCreate a .env file:
HUGGINGFACEHUB_API_TOKEN=your_token_hereBy working through these examples, you will learn how to:
- Build modular AI pipelines
- Chain multiple LLM operations together
- Execute tasks concurrently
- Implement conditional execution paths
- Add custom Python logic to workflows
- Design scalable LangChain applications
This repository will be continuously updated with additional Runnable patterns and real-world AI workflow implementations, including:
- Retrieval-Augmented Generation (RAG)
- Agent Workflows
- LangGraph Integration
- Memory Systems
- Tool Calling
- Production Deployment Examples
Bhupendra Shivhare
AI Engineer | Data Analyst | Generative AI Educator
GitHub: https://github.com/shivharebhupendra
⭐ If you find this repository useful, consider giving it a star and following for future updates.