When to Use an Agent
Agents vs simple prompts vs fixed pipelines.
Three Ways to Solve a Task
Before you build anything with Claude, you make one key decision: how much autonomy does the task need? There are three patterns:
- Simple prompt — one request, one reply.
- Fixed pipeline — a known sequence of steps you wire up yourself.
- Agent — the model decides which tools to call and when, looping until the work is done.
Picking the right one is an architecture decision. Over-build and you add cost and failure points; under-build and the task can't complete. This lesson teaches you to choose well.
The Simple Prompt
A simple prompt is a single API call: you send a system message plus messages, and you get one answer back. No tools, no loop.
Use it when the task is self-contained: rewriting text, summarizing a paragraph, classifying a sentence, answering a question from given context. If everything the model needs is already in the prompt, you don't need anything more.
Remember: the model keeps no state. Each call is independent — you must resend the full messages history yourself if you want continuity.
import anthropic
client = anthropic.Anthropic()
resp = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=512,
system="You rewrite text to be clear and concise.",
messages=[
{"role": "user", "content": "Rewrite: 'The meeting, which was long, ended.'"}
],
)
print(resp.content[0].text)