Agents in LangChain are autonomous AI systems that use a Large Language Model (LLM) as a reasoning engine to decide which actions to take and in what order. Unlike simple chains with fixed steps, agents dynamically choose tools, APIs, or functions based on user input and intermediate results — repeating the think → act → observe loop until a final answer is reached.
Agents in LangChain are autonomous AI systems that use a Large Language Model (LLM) as a reasoning engine to decide which actions to take and in what order. Unlike simple chains with fixed steps, agents dynamically choose tools, APIs, or functions based on user input and intermediate results — repeating the think → act → observe loop until a final answer is reached.
An Agent combines an LLM with a set of Tools and a reasoning strategy (called an AgentExecutor). The LLM acts as the 'brain' — it reads the input, decides which tool to call, observes the result, and either calls another tool or returns a final response. This loop is often referred to as the ReAct (Reasoning + Acting) pattern.
LLM / Chat Model — The reasoning engine that decides what to do next
Tools — Functions the agent can call (e.g., web search, calculator, SQL query)
AgentExecutor — The runtime loop that executes the think → act → observe cycle
Prompt Template — Instructs the LLM on how to reason and format its actions
Memory (optional) — Allows the agent to remember past interactions
ReAct Agent — Reasons step-by-step using Thought → Action → Observation
OpenAI Tools Agent — Uses OpenAI's native function/tool calling capability
Structured Chat Agent — Handles multi-input tools with structured arguments
Self-Ask with Search — Breaks complex questions into sub-questions iteratively
Plan-and-Execute Agent — Plans all steps first, then executes them sequentially
In LangGraph (the newer LangChain framework for agents), agents are modeled as stateful graphs where each node represents an action or decision point. This gives developers fine-grained control over the agent's flow, making it ideal for complex multi-step and multi-agent workflows.