When Should You Use or Avoid Agent Frameworks?
When an agent framework is worth using, when plain code is simpler, and what a framework can hide, for your AI interview.
In short
An agent framework is a ready-made toolkit for building AI agents. Use one when the work is long, paused or shared across a team. For fixed steps, plain code and a model API are simpler, easier to test and easier to debug.
11 min readIntermediateCommon · estimateFacts checked 26 November 2026
Say it out loud
Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.
Agent frameworks are ready-made toolkits that handle the plumbing for an agent: model calls, tools, saved state and retries. I start with plain code and a model API. I add a framework only when the work runs for days, has to pause for a person, or must be shared by a whole team. The risk is hidden layers. If a framework hides the prompt, you can't debug what the model really saw.
An agent framework is a library that does the repeated work for you. An agent calls the model, runs the tool the model asks for, sends the result back and stops when the task is done. You can write all of that yourself. The real question is whether a framework saves more time than the hidden layers cost you later.
I'd start simple. Anthropic's December 2024 guide suggests that developers use the model API directly first, because many patterns fit in a few lines of code. A fixed job, such as reading a claim, looking up the policy and drafting a reply, is a chain of calls in plain code. A framework adds little there, and it adds one more place for bugs to hide.
A framework earns its place when the work is long and messy. Think of an agent that waits three days for an adjuster to approve a payment, then resumes the same case, or a team of ten that needs one shared way to log, test and hand over agents. There, saved state, retries and tracing are worth the learning cost.
The risk is the layers. Anthropic points out that frameworks often add layers that can obscure the prompts and responses underneath, which makes bugs harder to find. So if I use one, I read its code and log the exact text the model received.
What is an agent framework, in plain words?
An AI agent is a model that uses tools in a loop until a task is finished. Building one means writing the same plumbing each time: call the model, run the tool it asks for, send the result back, decide when to stop, and keep track of progress.
An agent framework is a library that does that plumbing for you, and often adds extras such as saved state, automatic retries and a trace of every step. OpenAI's Agents SDK is one example. Its GitHub page describes it as a lightweight yet powerful framework for building multi-agent workflows.
A framework is like a scaffold on a building site. It gets the crew up fast, but if nobody checks the frame, nobody sees the joint that is about to give. In AI work, that joint is the prompt the model actually receives. In a claims agent, that joint is the note the agent fetched from an email or a policy page: the model reads it as an order, and no one sees it before the reply goes out.
Key words
- Agent framework
- A ready-made library that runs the agent's repeated steps for you.
- Abstraction layer
- A wrapper that hides the detail underneath, so you write less code and see less.
- Agent loop
- Call the model, run any tool it asks for, repeat until it gives an answer.
- State
- What the agent remembers between steps, such as where a claim got to.
When should you use a framework, and when not?
Use a framework when the work is long, changing or shared. Skip it when the steps are fixed and a few model calls can do the job. Anthropic puts the trade-off simply: workflows offer predictability for well-defined tasks, and agents are the better option when flexibility is needed at scale.
- Plain code
Fixed steps, small team
A chain of calls you can read top to bottom. Easy to test, and you can print every prompt.
- Framework
Long, paused or shared
Saved state, retries and tracing pay off when work runs for days or many people share one standard.
- Framework trap
Added because it's popular
Extra layers hide prompts and make debugging slower. Nobody on the team can say why it's there.
Start with the simplest setup that fits
Your AI task
what the team needs done
Fixed steps
read, look up, draft, send
Open-ended steps
the model picks its next tool
Plain code
a chain of calls you can test
Agent loop
model calls tools until done
A framework?
only if long, paused or shared
- 1Steps the team can write down in advance go down this arrow to fixed steps.
- 2Steps the model must choose for itself make the work open-ended.
- 3Fixed steps go to plain code, which is easy to test.
- 4Open-ended work becomes an agent loop.
- 5Only the loop may need a framework, and only for long or shared work.
Anthropic's December 2024 guide makes two points that every candidate should be able to repeat:
“We suggest that developers start by using LLM APIs directly: many patterns can be implemented in a few lines of code.”
Anthropic, Building effective agents (December 2024)
“Incorrect assumptions about what's under the hood are a common source of customer error.”
Anthropic, Building effective agents (December 2024)
That guide is from December 2024. Anthropic says much of its tooling has changed since, so check the current docs before you quote it.
What does a framework hide from you?
Strip away the framework and an agent is a short loop. Anthropic describes agents as, typically, just LLMs using tools based on feedback from the environment in a loop. The code below is that loop with a made-up model that asks for one tool, so you can see what any framework wraps.
# A made-up model that asks for one tool, then answers. The loop below is the core of an agent.
SCRIPT = [
{"tool": "lookup_policy", "args": {"claim": "C-2291"}},
{"answer": "Claim C-2291 is covered up to $5,000."},
]
def fake_model(history):
# Stands in for a real model call: returns the next scripted step.
tool_results = [m for m in history if m["role"] == "tool"]
return SCRIPT[len(tool_results)]
TOOLS = {"lookup_policy": lambda claim: "policy for " + claim + ": cover limit $5,000"}
def run_agent(task):
history = [{"role": "user", "text": task}]
while True:
step = fake_model(history)
if "answer" in step:
return step["answer"]
result = TOOLS[step["tool"]](**step["args"])
history.append({"role": "tool", "text": result})
print(run_agent("How much does policy C-2291 cover?"))Output
Claim C-2291 is covered up to $5,000.
The loop itself does the agent's work: ask the model, check for an answer, run the tool, add the result and repeat. A framework wraps exactly this, and adds saved state, retries and tracing around it. Those extras are also where prompts get hidden.
What sits between your code and the model
Your code
your rules and the user's question
Framework layers
Tool wrapper
turns your functions into tool calls
Built prompt
the exact text sent to the model
State and retries
saves progress between steps
Model
sees only the final prompt
- 1Your code hands the job to the framework's tool wrapper.
- 2The framework builds the final prompt and sends it to the model, which sees only that text.
OpenAI's practical guide for agents, published in January 2026, points the same way: start small and keep one agent before you add many.
“Our general recommendation is to maximize a single agent's capabilities first.”
OpenAI, A practical guide to building agents (January 2026)
“Start small, validate with real users, and grow capabilities over time.”
OpenAI, A practical guide to building agents (January 2026)
How would you choose for a claims team?
A mid-size insurer wants an agent that reads each car insurance claim, checks the policy and drafts a reply. An adjuster approves every payment. You are asked what to build.
- 1
Map the steps first
Read the claim, check the policy, draft the reply, send it to an adjuster. These are four known steps, so start with plain code and one model call per step.
- 2
Add a framework only for a real need
If an adjuster can hold a claim for three days and the agent must pick it up again, you need saved state. A framework can give you that, or a small table in your own database can.
- 3
Keep every prompt visible
Log the exact prompt, tool results and reply for each claim, whichever tool you pick. This is the first thing you open when a reply is wrong.
- 4
Test on old claims before live ones
Replay two hundred closed claims with known outcomes and compare. Only then let it draft replies for real adjusters.
What does the interviewer want to hear?
A strong answer covers
- A plain definition: a framework is a toolkit that does the agent's repeated plumbing.
- Start with plain code and a model API, and say why.
- Name the triggers that justify a framework: long runs, pauses, shared standards.
- The cost: hidden layers make prompts and bugs harder to see.
- Read the code under any framework, and log the exact prompts.
- A framework doesn't replace limits, tests or human approval.
Common traps
Trap"Always use a framework, it is the standard."
BetterThere's no single standard. Pick the setup the task needs, and say why.
Trap"A framework makes the agent safe."
BetterSafety comes from limits you build: least access, checks in code, human approval.
Trap"More layers means more power."
BetterExtra layers add cost and hide what happened. Add one only when a named need asks for it.
Can you spot the best fit?
Spot the best fit
Which of these four jobs is the best case for a framework?
Quick check
An agent gives a wrong answer about a claim. What should the team check first?
Can you answer these from memory?
Flash cards · tap a card to flip it
What will they ask next?
Learn it in depth
Last updated on 26 November 2026
Choosing an agent setup for your own project?
I design and build AI agents, including the interface and the system behind them, so I can help you pick the simplest setup that does the job. Book a short call and tell me what it needs to do.