Skip to product information
A Practical Introduction to RAG and AI Agents Implemented with LangChain and LangGraph
A Practical Introduction to RAG and AI Agents Implemented with LangChain and LangGraph
Description
Book Introduction
Master everything from RAG design to AI agent design patterns and AI agent practice for each pattern!

Thanks to various LLM API services such as OpenAI, Google, and Anthropic, application developers can easily build AI systems.
However, going beyond simple chatbots that interact with people to create truly AI agents that can autonomously perform tasks is a new challenge.
This book guides you step-by-step through OpenAI's Chat API and LangChain basics, all the way to building an advanced AI agent system using LangGraph.

Beyond simple RAG (Augmented Search Generation) systems, you can build a solid foundation for responding to future advancements in AI technology through AI agent design patterns and implementation code that autonomously perform complex workflows.
  • You can preview some of the book's contents.
    Preview
","
index
▣ Chapter 1: Fundamentals of LLM Application Development

1.1 Generative AI Begins to Be Used
1.2 Copilot vs. AI Agent
1.3 Everything becomes an AI agent
1.4 Knowledge Map of AI Agents
1.5 Summary

▣ Chapter 2: Basics of the OpenAI Chat API

2.1 OpenAI's Chat Model
__ChatGPT's 'Model'
__Chat models available in the OpenAI API
__Model Snapshot
2.2 OpenAI's Chat API Basics
__Chat Completions API
__Chat Completions API Fees
__Check the incurred charges
2.3 'Tokens' that affect input/output length limits and fees
__token
Introducing __Tokenizer and TikToken
__About the number of tokens in Korean
2.4 Preparing the Chat Completions API Test Environment
__What is Google Colab?
__Create a Google Colab notebook
__Register to use the OpenAI API
__Prepare your OpenAI API key
2.5 Chat Completions API Practice
__OpenAI library
__Chat Completions API call
__Get responses that take conversation history into account
__Getting responses via streaming
__Basic parameters
__JSON mode
__Vision (image input)
2.6 Function calling
__Function calling overview
__Function calling sample code
__tool_choice parameter
2.7 Summary

▣ Chapter 3: Prompt Engineering

3.1 The Need for Prompt Engineering
3.2 What is Prompt Engineering?
3.3 Basic components of a prompt
__Topic: Recipe generation AI app
Templating the __prompt
__Separate commands and input data
__Provide context
__Specify output format
__Prompt Component Summary
3.4 Representative techniques of prompt engineering
__Zero-shot prompting
__Few-shot prompting
__Zero-shot Chain of Thought prompting
3.5 Summary

▣ Chapter 4: LangChain Basics

4.1 LangChain Overview
__Why should you learn LangChain?
__LangChain overall structure
__A group of packages that provide various components of LangChain
__Installing LangChain
__LangSmith Settings
__LangChain's main components
4.2 LLM/Chat model
__LLM
__Chat model
__Streaming
Inheritance relationship between __LLM and Chat model
__LLM/Chat model summary
4.3 Prompt template
__PromptTemplate
__ChatPromptTemplate
__MessagesPlaceholder
__LangSmith's Prompts
__Prompt template summary
4.4 Output parser
__Output parser overview
Converting Python Objects Using __PydanticOutputParser
__StrOutputParser
__Output parser summary
4.5 Chain?LangChain Expression Language (LCEL) Overview
__What is LangChain Expression Language (LCEL)?
Connecting __prompt and model
Add __StrOutputParser to the connection
Connecting using __PydanticOutputParser
__Chain Summary
4.6 LangChain's RAG-related components
__RAG(Retrieval-Augmented Generation)
__Overview of LangChain's RAG-related components
__Document loader
__Document transformer
__Embedding model
__Vector store
__Implementing RAG Chain using LCEL
__Summary of LangChain's RAG-related components
4.7 Summary

▣ Chapter 5: In-Depth Explanation of LangChain Expression Language (LCEL)

