You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Use Argos to allow AI agents to review visual changes in a PR.
5
+
---
6
+
7
+
# Review builds with AI agents
8
+
9
+
Argos lets AI agents review visual changes in a pull request. The agent can use Argos build data to understand what changed, check whether the screenshots match the pull request's intent, and detect regressions.
10
+
11
+
By default, ask the agent to summarize the visual changes first. If you want it to take action, it can also create an Argos build review to approve the changes or request changes.
12
+
13
+
## What you need
14
+
15
+
- A pull request with an Argos build.
16
+
- The [Argos CLI](/argos-cli).
17
+
- The Argos agent skills, when your assistant supports skills.
18
+
- An Argos project token to read build data with `build get` and `build snapshots`.
19
+
- A user token to create a build review, only if you want the agent to approve or request changes.
Set a project token so the agent can read Argos build data:
31
+
32
+
```bash
33
+
export ARGOS_TOKEN=<project-token>
34
+
```
35
+
36
+
If you want the agent to create the Argos build review from your local CLI session, authenticate as your Argos user:
37
+
38
+
```bash
39
+
npx @argos-ci/cli login
40
+
```
41
+
42
+
Then start a new AI chat and give the agent the pull request URL:
43
+
44
+
```text
45
+
Use $argos-pr-review to review this pull request with its Argos build.
46
+
https://github.com/acme/app/pull/123
47
+
```
48
+
49
+
The `$argos-pr-review` skill contains the detailed review workflow. The `$argos-cli` skill gives the agent the CLI commands, flags, authentication rules, and output formats.
50
+
51
+
## What the agent does
52
+
53
+
The agent will inspect the pull request, find the Argos build from the pull request status check or Argos comment, and use Argos build data to understand the visual changes.
54
+
55
+
It should first summarize what changed visually. Then it compares the screenshots with the pull request intent.
56
+
57
+
When the screenshots match the pull request intent, the agent can suggest approving the build. When they reveal a regression, it can suggest requesting changes and explain which snapshots are affected.
58
+
59
+
If the build is still pending, the agent should wait before reviewing. If there are no visual changes or the build is already accepted, no visual review is needed.
60
+
61
+
---
62
+
63
+
## Other cases
64
+
65
+
### If the agent cannot access the pull request
66
+
67
+
You can provide the Argos build URL and a short description of the expected change:
68
+
69
+
```text
70
+
Use $argos-pr-review to review this Argos build:
71
+
https://app.argos-ci.com/acme/app/builds/456
72
+
73
+
Expected change:
74
+
The login page was redesigned with social login options.
75
+
```
76
+
77
+
The build data still lets the agent explain what changed visually, but the pull request context makes the review decision stronger.
78
+
79
+
### If your assistant does not support skills
80
+
81
+
Use a more explicit prompt:
82
+
83
+
```text
84
+
Review the visual changes in this pull request with Argos:
85
+
https://github.com/acme/app/pull/123
86
+
87
+
Use the pull request title, description, linked issue, and code diff to understand the intended change.
88
+
Find the Argos build, fetch the build metadata, and fetch the snapshots that need review.
89
+
Use the diff mask, baseline file, current file, and metadata as visual evidence.
90
+
91
+
First summarize what changed visually in the build.
92
+
Then compare the screenshots with the pull request intent.
93
+
94
+
If the snapshots match the intent, suggest approving the Argos build.
95
+
If they reveal a regression, suggest requesting changes and list the affected snapshot names.
96
+
If they look flaky, explain the flake signal and do not suggest approval until it is resolved.
97
+
```
98
+
99
+
To let the assistant create the Argos build review, add an explicit instruction. The CLI must be authenticated as an Argos user with `argos login`, or the assistant must pass a personal access token to `build review`:
100
+
101
+
```text
102
+
After summarizing the visual changes, create an Argos build review with the appropriate conclusion.
103
+
```
104
+
105
+
### Authentication details
106
+
107
+
Reading build data requires a project token. Creating a build review requires a user token because the review is attributed to an Argos user and checked against that user's project permissions.
108
+
109
+
For details about token precedence, `--token`, and personal access tokens, see [Argos CLI authentication](/argos-cli#authentication).
110
+
111
+
## Limits
112
+
113
+
Argos still performs deterministic visual comparison. AI agents use Argos build data as review evidence; they do not replace your team's ownership of review decisions.
Use the Argos CLI for seamless screenshot uploads to our visual testing platform, ideally integrated into your CI workflow.
12
+
Use the Argos CLI to upload screenshots, inspect builds, and create build reviews from scripts, local workflows, or AI agents.
12
13
13
14
You can access `@argos-ci/cli` through our [npm package](https://www.npmjs.com/package/@argos-ci/cli). The source code is available on our [GitHub repository](https://github.com/argos-ci/argos-javascript/tree/main/packages/cli).
Your configuration requirements may vary depending on the CI you use. Typically, you'll need to set ARGOS_TOKEN as a environment variable (ie. secret).
22
+
Your configuration requirements vary depending on the command you run.
23
+
24
+
For CI uploads, set `ARGOS_TOKEN` as an environment variable, usually as a CI secret.
22
25
23
26
:::note
24
27
25
28
You can also specify the token with the `--token=<your-repository-token>` argument. However, for security reasons, we recommend using an environment variable instead.
26
29
27
30
:::
28
31
32
+
For local review commands, sign in once with the browser-based login flow:
33
+
34
+
<RunPkgCommandcommand="argos login" />
35
+
36
+
`argos login` authorizes the CLI and stores a user token on your machine. This token is used by commands that need to act as a user, such as creating a build review.
37
+
38
+
:::warning
39
+
40
+
Do not use `argos login` in CI. CI uploads should use `ARGOS_TOKEN`, `--token`, or tokenless authentication when supported by your CI integration.
41
+
42
+
:::
43
+
29
44
## Upload Command
30
45
31
46
Use the `upload` command to upload screenshots stored in your `./screenshots` directory.
@@ -41,6 +56,83 @@ You can enable debug mode by setting the `DEBUG` environment variable.
41
56
envVariable="DEBUG=@argos-ci/core"
42
57
/>
43
58
59
+
## Build Commands
60
+
61
+
Use `build` commands to fetch build metadata, fetch snapshot diffs, and create a review on a build.
62
+
63
+
### Get build metadata
64
+
65
+
Use `build get` to fetch status, branch, commit, stats, and the build URL.
66
+
67
+
<RunPkgCommandcommand="argos build get <buildNumber>" />
68
+
69
+
You can also pass an Argos build URL directly:
70
+
71
+
<RunPkgCommandcommand="argos build get https://app.argos-ci.com/team/project/builds/72652" />
72
+
73
+
Use `--json` when another tool needs to parse the response:
74
+
75
+
<RunPkgCommandcommand="argos build get https://app.argos-ci.com/team/project/builds/72652 --json" />
76
+
77
+
### Fetch snapshot diffs
78
+
79
+
Use `build snapshots` to fetch snapshot diffs for a build.
Creating a build review requires a personal access token because the review is attributed to an Argos user and checked against that user's project permissions.
108
+
109
+
To create a personal access token manually, go to your personal account settings, open **Tokens**, then click **Generate new token**.
110
+
111
+
<img
112
+
src={personalSettingsTokensPage}
113
+
alt="Personal settings tokens page"
114
+
className="rounded border"
115
+
style={{ marginBottom: 20 }}
116
+
/>
117
+
_A personal settings tokens page_
118
+
119
+
For `build review`, authentication is resolved in this order:
120
+
121
+
1.`--token <token>`
122
+
2.`ARGOS_TOKEN`
123
+
3. token stored by `argos login`
124
+
125
+
Project tokens can inspect build data, but they cannot create reviews. If `ARGOS_TOKEN` contains a project token, use `argos login` locally or pass a personal access token with `--token`.
126
+
127
+
## AI Agent Skills
128
+
129
+
The [`argos-javascript`](https://github.com/argos-ci/argos-javascript) repository includes skills that help AI agents use Argos CLI commands and review pull requests with Argos build data:
130
+
131
+
-[`argos-cli`](https://github.com/argos-ci/argos-javascript/tree/main/skills/argos-cli): use Argos CLI commands, flags, authentication, and output formats.
132
+
-[`argos-pr-review`](https://github.com/argos-ci/argos-javascript/tree/main/skills/argos-pr-review): review a pull request with an Argos build as visual evidence.
133
+
134
+
See [Review builds with AI agents](/review-builds-with-ai-agents) to install and use the skills in a pull request review workflow.
135
+
44
136
## Help Command
45
137
46
138
To view a list of available options, use the argos help command.
0 commit comments