# 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.

AI and LLM interview question Q183, Agents and tool use. Intermediate, common (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/when-should-you-use-or-avoid-agent-frameworks

## Say it in 30 seconds

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.

## Say it in 2 minutes

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.

- **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.

*Diagram, Start with the simplest setup that fits: Follow one path from left to right. Fixed steps stay in plain code. Only an open-ended agent reaches the framework question, and only long, paused or shared work says yes.*
1. Steps the team can write down in advance go down this arrow to fixed steps.
2. Steps the model must choose for itself make the work open-ended.
3. Fixed steps go to plain code, which is easy to test.
4. Open-ended work becomes an agent loop.
5. Only 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.

```python
# 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:

```text
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.

*Diagram, What sits between your code and the model: Your code talks to the framework, which builds the prompt and sends it on. The model only sees the final text, so when an answer goes wrong, you have to look one layer down to see what it received.*
1. Your code hands the job to the framework's tool wrapper.
2. The 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." Better: There's no single standard. Pick the setup the task needs, and say why.
- Trap: "A framework makes the agent safe." Better: Safety comes from limits you build: least access, checks in code, human approval.
- Trap: "More layers means more power." Better: Extra 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?

A. A bank's letter generator: read a form, check three fields, fill a template.
B. A claims agent that waits up to three days for an adjuster, then resumes the same case.
C. A FAQ bot that answers from one fixed text file, with no tools.
D. A one-time script that renames 4,000 scanned invoices in a folder.

**Answer:** B. Only the claims agent needs saved state across days and a person in the loop. The other three are fixed steps or one-off jobs, and plain code does them more simply and tests them more easily.

**Quick check:** An agent gives a wrong answer about a claim. What should the team check first?

A. Retrain the model on the claims data
B. Print the exact prompt and tool results the model received
C. Add more tools so it has more to work with
D. Raise the temperature setting so it tries harder

**Answer:** B. You can only fix what you can see. The exact prompt and tool results show what the model was given, which a framework's extra layers can hide. The other three guess at a cause.

## Can you answer these from memory?

**Flash cards**

- **What is an agent framework?** A ready-made toolkit for the agent's plumbing: model calls, tools, state, retries.
- **Where do you start?** Usually with plain code and a model API. Add a framework when a real need appears.
- **When does a framework earn its place?** Long-running work, pauses for a person, or one standard shared by a whole team.
- **What is the main risk?** Hidden layers. Prompts and bugs become harder to see and to debug.
- **What is the agent loop?** Call the model. If it asks for a tool, run it, add the result, and call again.
- **What does Anthropic advise?** Use the model API directly first. Frameworks can hide prompts, so know what's under the hood.

## Likely follow-up questions

- Q181 How do you evaluate agents? https://designervenkat.online/interview/ai/how-to-evaluate-ai-agents
- Q182 How do long-running agents use checkpoints? https://designervenkat.online/interview/ai/how-do-long-running-agents-use-checkpoints
- Q184 How do you manage agent state? https://designervenkat.online/interview/ai/how-do-you-manage-agent-state
- Q187 How do you control agent cost? https://designervenkat.online/interview/ai/how-do-you-control-agent-cost
- Q189 How do coding agents work? https://designervenkat.online/interview/ai/how-do-coding-agents-work

## Learn it in depth

- [Frameworks for AI apps](https://designervenkat.online/learn/ai-engineering/frameworks)
- [Agent SDKs](https://designervenkat.online/learn/ai-engineering/agent-sdks)
