Build Multi-Step Agents
In Build Your First Agent, the pr-review agent is one model call with one prompt. The model does all the work: it fetches the pull request, reads the code and writes the review. In this track, you split that work into steps. A code step fetches the diff the same way each time. A condition stops the review of a pull request that is too large. Two subagents check security and tests. The agent then returns fields that a script or another agent can read, and it saves the review as an artifact. Each page changes the agent from Build Your First Agent and ends with a run that you can check.
| Page | You do | You learn |
|---|---|---|
| 1. Split the agent into steps | Fetch the diff in a code step, review it in a model step, and skip a pull request that is too large. | steps, code steps, with.prompt, step outputs and if/then/else |
| 2. Add subagents | Add a security reviewer and a test reviewer that the review step calls. | Inline subagents, invoke_<name> tools, and subagents in the transcript |
| 3. Return structured results and artifacts | Return a verdict and a list of blockers. Save the review as a document. Read the fields from the CLI and from a second agent. | returns, agent outputs, artifact templates and agent steps |
The track takes about 45 minutes.
Before you start
- Do the Quick Start and Build Your First Agent chapters 1 to 3. You need the
pr-reviewagent and thereview-rulesskill in your project. - Use the example pull request autohealai/astronomy-shop-template#1. It adds a timeout to the call from the recommendation service to the product catalog. The repository is public, so you do not need a GitHub Integration Connection.
- You need the Member role, to commit to the project and start runs.
- For the "From the CLI" sections, install the
autohealCLI and log in. See chapter 8. - The pages build a new agent,
pr-review-steps, from a copy ofpr-review. They do not changepr-review, so the other tracks still work.
Keep post_comment off in every run in this track.