Steps
Delegate a step to an agent
Have an agent step pick out the risky commits since a release and return them as typed output.
risky_changes lists the commits since a ref, then gives them to an agent step that decides which are risky to ship. Which diffs it reads depends on what each commit changed, so a fixed list of steps can't do it.
version: 2
identifier: risky_changes
name: Risky changes
description: The commits since a git ref that are risky to ship, and why.
input_schema:
type: object
required:
- base
properties:
base:
type: string
description: The ref to start after, such as a release tag
steps:
- id: commits
tool_name: github__tool__git_log
input:
base: '{{input.base}}'
head: HEAD
- id: review
tool_name: agent
input:
prompt: |-
Which of these commits are risky to ship? Look at the files a commit
changed, and its diff when the files alone don't tell you.
{{commits.commits}}
tools:
- github__tool__git_changed_files
- github__tool__git_diff
maxIterations: 6
outputSchema:
type: object
required:
- risky
properties:
risky:
type: array
items:
type: object
required:
- sha
- reason
properties:
sha:
type: string
reason:
type: string
finish:
output:
risky: '{{review.output.risky}}'
iterations: '{{review.iterations}}'
final: '{{review.final}}'Set up the agent step
The review step's input tells the agent what to do and what to return:
promptis the task, with the commits filled in from the step before.toolslists the only tools the agent may call.maxIterationscaps the model rounds. Each round is one model call.outputSchemais the shape of the answer, which later steps read as{{review.output}}.
Run it
dive plan run risky_changes \
--input base=v0.21.0The agent reads every commit's changed files, then the diffs of the ones that look risky:
→ github__tool__git_log {"base":"v0.21.0","head":"HEAD"}
✓ github__tool__git_log 36.2ms
→ github__tool__git_changed_files {"base":"648d34e…~1","head":"648d34e…","prefix":""}
→ github__tool__git_changed_files {"base":"cd01c05…~1","head":"cd01c05…","prefix":""}
…
→ github__tool__git_diff {"base":"dae2d40…~1","exclude":"","head":"dae2d40…",…}
…
6 calls · 432k in / 11k out (246k cached) · $0.94The answer matches outputSchema. iterations is how many rounds the agent took, and final is false when it ran out of rounds before answering:
{
"final": true,
"iterations": 6,
"risky": [
{
"reason": "In-place migration of on-disk store format (v1->v2) that rewrites every existing user's thread message logs…",
"sha": "dae2d400f1f6fe7c8567d74e15d4b095138e32cb"
},
{
"reason": "Breaking change (feat!) to the core plan contract: finish is now required…",
"sha": "648d34e22ede0d8c246576493b39487237272607"
},
…
]
}