Agents · L2 · 15 min
Step caps and traces
Learn in five minutes
- A step cap is the maximum number of tool rounds.
- Without a cap, a loop can repeat.
- A trace lists each proposal, validation, result, and stop reason.
- Lab 07 corrects a bad guess with a tool and then stops.
- The stop reason is part of the artifact.
If the same tool returns the same result twice, stop. Another round will not add a fact. Write that rule next to the cap.
Visual
Read the agent loop lab
- Run python3 labs/07-agent-loop.py.
- Read the artifact's steps.
- Find the stop.
- Confirm the bad guess was replaced by the tool result.
Quiz
Ecosystem
- Trace
- The ordered record of what the loop did.
Sisters: Workflows, State machines, Function calling.
The same loop can sit behind chat or a voice turn. The channel does not remove the cap.
MCP is one way to plug tools into that loop. It is the next track.
Config
- Write the goal in one sentence.
- Name the input and the allowed output.
- Save the trace next to the result.
Troubleshooting
- The answer looks fluent and is wrong. Check whether a source passage actually contains the claim.
- The loop never stops. Set a step cap and stop when the tool result repeats.
Sources and go deeper
- Anthropic, Building effective agents vendor last checked 2026-10
- Large language model — Wikipedia wikipedia last checked 2026-10