LLMs have made it possible to interact with AI systems. These systems do communicate with each other.
There are two popular frameworks to build Agentic AI applications — LangChain and LangGraph. Each has its own building blocks and differ in handling core pieces of functionality. It is for you to decide which framework best suits your purpose.
Lang Chain
It is a sequential chain of predefined commands or the use of LangChain agents. Chains are sequence of steps, and include calls to LLMs, agents, tools, external data source, procedure code etc. Chains can branch into multiple paths.
Agents or LLMs can generate responses in natural language. An agent, however, apart from using natural language, can also use capabilities to reason, call tools and repeat the process of calling tools (in case there are failures).
Tools are code-based functions. These could be called in the chain. These could also be called in the chain. These could also be invoked by an agent to interact with external systems.
Prompts include a system prompt that instructs the model to complete a task and indicates what tools are available. The user prompt instructs the model to complete.
LangGraph
It coordinates workflows like a graph. Where a linear chain or branched chain or agent system are not sufficient, LangGraph is used to handle more complex conditional logic and feedback loops.
Graphs organize workflow with flexibility. These support cyclical graphs too. Nodes represent steps in workflow. When output of one node becomes the input of another node, it is called edges. While doing so if a certain condition is met, it is called conditional edge.
State denotes the current status of application as information flows through the graph.
Agents or LLMs generate a text response to an input. Agents can make decisions about which path to take in the graph. They can perform more tasks than just text generation.
LangGraph and LangChain overlap in some capabilities. Their approach to problem is different. Lang Chain is linear and LangGraph is more granular. LangChain can be mastered easily LangGraph allows more custom control. LangChain provides an opportunely to run multiple chains or agents in parallel. LangGraph support parallel execution of nodes.
Both can be used independent of each other, or both can be used together.