Skip to content

Repository files navigation

LangChain Runnables

A collection of practical examples demonstrating LangChain's Runnable architecture for building modular, scalable, and production-ready LLM applications.

Overview

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.


Concepts Covered

RunnableSequence

Execute multiple components in sequence.

Use Cases

  • Multi-step reasoning
  • Data processing pipelines
  • Summarization workflows
  • Content generation chains

RunnableParallel

Run multiple tasks simultaneously and collect their outputs.

Use Cases

  • Parallel prompt execution
  • Multi-analysis pipelines
  • Performance optimization

RunnablePassthrough

Pass original inputs through the chain while augmenting them with additional outputs.

Use Cases

  • Context preservation
  • Metadata enrichment
  • Intermediate result tracking

RunnableLambda

Integrate custom Python logic directly into LangChain workflows.

Use Cases

  • Data preprocessing
  • Output transformation
  • Business rule implementation

RunnableBranch

Route requests dynamically based on conditions.

Use Cases

  • Conditional workflows
  • Input classification
  • Intelligent routing systems

Project Structure

LangChain-Runnables/
│
├── runnable_sequence.py
├── runnable_parallel.py
├── runnable_passthrough.py
├── runnable_lambda.py
├── runnable_branch.py
│
├── .env
├── requirements.txt
└── README.md

Technologies Used

  • Python
  • LangChain
  • Hugging Face Inference API
  • Prompt Templates
  • Output Parsers
  • Runnable Architecture

Installation

Clone the repository:

git clone https://github.com/shivharebhupendra/LangChain-Runnables.git

Move into the project directory:

cd LangChain-Runnables

Create a virtual environment:

python -m venv venv

Activate the environment:

Windows

venv\Scripts\activate

Linux / macOS

source venv/bin/activate

Install dependencies:

pip install -r requirements.txt

Environment Variables

Create a .env file:

HUGGINGFACEHUB_API_TOKEN=your_token_here

Learning Outcomes

By 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

Future Enhancements

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

Author

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.

About

A collection of practical examples demonstrating LangChain's Runnable architecture for building modular, scalable, and production-ready LLM applications.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages