LangGraph Slides
LangGraph Slides
Dictionary📖
Normal Dictionary:
● Union lets you say that a value can be more than one type
● Flexible and easy to code
● Type Safety as it can provide hints to help catch incorrect usage
Optional 🤔
Analogy:
● Whiteboard in a Meeting Room: Participants
(nodes) write and read information on the
whiteboard (state) to stay updated and coordinate
actions.
Nodes📌
➔ Nodes are individual functions or operations that
perform specific tasks within the graph.
➔ Each node receives input (often the current state),
processes it, and produces an output or an updated
state.
Analogy:
Analogy:
Analogy:
Analogy:
Analogy:
Analogy:
Analogy:
Analogy:
Analogy:
Analogy:
🤖 🔧
AI Message Tool Message
Represents responses Similar to Function Message, but
generated by AI models specific to tool usage
Graph I
not yet… but soon!
Hello World Graph🌍
Objectives ✅:
1. Understand and define the AgentState structure
2. Create simple node functions to process and update state
3. Set up a basic LangGraph structure
4. Compile and invoke a LangGraph graph
5. Understand how data flows through a single-node in LangGraph
Exercise for Graph I
🏗Your task:
Create a Personalized Compliment Agent using LangGraph!
Objectives ✅:
1. Define a more complex AgentState
2. Create a processing node that performs operations on list data.
3. Set up a LangGraph that processes and outputs computed results.
4. Invoke the graph with structured inputs and retrieve outputs.
🏗Your task:
Create a Graph where you pass in a single list of integers along with a name and an
operation. If the operation is a “+”, you add the elements and if it is a “*”, you
multiply the elements, all within the same node.
Output: “Linda, welcome to the system! You are 31 years old! You have skills in: Python,
Machine Learning, and LangGraph”
Hint: You will need to use the the add_edge method twice
Graph IV
Conditional Graph🚧
Objectives:
1. Implement conditional logic to route the flow of data to different
nodes
2. Use START and END nodes to manage entry and exit points explicitly.
3. Design multiple nodes to perform different operations (addition,
subtraction).
4. Create a router node to handle decision-making and control graph
flow.
Set the bounds to between 1 to 20. The Graph has to keep guessing (max number of
guesses is 7) where if the guess is correct, then it stops, but if not we keep looping until
we hit the max limit of 7.
Each time a number is guessed, the hint node should say higher or lower and the graph
should account for this information and guess the next guess accordingly.
Hint: It will need to adjust its bounds after every guess based on the hint provided by the
hint node.
Agent I
Simple Bot🤖
Objectives:
1. Define state structure with a list of HumanMessage objects.
2. Initialize a GPT-4o model using LangChain's ChatOpenAI
3. Sending and handling different types of messages
4. Building and compiling the graph of the Agent
For the company, you need to create an AI Agentic System that can
speed up drafting documents, emails, etc. The AI Agentic System
should have Human-AI Collaboration meaning the Human should be
able to able to provide continuous feedback and the AI Agent should
stop when the Human is happy with the draft. The system should also
be fast and be able to save the drafts.
Agent V
RAG