Skip to content
Tutorials Center
My learning

Topics

Lesson 4 of 39 ยท Getting Started

Agent Use Cases, Limits and When Not to Use One

Decide when an AI agent is the right tool: strong use cases, honest limits, cost and reliability math, and a scoring checklist you can run in Python.

Agents are exciting, and that makes them easy to overuse. An agent adds cost, latency and unpredictability compared with a plain program or a single model call. You should reach for one only when the task needs what an agent uniquely offers: flexible, multi-step decisions using tools. This lesson gives you a way to judge, with concrete use cases, honest limits and a little arithmetic about reliability.

Where agents earn their keep

Good agent tasks share a pattern: the steps cannot be listed in advance, success can be checked, and the damage from a wrong step is small or reversible.

  • Coding assistants. Read files, run tests, edit code, run tests again. The test suite is an automatic judge.
  • Research and analysis. Search several sources, extract numbers, cross-check, write up findings with citations.
  • Support triage. Read a ticket, look up the customer, check order status, draft a reply or escalate.
  • Data chores. Clean files, reconcile records between systems, generate reports.
  • Operations helpers. Investigate an alert by querying logs and metrics, then propose a fix for a human to approve.

Where they struggle

  • Tasks with an obvious fixed recipe. If you can write the steps as code, do. It will be faster, cheaper and testable.
  • Tasks that need perfect accuracy every time. Each step can go wrong, and errors compound.
  • Irreversible actions without a human check. Sending money, deleting data, emailing customers.
  • Very long tasks without checkpoints. The context fills with noise and the agent drifts from the goal.
  • Environments without good feedback. If nothing tells the agent that it failed, it cannot correct itself.

Errors compound

Suppose each step succeeds 95 percent of the time, which sounds excellent. A task needing 10 independent steps succeeds only about 60 percent of the time. Reliability multiplies, so long chains need either shorter paths, verification after steps, or a human in the loop.

Python Reliability of multi-step chains

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The last line shows the key idea of reliable agents: detect failure and retry. That only works if each step has a check, for example a test, a schema validation or a second look. This is why tasks with built-in verification suit agents so well.

Cost and latency

An agent run is many model calls, each one resending a growing history. Even a modest task can use ten or more calls. Estimate before you build.

Python Estimate the cost of an agent run

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Input tokens grow faster than the number of steps, because each call re-reads the earlier ones. Thirty steps cost far more than three times ten. Caching of the repeated prefix (offered by many providers) and trimming the history are the usual remedies.

A quick scoring checklist

Before building an agent, answer a few questions. The helper below turns the answers into a rough recommendation. It is a thinking tool, not a law.

Python Should this task be an agent?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

When the verdict is "workflow", look at workflows versus agents: often a fixed pipeline with one or two model calls is the better design. When it is "agent", you still need limits, which stop conditions and budgets covers.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which feature makes a task especially suited to an agent?

    Open-ended paths need an agent's flexibility, and automatic checks let it detect and fix its own mistakes.
  2. 2. If each of 10 independent steps succeeds 95 percent of the time, roughly how often does the whole task succeed?

    0.95 to the power of 10 is about 0.60. Reliability multiplies across steps.
  3. 3. Why can input cost grow faster than the number of steps?

    Step N pays for all earlier messages again, so total input grows roughly with the square of the step count.
  4. 4. Sending customer refunds automatically is risky mainly because...

    Irreversible actions without verification turn a small model mistake into real loss.

Summary

  • Use an agent when the path is open-ended, tools are needed and results can be verified.
  • Prefer plain code or a fixed workflow when the steps are known.
  • Reliability multiplies across steps; detection and retry lift it.
  • Costs grow quickly because every call rereads the history.
  • Gate irreversible actions behind a human.

Next: The Perceive, Think, Act Loop