When Agents Are Overkill
Not Every Problem Needs an Agent
Agents are powerful but come with costs (money, latency, complexity). Sometimes a simpler approach works better.
Simple Prompt Is Often Better
If the task is simple and one-shot, just use an LLM prompt. No tools needed.
Example: "Summarize this article in 3 sentences."
You can pass the article to Claude or GPT-4 with a prompt. The model reads it, summarizes, done. No loop needed.
Why not an agent: The task is done in one step. The model doesn't need to decide what to do next.
Chain Is Better for Fixed Workflows
If the steps are always the same and happen in the same order, use a chain.
Example: Data processing pipeline.
- Load CSV file
- Validate data
- Clean and normalize
- Write to database
You write code that does these steps in order. The model runs once at the start (maybe to understand the schema) and that's it.
Why not an agent: The steps never change. The model doesn't need to make decisions.
When to Use an Agent
Use an agent when:
-
Multiple possible paths. The task could go in different directions depending on what happens. Example: customer support (depends on the question).
-
Unknown number of steps. You don't know how many times the agent will need to search, fetch, or calculate. Example: research (you might need 2 sources or 10 sources).
-
Model must decide. The LLM needs to pick which tool to use based on the situation, not based on hardcoded logic. Example: routing ("should this go to inventory check or billing?").
Decision Tree
Ask yourself these questions:
Question 1: Is the workflow always the same?
- Yes: Use a chain.
- No: Continue to question 2.
Question 2: Does the model need to pick a tool?
- No: Use a simple prompt.
- Yes: Continue to question 3.
Question 3: Is cost a major concern?
- Yes: Try to simplify or use a chain if possible.
- No: Use an agent.
Real-World Examples
Simple prompt (no tools, no agent):
- "Translate this text to French."
- "Generate 5 product descriptions."
- "Answer these trivia questions."
Chain (fixed steps, no agent):
- ETL pipeline: Extract -> Transform -> Load
- Content workflow: Write -> Review -> Publish
- Data pipeline: Read -> Validate -> Process -> Save
Agent (multiple paths, model decides):
- Research assistant: Search, read, synthesize based on what you find
- Customer support: Route based on question type
- Task planning: Break down a goal into steps and execute
Cost Comparison
Simple prompt: 1 API call. Cost: $0.001
Chain with 3 steps: 4 API calls (1 planning + 3 execution). Cost: $0.005
Agent: 5-15+ API calls depending on complexity. Cost: $0.02 to $0.10
For a simple task, the agent might cost 100x more than a simple prompt.
Complexity Cost
Agents are also harder to debug and test. If something goes wrong:
Simple prompt: Error is usually in the prompt. Fix the wording. Try again.
Chain: Error is in one of the steps. Debug that step.
Agent: Error could be in tool descriptions, tool selection, tool execution, error handling, or the loop logic. Harder to debug.
When to Start Simple
- Start with a simple prompt.
- If the model's answer is not good enough, try a chain.
- If a chain doesn't work (too rigid), add an agent.
Don't jump to agents. They are a tool for a specific problem. Use the simplest tool that solves your problem.
Discussion
Sign in to comment. Your account must be at least 1 day old.