Learners will understand what an AI agent is, why a single LLM call is not enough for complex tasks, and how to build a simple agent loop in Spring Boot using the patterns EngineerPrep uses in production.
Picture the EngineerPrep AI tutor answering a question about concurrency in Java. A student asks: "Is HashMap thread-safe?" Internally, the system makes one call to Claude via Amazon Bedrock, gets back a paragraph, and sends it to the student. Done. Most of the time, that works fine. But now the student follows up: "Can you show me a code example and tell me which line would cause a race condition?" The LLM answers again — but it has no memory of the first turn, no ability to run the code to verify it, and no way to check whether the example it just produced actually compiles. You can throw a better prompt at this. But what happens when the task requires looking something up , trying something , and correcting course based on the result ? A single LLM call can't do that. It's like asking someone to bake a cake by reading one sentence of a recipe…
An agent is just an LLM that can take actions, observe the results, and decide what to do next — in a loop — until the task is done. Think of it like a new employee on their first day. You don't hand them a document and say 'answer all questions forever.' Instead, they ask questions, look things up in the company wiki, check their work, and ask again if they're unsure. They loop until the job is done. An AI agent works the same way: 1. It receives a goal (e.g., 'explain HashMap thread safety with a concrete example'). 2. It decides whether it needs more information or can answer directly. 3. If it needs more info, it calls a tool — a function you've given it access to (like a database search, a code runner, or a documentation lookup). 4. It reads the tool's result, then decides the next step. 5. It keeps looping until it has enough to give a final answer.…
Imagine a timeline, left to right. On the left is the student's question. On the right is the final answer. In between is the agent loop. Step 1 — The goal arrives. A student asks: 'What's the difference between synchronized and ReentrantLock in Java?' The agent receives this goal. Nothing has happened yet — it's just thinking. Step 2 — The agent reasons. The LLM looks at the question and thinks: 'I could answer from memory, but EngineerPrep has authoritative lesson content on this topic. I should look it up first.' This is just the LLM deciding which tool to call — it outputs something like: {tool: 'searchLessons', query: 'synchronized vs ReentrantLock'} . Step 3 — The tool runs. Your Spring service receives that tool call and executes a pgvector similarity search against the lessons table. It returns two relevant lesson excerpts. The agent didn't search the database…