My Account Log in

1 option

Generative AI with LangChain : build production-ready LLM applications and advanced agents using Python, LangChain, and LangGraph / Ben Auffarth, Leonid Kuligin.

O'Reilly Online Learning: Academic/Public Library Edition Available online

View online
Format:
Book
Author/Creator:
Auffarth, Ben, author.
Kuligin, Leonid, author.
Series:
Expert insight.
Expert insights
Language:
English
Subjects (All):
Application software--Development.
Application software.
Artificial intelligence.
Computer programming.
Application program interfaces (Computer software).
Physical Description:
1 online resource (476 pages) : color illustrations.
Edition:
Second edition.
Place of Publication:
Birmingham : Packt Publishing, 2025.
Summary:
Go beyond foundational LangChain documentation with detailed coverage of LangGraph interfaces, design patterns for building AI agents, and scalable architectures used in production--ideal for Python developers building GenAI applications Key Features Bridge the gap between prototype and production with robust LangGraph agent architectures Apply enterprise-grade practices for testing, observability, and monitoring Build specialized agents for software development and data analysis Purchase of the print or Kindle book includes a free PDF eBook Book Description This second edition tackles the biggest challenge facing companies in AI today: moving from prototypes to production. Fully updated to reflect the latest developments in the LangChain ecosystem, it captures how modern AI systems are developed, deployed, and scaled in enterprise environments. This edition places a strong focus on multi-agent architectures, robust LangGraph workflows, and advanced retrieval-augmented generation (RAG) pipelines. You'll explore design patterns for building agentic systems, with practical implementations of multi-agent setups for complex tasks. The book guides you through reasoning techniques such as Tree-of -Thoughts, structured generation, and agent handoffs--complete with error handling examples. Expanded chapters on testing, evaluation, and deployment address the demands of modern LLM applications, showing you how to design secure, compliant AI systems with built-in safeguards and responsible development principles. This edition also expands RAG coverage with guidance on hybrid search, re-ranking, and fact-checking pipelines to enhance output accuracy. Whether you're extending existing workflows or architecting multi-agent systems from scratch, this book provides the technical depth and practical instruction needed to design LLM applications ready for success in production environments. What you will learn Design and implement multi-agent systems using LangGraph Implement testing strategies that identify issues before deployment Deploy observability and monitoring solutions for production environments Build agentic RAG systems with re-ranking capabilities Architect scalable, production-ready AI agents using LangGraph and MCP Work with the latest LLMs and providers like Google Gemini, Anthropic, Mistral, DeepSeek, and OpenAI's o3-mini Design secure, compliant AI systems aligned with modern ethical practices Who this book is for This book is for developers, researchers, and anyone looking to learn more about LangChain and LangGraph. With a strong emphasis on enterprise deployment patterns, it's especially valuable for teams implementing LLM solutions at scale. While the first edition focused on individual developers, this updated edition expands its reach to support engineering teams and decision-makers working on enterprise-scale LLM strategies. A basic understanding of Python is required, and familiarity with machine learning will help you get the most out of this book.
Contents:
Cover
Title Page
Copyright Page
Contributors
Table of Contents
Preface
Chapter 1: The Rise of Generative AI: From Language Models to Agents
The modern LLM landscape
Model comparison
LLM provider landscape
Licensing
From models to agentic applications
Limitations of traditional LLMs
Understanding LLM applications
Understanding AI agents
Introducing LangChain
Challenges with raw LLMs
How LangChain enables agent development
Exploring the LangChain architecture
Ecosystem
Modular design and dependency management
LangGraph, LangSmith, and companion tools
Third-party applications and visual tools
Summary
Questions
Chapter 2: First Steps with LangChain
Setting up dependencies for this book
API key setup
Exploring LangChain's building blocks
Model interfaces
LLM interaction patterns
Development testing
Working with chat models
Reasoning models
Controlling model behavior
Choosing parameters for applications
Prompts and templates
Chat prompt templates
LangChain Expression Language (LCEL)
Simple workflows with LCEL
Complex chain example
Running local models
Getting started with Ollama
Working with Hugging Face models locally
Tips for local models
Multimodal AI applications
Text-to-image
Using DALL-E through OpenAI
Using Stable Diffusion
Image understanding
Using Gemini 1.5 Pro
Using GPT-4 Vision
Review questions
Chapter 3: Building Workflows with LangGraph
LangGraph fundamentals
State management
Reducers
Making graphs configurable
Controlled output generation
Output parsing
Error handling
Prompt engineering
Prompt templates
Zero-shot vs. few-shot prompting
Chaining prompts together
Dynamic few-shot prompting
Chain of Thought
Self-consistency.
Working with short context windows
Summarizing long video
Understanding memory mechanisms
Trimming chat history
Saving history to a database
LangGraph checkpoints
Chapter 4: Building Intelligent RAG Systems
From indexes to intelligent retrieval
Components of a RAG system
When to implement RAG
From embeddings to search
Embeddings
Vector stores
Vector stores comparison
Hardware considerations for vector stores
Vector store interface in LangChain
Vector indexing strategies
Breaking down the RAG pipeline
Document processing
Chunking strategies
Retrieval
Advanced RAG techniques
Hybrid retrieval: Combining semantic and keyword search
Re-ranking
Query transformation: Improving retrieval through better queries
Context processing: maximizing retrieved information value
Response enhancement: Improving generator output
Corrective RAG
Agentic RAG
Choosing the right techniques
Developing a corporate documentation chatbot
Document loading
Language model setup
Document retrieval
Designing the state graph
Integrating with Streamlit for a user interface
Evaluation and performance considerations
Troubleshooting RAG systems
Chapter 5: Building Intelligent Agents
What is a tool?
Tools in LangChain
ReACT
Defining tools
Built-in LangChain tools
Custom tools
Wrapping a Python function as a tool
Creating a tool from a Runnable
Subclass StructuredTool or BaseTool
Advanced tool-calling capabilities
Incorporating tools into workflows
Controlled generation
Controlled generation provided by the vendor
ToolNode
Tool-calling paradigm
What are agents?
Plan-and-solve agent
Chapter 6: Advanced Applications and Multi-Agent Systems.
Agentic architectures
Multi-agent architectures
Agent roles and specialization
Consensus mechanism
Communication protocols
Semantic router
Organizing interactions
LangGraph streaming
Handoffs
Communication via a shared messages list
LangGraph platform
Building adaptive systems
Dynamic behavior adjustment
Human-in-the-loop
Exploring reasoning paths
Tree of Thoughts
Trimming ToT with MCTS
Agent memory
Cache
Store
Chapter 7: Software Development and Data Analysis Agents
LLMs in software development
The future of development
Implementation considerations
Evolution of code LLMs
Benchmarks for code LLMs
LLM-based software engineering approaches
Security and risk mitigation
Validation framework for LLM-generated code
LangChain integrations
Writing code with LLMs
Google generative AI
Hugging Face
Anthropic
Agentic approach
Documentation RAG
Repository RAG
Applying LLM agents for data science
Training an ML model
Setting up a Python-capable agent
Asking the agent to build a neural network
Agent execution and results
Analyzing a dataset
Creating a pandas DataFrame agent
Asking questions about the dataset
Chapter 8: Evaluation and Testing
Why evaluation matters
Safety and alignment
Performance and efficiency
User and stakeholder value
Building consensus for LLM evaluation
What we evaluate: core agent capabilities
Task performance evaluation
Tool usage evaluation
RAG evaluation
Planning and reasoning evaluation
How we evaluate: methodologies and approaches
Automated evaluation approaches
Human-in-the-loop evaluation
System-level evaluation
Evaluating LLM agents in practice
Evaluating the correctness of results.
Evaluating tone and conciseness
Evaluating the output format
Evaluating agent trajectory
Evaluating CoT reasoning
Offline evaluation
Evaluating RAG systems
Evaluating a benchmark in LangSmith
Evaluating a benchmark with HF datasets and Evaluate
Evaluating email extraction
Chapter 9: Production-Ready LLM Deployment and Observability
Security considerations for LLM applications
Deploying LLM apps
Web framework deployment with FastAPI
Scalable deployment with Ray Serve
Building the index
Serving the index
Running the application
Deployment considerations for LangChain applications
Local development with the LangGraph CLI
Serverless deployment options
UI frameworks
Model Context Protocol
Infrastructure considerations
How to choose your deployment model
Model serving infrastructure
How to observe LLM apps
Operational metrics for LLM applications
Tracking responses
Hallucination detection
Bias detection and monitoring
LangSmith
Observability strategy
Continuous improvement for LLM applications
Cost management for LangChain applications
Model selection strategies in LangChain
Tiered model selection
Cascading model approach
Output token optimization
Other strategies
Monitoring and cost analysis
Chapter 10: The Future of Generative Models: Beyond Scaling
The current state of generative AI
The limitations of scaling and emerging alternatives
The scaling hypothesis challenged
Big tech vs. small enterprises
Emerging alternatives to pure scaling
Scaling up (traditional approach)
Scaling down (efficiency innovations)
Scaling out (distributed approaches)
Evolution of training data quality
Democratization through technical advances.
New scaling laws for post-training phases
Economic and industry transformation
Industry-specific transformations and competitive dynamics
Job evolution and skills implications
Near-term impacts (2025-2035)
Medium-term impacts (2035-2045)
Long-term shifts (2045 and beyond)
Economic distribution and equity considerations
Societal implications
Misinformation and cybersecurity
Copyright and attribution challenges
Regulations and implementation challenges
Appendix
OpenAI
Google
1. Google AI platform
2. Google Cloud Vertex AI
Other providers
Summarizing long videos
Packt Page
Other Books You May Enjoy
Index.
Notes:
Includes index.
OCLC-licensed vendor bibliographic record.
ISBN:
1-83702-200-3
OCLC:
1521194298

The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.

Find

Home Release notes

My Account

Shelf Request an item Bookmarks Fines and fees Settings

Guides

Using the Find catalog Using Articles+ Using your account