What are Agents?
You finished a RAG chatbot that retrieves on every message. An agent is the next step: you hand the model a few Python functions and let it decide when to call them. No code in this lesson yet.
Chains do not choose
A chain runs the same steps in the same order. Load, split, embed, retrieve, answer — you wired that path in End-to-End RAG and it does not change per question.
An agent leaves room to branch. You still call the model, but you also pass a short list of tools. The model can reply immediately, call one tool, or call a few and come back. You are not writing if weather then … in your script.
Your RAG chatbot today
An agent
Retrieval is not always enough
"What does the <a> tag do?" fits your existing retriever — the chunks already mention hyperlinks. "What's the weather in Kolkata?" does not. No PDF you indexed yesterday knows today's temperature. You need a live API, or the bot should admit it cannot tell.
Words you will see in docs
The rest of this module uses the same three terms over and over:
Model — same ChatOpenAI call as before; it now also decides whether to invoke a tool.
Tools — plain Python functions you register, e.g. fetch weather, run 2 + 2, hit a REST URL.
Loop — model → optional tool → model again until it stops with a final string.
LangChain bundles that loop in create_agent. We start wiring tools in the next lessons. Agent docs.