Agentic workflows turn LLMs from "text generators" into "process executors." The model can observe, decide, call tools, check results, and loop until a goal is met -- or give up and escalate.
Common patterns: ReAct (reason-act-observe loop), supervisor/worker (one model plans, smaller models execute), self-critique (one model generates, another reviews). The right pattern depends on cost, latency, and how bounded the task is.
Example Prompt
You are a coding agent with tools: read_file, write_file, run_tests, search_docs.
Goal: fix the failing test in tests/test_auth.py.
Loop:
1. Read the test and the code under test.
2. Form a hypothesis about the bug.
3. Write a fix.
4. Run the test.
5. If it still fails, analyze the new failure and try again (max 5 attempts).
6. If successful, summarize what you changed and why.When to use it
- The task has a clear success signal (tests pass, data shaped correctly)
- Multiple steps are required that depend on each other
- The path to success varies by input
- You have tools and a sandbox that can bound the blast radius
When NOT to use it
- There's no good signal for "done"; the agent will loop forever
- Tasks where a single well-crafted prompt does the job
- Tight latency/cost budgets that can't tolerate multi-step reasoning
- Critical systems without human approval in the loop
