LangGraph
Langgraph is a framework based on LangChain to build agentic workflows where you define the flow and the possible routes, while the LLM takes the decision on how to follow through!
Lang-Graph is not as restrictive as Langchain with it’s router system as the LLM can decide on what tools and flows it can take, they provide memory and a persistence layer as well.
This framework has three main components
- State - The state of the application is stored in a Pydantic
BaseModelor aTypedDictthis state is shared between all the application nodes - Nodes - These encapsulate the application logic, they take in the state and modify the state and return it, or they use the state and do something else
- Edges - These are the guiding system, they give information on what node should be executed next
There are different types of edges
- Normal edges - if you know that after a certain step you always call node 2, then you use the normal edge
- Conditional Edge - You call a function to determine which nodes to move to next
- Entry Point - the node to call when the user input arrives
- Conditional Entry point - call a function to determine which nodes to call first when user input arrives.
In short: _nodes do the work. edges tell what to do next _