Agents, lesson 17
Capstone: an agent with tools, traces and limits
Build an agent end to end and measure it.
This lesson pulls the module together, from "Observe, decide, act" onwards, by following one agent through one run and then measuring it.
Part 1. The job and its boundaries
A team's CI builds fail a few times a day, and someone has to read the log, work out what broke, and tell the author. The agent here does that first pass. When a build fails on a pull request, it reads the evidence and posts one comment on the PR: which test failed, the likely cause, and the lines to look at.
Its tools, sorted into tiers as in "Limits on what an agent may do": get_build_log, get_diff and search_code only read, so they run freely. rerun_job costs CI time, so it's allowed once per run. post_comment writes, but a comment can be edited or deleted, so it runs without approval and carries an idempotency key. There is no merge, push or revert tool at all.
Its limits: at most 15 steps, 80,000 input tokens across the whole run, and 300 seconds. Its state, kept by your code: the build and PR numbers, the step count, which once-only tools are used, and whether the comment is posted.
Your turn
Reverting the PR's commit would fix the build fastest. Why does the agent get no revert tool?
Part 2. One run, step by step
Keep going with Pro
You've done the first part. Pro opens the rest of this lesson, and every other one.
- One run, step by step
- Where the safety net caught things
- Ending, and checking the work
Agents overviewSpotted a mistake? Tell us.