An agent is an LLM running in a loop, given the freedom to use tools to reach a goal. A plain prompt goes one way: you ask, the model answers, done. An agent adds a cycle. The model looks at the goal, decides whether it needs a tool, calls one, reads the result, and decides again - keep going or stop and answer.
You already met the piece that makes this possible. In tool calling the model didn't run your function - it told you which function to call and with what arguments, and you ran it. An agent is just that idea wrapped in a loop that runs the function automatically and feeds the result straight back to the model.
Every agent runs the same four steps until the goal is met:
Ask a plain model "what is 4817 times 39?" and it predicts text, which is why
it's shaky at exact math. Give an agent the same question plus a calculator
tool, and a different thing happens: the model decides it needs to calculate,
calls the calculator with 4817 and 39, reads the exact result, and answers
from that. The model didn't get better at arithmetic. It got the ability to
reach for a tool that is.
That's the whole point of an agent. The model supplies the judgment about what to do next, and the tools supply the abilities the model doesn't have on its own: doing math, reading a file, searching, calling an API. Next you'll see the small set of pieces that make one in LangChain.
Your lab setup
This VM comes preconfigured with your AI keys - just type claude to get started. Your key and URL are already set as $OPENAI_BASE_URL and $OPENAI_API_KEY.