# Fail a build when AI agents can no longer read your site

> To run Surfacedd in CI, add surfacedd agent-readiness check <url> --fail-under N after your deploy step. It crawls up to 50 pages, scores Reach, Understand and Act, and exits 5 under N. With a URL it needs no database, licence or keys. Today the runner must be a Mac or Windows machine with Surfacedd installed.

Source: https://surfacedd.com/docs/cli/ci · Updated 2026-11-19

This is the reference recipe. For why and when to run it, how to choose a threshold, and what usually breaks agent access between releases, read the guide [Run an agent readiness check in CI](/guides/agent-readiness-in-ci). 

## What the step does

`surfacedd agent-readiness check <url>` crawls the site now (50 pages by default, robots.txt respected) and runs the same [agent readiness](/features/agent-readiness) rules as a Surfacedd site audit. It scores Reach, Understand and Act from 0 to 100 and prints the failing rules with their evidence and fixes. With a URL it needs no database, licence or API keys, makes no AI calls, costs nothing and stores nothing. 

| Option | Default | Effect |
|---|---|---|
| `--fail-under 0-100` | none | Exit 5 when the overall score is under the number, or when there is no score |
| `--max-pages 1-500` | 50 | Pages to crawl |
| `--json` | on in CI | The [JSON document](/docs/cli/json-output), with `data.passed`, `data.fail_under`, `data.scores` and `data.problems[].fix` |

It refuses private and local addresses, so it can't check a dev server on `localhost`. Point it at a preview deployment or production. 

## Which runner to use

For the agent-readiness check, use the free [standalone checker](/tools/agent-readiness-cli), `surfacedd-check`. It runs on hosted runners such as `ubuntu-latest`, `macos-latest` and `windows-latest`, needs no licence or app, and gives the same scores and exit codes as `surfacedd agent-readiness check`. On GitHub, the `surfacedd/agent-readiness-action@v1` action installs it, writes a job summary and fails the job under your threshold. Both ship with the first release. 

The recipe below uses the full `surfacedd` command, which ships inside the desktop app. Use it on a **self-hosted runner**, a Mac or Windows machine with Surfacedd installed and the command added from Settings › AI assistants & CLI › Install command-line tool, when you also want other commands in the same job. The URL form of the check needs no licence on that machine. 

## GitHub Actions

```yaml
name: Agent readiness
on: [pull_request]
jobs:
  agent-readiness:
    runs-on: [self-hosted, macOS]
    steps:
      - name: Check the preview site for AI agents
        run: surfacedd agent-readiness check "$PREVIEW_URL" --fail-under 70 --max-pages 50 --json > agent-readiness.json
        env:
          PREVIEW_URL: https://staging.example.com
      - if: always()
        uses: actions/upload-artifact@v7
        with:
          name: agent-readiness
          path: agent-readiness.json
```

This is the recipe from the CLI's own notes, with the runner set to a self-hosted Mac and the current major version of upload-artifact. If your preview URL comes from a deploy job, add `needs: deploy` and read the URL from that job's outputs. `if: always()` keeps the report when the check fails, which is when you need it. 

## GitLab CI

```yaml
agent-readiness:
  stage: test
  needs: [deploy]
  tags: [macos]
  script:
    - surfacedd agent-readiness check "$SITE_URL" --fail-under 70 --json > agent-readiness.json
  artifacts:
    when: always
    paths: [agent-readiness.json]
```

Use your own runner's tag in `tags`.

## Reading a failure

A failing job prints the scores and the rules behind them, then the verdict. This run was against a small local test site, using a development-only allowance for local addresses:

```console
$ surfacedd agent-readiness check http://127.0.0.1:8765/ --max-pages 5 --fail-under 80
Checking http://127.0.0.1:8765/ for AI agents (up to 5 pages, robots.txt respected, nothing stored).
Checking agent access…
http://127.0.0.1:8765/ · checked 2026-11-19 09:53 · 2 pages

Overall     72/100
Reach       94/100
Understand  50/100
Act         not scored (no rule applies)

WEIGHT  AREA        RULE                            FINDING
     2  understand  understand.organization-schema  The home page has no Organization markup.
     2  understand  understand.landmarks            1 of 2 pages lack a main or navigation landmark.
     1  reach       reach.sitemap                   No sitemap found in robots.txt or at /sitemap.xml.
7 informational findings on emerging agent protocols are never scored (see --json).

Failed (overall 72 against --fail-under 80)
surfacedd: Agent readiness 72/100 is under --fail-under 80.
```

That exits with code 5. Code 1 means the check itself didn't run, for example because the URL didn't load; don't count it as a score. See [exit codes](/docs/cli/exit-codes). 

Informational findings cover emerging agent protocols. They are shown but never scored, so they can't fail a build. 

## Let Claude Code write it

With the [Surfacedd plugin for Claude Code](/integrations/claude-code), ask "add an agent readiness check to our deploy workflow". The `ci-agent-readiness` skill finds your pipeline, runs the check once to suggest a threshold, and proposes the change as a diff for you to approve. 

## Sources

- [Apply labels to self-hosted runners, GitHub Docs](https://docs.github.com/en/actions/how-tos/manage-runners/self-hosted-runners/apply-labels), checked 2026-11-19
- [actions/upload-artifact, GitHub](https://github.com/actions/upload-artifact), checked 2026-11-19
- [GitLab CI/CD job artifacts, GitLab Docs](https://docs.gitlab.com/ci/jobs/job_artifacts/), checked 2026-11-19
