1. Define the Agent in YAML
An agent is a folder in your project's Git repository. In this chapter, you give the PR Review agent a description, an icon, a second input, and instructions in their own Markdown file.
Step 1: Open the editor
Go to Agent Studio → Agents, open PR Review, and click Edit. The editor opens agents/pr-review/agent.yaml.
Each change that you make goes into a draft on the current branch. The Changes panel lists the changed files. Other people do not see a change until you commit it.
Step 2: Move the instructions to a file
At the bottom of the file tree, click New → New file. In Path, type agents/pr-review/instructions.md and click Create. Give the file this content:
You review one pull request on a public GitHub repository.
1. The prompt has the pull request URL. Add `.diff` to the URL and download it with `curl -sL` in your shell.
2. Read the diff.
3. Write a verdict: merge, merge with changes, or do not merge.
4. Name the riskiest change, with its file.
5. Ask the author one question.
Look hardest at the `focus` input. For `correctness`, look for bugs and errors that the code does not handle. For `security`, look for secrets, unsafe input and permissions. For `tests`, say what the tests do not cover.
Only read. Do not comment on the pull request and do not push.
Step 3: Update agent.yaml
Replace the content of agent.yaml with this:
apiVersion: agents.autoheal.ai/v1
name: PR Review
icon: git-pull-request
description: >-
Reviews one pull request and gives a verdict, the riskiest change and a
question for the author. Give it the pull request URL.
instructions: ./instructions.md
inputs:
prompt:
description: The pull request URL.
focus:
type: string
description: What the review looks at hardest.
enum: [correctness, security, tests]
default: correctness
| Field | What it does |
|---|---|
apiVersion | Always agents.autoheal.ai/v1. Required. |
name | The name that people see. Required. |
icon | A Phosphor icon name. |
description | What the agent does and when to use it. People and other agents read it to choose an agent. |
instructions | The agent's job and rules. Write them inline, or name a Markdown file in the agent's folder. |
inputs | The values that a run gets. prompt is always there. focus is a second input with three allowed values. |
Step 4: Commit and run
In the Changes panel, click Commit changes, then Commit 2 files. Open the agent's Overview tab. The run launcher now shows the focus choice. Select security, paste the pull request URL from the Quick Start, and click Start run. Check that the review now talks about security, for example secrets and unsafe input.
What to know
- An unknown field fails validation. For example,
instruction:instead ofinstructions:is an error. The editor shows the error before you commit. - Autoheal keeps each commit with its author. The agent's History tab shows who changed what and when.
- The folder name is the agent's ID. To rename the agent, change
name, not the folder.
From the CLI
autoheal agents pull pr-review
# edit agents/pr-review/agent.yaml and add agents/pr-review/instructions.md
autoheal agents validate agents/pr-review
autoheal agents push agents/pr-review -m "Add focus input"
autoheal run pr-review "https://github.com/autohealai/astronomy-shop-template/pull/1" --arg focus=security --follow
See the Agent and Trigger Reference for every field.