5.1 Runnable and RunnableSequen
__LCEL's most basic components
__Runnable execution methods―invoke·stream·batch
Connecting various Runnables with '|' in __LCEL
__Checking the inner workings of Chain in LangSmith
5.2 RunnableLambda - Making an arbitrary function into a runnable
Implementing RunnableLamda using the __chain decorator
__RunnableLambda automatic conversion
Be careful about the input and output types of __Runnable
5.3 RunnableParallel - Connecting multiple Runnables in parallel
Connecting the output of __RunnableParallel to the input of Runnable
__RunnableParallel automatic conversion
Combination with __RunnableLambda—Example using itemgetter
5.4 RunnablePassthrough - Outputting Input as is
__assign―Adding values ​​to the output of RunnableParallel
5.5 Summary

▣ Chapter 6: Advanced RAG

6.1 Advanced RAG Overview
6.2 Preparing for the Lab
6.3 Search query techniques
Hypothetical Document Embeddings (HyDE)
__Create multiple search queries
__Summary of search query techniques
6.4 Post-search techniques
__RAG-Fusion
__Rerank Model Overview
__Preparing to use the Cohere Rerank model
__Introducing the Cohere Rerank Model
__Summary of post-search techniques
6.5 Techniques for Using Multiple Retrievers
Routing by __LLM
__Hybrid search example
__Hybrid search implementation
__Summary of techniques using multiple retrievers
6.6 Summary

▣ Chapter 7: Evaluating RAG Applications Using LangSmith

7.1 Overview of the Evaluation Covered in Chapter 7
__Offline and online evaluations
7.2 LangSmith Overview
__LangSmith Rate Plan
__LangSmith function overall structure
7.3 Example of Offline Evaluation Configuration Using LangSmith and Ragas
__Ragas
__Offline evaluation configuration to be built in this chapter
7.4 Generating synthetic test data using Ragas
__Overview of Ragas' synthetic test data generation capabilities
Installing the __package
__Load the document to be searched
__Implementing synthetic test data generation using Ragas
__Creating LangSmith's Dataset
__Save synthetic test data
7.5 Implementing Offline Evaluation Using LangSmith and Ragas
__LangSmith's Offline Assessment Overview
__Available Evaluators
__Ragas's evaluation metrics
__Implementing a Custom Evaluator
__Implementing the inference function
__Implementation and execution of offline evaluation
__Offline Evaluation Precautions
7.6 Collecting Feedback Using LangSmith
__Overview of the feedback features to be implemented in this section
__Implement a function to display the feedback button
__Show feedback button
7.7 Automatic processing for feedback utilization
Processing using __Automation rules
__Automatically add good evaluation traces to the dataset
7.8 Summary

▣ Chapter 8: What is an AI Agent?

8.1 Expectations for LLM Utilization for AI Agents
8.2 The Origins of AI Agents and Their Evolution Using LLM
__LLM-based AI agent
__WebGPT
__Chain-of-Thought prompting
__MRKL Systems combines LLM and external professional modules
__Reasoning and Acting (ReAct)
__Plan-and-Solve prompting
8.3 General-Purpose LLM Agent Framework
__AutoGPT
__BabyAGI
__AutoGen
__crewAI
__crewAI's use cases
8.4 Multi-Agent Approach
__Definition of multi-agent
__Improving Text-to-SQL Accuracy with Multi-Agents
__Automating Software Development with Multi-Agents
__Self-Organized Agents: Generating and optimizing code at scale
__LLM-based multi-agent framework
8.5 For AI agents to be distributed safely
8.6 Summary

▣ Chapter 9: Practical Introduction to AI Agents Using LangGraph

