Coding Now – Best AI & Full Stack Courses in Delhi NCR | 100% Placement
Limited Offer: Get 50% OFF on AI & Full Stack Courses
📞 Call Now: +91 9667708830
Home Community What are LangChain agents and how do they differ from chain…

What are LangChain agents and how do they differ from chains?

Coding Now Expert  •  Jun 13, 2026  •  53 views
**LangChain Chains:**
- Fixed, predefined sequence of steps
- The flow is hardcoded by the developer
- Deterministic — same input → same path
- Example: Input → Retrieve docs → Generate answer

**LangChain Agents:**
- LLM decides which tools to use and in what order
- Dynamic — the AI plans its own steps
- Non-deterministic — adapts based on the query
- Can use tools: web search, calculator, code executor, database

```python
from langchain.agents import create_react_agent, AgentExecutor
from langchain.tools import WikipediaQueryRun

tools = [WikipediaQueryRun(), calculator_tool]
agent = create_react_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools)

result = executor.invoke({"input": "What is today's date and what is 2^10?"})
# Agent decides: use date tool, then calculator tool
```

**When to use:**
- Chain: when you know the exact steps
- Agent: when the steps depend on the query
0

0 Answers

Your Answer

Will not be displayed publicly
💬 Talk to Advisor
1
WhatsApp

Latest from Our Blog

Insights on AI, Data Science, Full Stack & Career

View All Articles →