Agent vs RAG vs Pipeline
These three terms are conflated everywhere. The distinction:
- βPipeline β fixed sequence of steps. Predictable, fastest, cheapest.
- βRAG β pipeline with one retrieve step. Grounds answers in your data.
- βAgent β the LLM decides the steps at runtime, including calling tools and looping.
If the task is the same every time, build a pipeline. If you need fresh facts, add RAG. If the task varies and needs decisions or tool use, you actually need an agent.
The agent loop
Every agent, no matter the framework, runs some variant of this loop:
- βReceive goal / next user message
- βThink β LLM reasons about what to do next
- βAct β call a tool (function call) or produce a final answer
- βObserve β read the tool's output
- βRepeat from 'Think' until done
Core primitives
Modern agents are built from a small set of repeating ideas:
- βFunction calling β JSON-schema-based tool invocation; the bedrock primitive
- βMemory β short-term (conversation), long-term (vector store), MemGPT-style managed
- βReasoning patterns β ReAct, Plan-and-Execute, Tree of Thought, Reflexion
- βGuardrails β permission gates, budget limits, human-in-the-loop approvals
- βObservability β trace every LLM call, tool call, retry
Which framework should you use in 2026?
The agent framework landscape has settled around four tools:
- βLangGraph β state machine + graph for agents; the modern LangChain answer
- βCrewAI β role-based crews; great for hierarchical multi-agent teams
- βOpenAI Agents SDK β handoffs, guardrails, built-in tracing; OpenAI's official stack
- βMCP (Model Context Protocol) β Anthropic's open standard for tool servers