9.1 LangGraph Overview
__What is LangGraph
__LangGraph graph structure approach
9.2 Key Components of LangGraph
__state: Represents the state of the graph
__Node: A processing unit that constitutes a graph
__Edge: Connection between nodes
__Compiled graph
9.3 Hands-on: Q&A Application
__Installing LangChain and LangGraph
__Setting up an OpenAI API key
__Role Definition
__state definition
__Chat model initialization
__node definition
__Graph creation
Add __node
__Edge Definition
__Conditional edge definition
__Graph compilation
__Run graph
__Show results
9.4 Checkpointing: State Persistence and Resumption
__Checkpoint data structure
__Practice: Verifying Checkpoint Operation
9.5 Summary

▣ Chapter 10: Creating a Requirements Definition Document and Developing an AI Agent

10.1 Requirements Definition Document Generation AI Agent Overview
__What is requirements definition?
__Refer to the approach of previous research
Designing with LangGraph's Workflow
10.2 Preferences
10.3 Defining Data Structures
10.4 Implementing Key Components
__PersonaGenerator
__InterviewConductor
__InformationEvaluator
__RequirementsDocumentGenerator
10.5 Building a Workflow
10.6 Running the Agent and Checking the Results
10.7 Full source code
10.8 Summary

▣ Chapter 11: Agent Design Patterns

11.1 Overview of the Agent Design Pattern
__What is a design pattern?
__Challenge areas addressed by the agent design pattern
__Defining the location of the agent design pattern
__Overall diagram of the agent design pattern
11.2 18 Agent Design Patterns
__1.
Passive Goal Creator
__2.
Proactive Goal Creator
__3.
Prompt/Response Optimizer
__4.
Retrieval-Augmented Generation (RAG)
__5.
Single-Path Plan Generator
__6.
Multi-Path Plan Generator
__7.
Self-Reflection
__8.
Cross-Reflection
__9.
Human Reflection
__10.
One-Shot Model Querying
__11.
Incremental Model Querying
__12.
Voting-Based Cooperation
__13.
Role-Based Cooperation
__14.
Debate-Based Cooperation
__15.
Multimodal Guardrails
__16.
Tool/Agent Registry
__17.
Agent Adapter
__18.
Agent Evaluator
11.3 Summary

▣ Chapter 12: Agent Design Patterns Implemented with LangChain/LangGraph

12.1 Agent Design Patterns Covered in This Chapter
12.2 Preferences
__About the implementation code for each pattern
12.3 Passive Goal Creator
__Explanation of implementation details
__Execution result
12.4 Prompt/Response Optimizer
__Explanation of implementation details
__Prompt Optimization
__Response Optimization
12.5 Single Pass Plan Generator
__Explanation of implementation details
__Execution result
12.6 Multi-Pass Plan Generator
__Explanation of implementation details
__Execution result
12.7 Self-Reflection
__Explanation of implementation details
__Execution result
12.8 Cross-Reflection
__Explanation of implementation details
__Execution result
12.9 Role-Based Cooperation
__Explanation of implementation details
__Execution result
12.10 Summary

▣ Appendix A: Subscription to various services and implementation code for each pattern

A.1 Subscription to various services
__LangSmith Join
__Join Cohere
__Anthropic Sign Up
A.2 Implementation code for each pattern
__1.
Passive Goal Creator
__2.
Prompt/Response Optimizer
__3.
Single-Path Plan Generator
__4.
Multi-Path Plan Generator
__5.
Self-Reflection
__6.
Cross-Reflection
__7.
Role-Based Cooperation
","
Detailed image
Detailed Image 1
","
Publisher's Review
★ What this book covers ★

◎ OpenAI's Chat API and Prompt Engineering Fundamentals
◎ Core components and usage of the Langchain framework
◎ Advanced implementation techniques and evaluation methods for the RAG system
◎ Building complex AI agent workflows using lang graphs
◎ The development process and latest trends of AI agents
◎ Agent Design Pattern and Practical Implementation Code for Seven Major Patterns
◎ Development of AI agents capable of complex decision-making processes and autonomous task processing.
"]
GOODS SPECIFICS
- Date of issue: June 20, 2025
- Page count, weight, size: 508 pages | 188*240*21mm
- ISBN13: 9791158396107

You may also like

카테고리