LLMS & GENERATIVE AI · QUESTION 41
What is an LLM agent, and when should you use one?
On this page
An LLM agent is an application pattern in which a model selects actions or tools over one or more steps toward a goal, using observations to decide what to do next. Agents can handle tasks with uncertain paths, but introduce latency, cost, and harder-to-predict behavior. Use them only when simpler workflows are insufficient, with bounded tools, step limits, monitoring, and human approval for consequential actions.
LET'S MAKE IT SIMPLE
First, the idea in plain English
A fixed workflow follows steps chosen by the developer. An agent can choose among available actions based on what it observes, then continue after seeing a result. This flexibility can help when the route is not known in advance. It also means the application must control how many steps happen, what actions are allowed, and when the system stops.
A USEFUL COMPARISON
Picture it this way
A travel assistant might check flight availability, compare dates, and ask before booking. It adapts its next lookup based on earlier results, but should not buy a ticket without permission. The model is not an independent employee: the surrounding application must enforce the budget, permissions, and approval rules.
FOLLOW THE JOURNEY
An agent cycles through plan, action, observation, and stopping
Explain the iterative tool-use loop and its safety boundaries.
This simplified visual highlights the main relationships. In practice, the exact design depends on the requirements; Unchecked loops can repeat or cause unintended effects.
An agent receives a goal, selects an allowed action, observes a tool result, and repeats until a stop condition or human approval boundary is reached.
How to read this visual
This simplified visual highlights the main relationships. In practice, the exact design depends on the requirements; Unchecked loops can repeat or cause unintended effects.
UNDER THE HOOD
How it works, step by step
Set goal and limits
Define the task, tool permissions, time budget, and stop conditions.
Why it matters: An open-ended loop needs explicit boundaries.
Choose an action
Select a permitted tool based on current context.
Why it matters: The action should advance the goal without exceeding authority.
Observe result
Validate and add the tool result to the working context.
Why it matters: The next decision must use reliable observations.
Stop or request approval
Check completion, step limits, and human review requirements.
Why it matters: Unchecked loops can repeat or cause unintended effects.
OUTSIDE THE TEXTBOOK
A practical example
An internal research assistant can search approved knowledge pages, gather citations, and draft a summary. It has read-only tools, a maximum number of search steps, and must ask before sending or publishing anything. The user can inspect sources and stop the process at any time.
GO A LITTLE DEEPER
Technical details that matter
- A workflow graph with fixed transitions is often more predictable than a free-form agent loop.
- Track tool calls, observations, token use, latency, and stop reasons for debugging and evaluation.
- Sandboxing, least privilege, approval checkpoints, and explicit budgets constrain potential impact.
MAKE A GOOD CHOICE
When is this useful?
- Research tasks that require a variable sequence of approved lookups.
- Multi-step workflows where intermediate results determine the next query.
- Low-risk assistance where a person reviews the final output.
Use deterministic orchestration, a state machine, or a fixed tool sequence when the process is known; it is easier to test and operate.
WATCH OUT FOR
Common misunderstandings
- Calling any model-plus-tool workflow an autonomous agent without defining its control loop.
- Giving an agent broad write permissions or an unlimited execution budget.
- Using an agent where a single retrieval or deterministic workflow suffices.
REAL-WORLD TRADE-OFFS
Limitations and failure cases
- Multi-step errors compound and can be difficult to reproduce.
- Repeated calls increase latency and cost.
- A model may misinterpret tool results or fail to stop appropriately.
WHAT TO REMEMBER
Key takeaways
- 1Agents iteratively choose actions based on observations.
- 2Use them only when flexibility justifies complexity.
- 3Constrain permissions, steps, cost, and side effects.
PRACTICE THE FOLLOW-UP
What might an interviewer ask next?
When would you choose a fixed workflow over an agent?
Choose a fixed workflow when steps and decisions are known. It is generally easier to validate, secure, and debug.
How do you prevent an agent from running indefinitely?
Set step, time, and token budgets, define terminal conditions, detect repeated actions, and provide a clear interruption path.
SAY IT OUT LOUD
How to explain this in an interview
“An LLM agent uses a model to select tools over multiple steps, observes results, and decides what to do next. It is useful when the path depends on intermediate findings, but I would prefer a fixed workflow when possible. For an agent, I would set narrow permissions, explicit step and cost limits, logging, stop conditions, and human approval for consequential actions.”
Connect this question to the roadmap topic it supports.