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 •
92 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