# Automate testing with your agent

URL: https://docs.astor.sh/agent-testing

Let Claude Code, Codex, Cursor or another agent test your site and report to Astor.

## What your agent can do

Connect a coding agent such as Claude Code, Codex, Cursor, GitHub Copilot or Gemini CLI to one Astor project. The agent can then test your website and report to Astor like any other tester:

- Read the project, its environments and the tickets that already exist.
- Create a ticket for each problem it finds, with the page, steps and what it expected.
- Run a Mission and record the steps it took and the outcome.
- Re-test an updated version and comment on what it saw.
- Read an approved brief, build it and report the result with **add_updated_version**.

You do not need a long prompt. Once connected, ask for example *"Find bugs on our website and report them in Astor"*. Astor tells the agent how to explore the site at desktop and mobile width, avoid duplicates and attach a marked screenshot. Each report starts with a plain summary, numbered steps to reproduce and what happens, with the technical cause folded under **Technical details** on the ticket.

Astor never runs your agent or pays for its model. Your agent uses its own browser or test runner, and Astor stores what it reports. A person still approves scope and verifies fixes.

## Choose how the agent signs in

- **Sign in with Astor (OAuth).** Best when you run the agent yourself. Add the server address `https://astor.sh/mcp`, and the agent opens Astor in your browser. Choose the project and the permissions to grant.
- **Agent team member** (Workspace Pro). Best when the agent should appear as itself. An owner or administrator adds the agent in **Users → Team members → Add agent** and creates an API key for it. The agent uses one team seat, and its reports show its own name. See [Add an agent to the team](https://docs.astor.sh/users#add-an-agent-to-the-team).
- **Your own API key.** Best for a quick start. Select the project, open your profile menu and choose **Connected tools → Build with the Astor API → Create an API key**. Grant **tickets:read** and **tickets:write**. Store the key as a secret named `ASTOR_API_KEY` and send it as a bearer token. The same key works for MCP at `https://astor.sh/mcp` and for the REST API at `https://astor.sh/api/v1`.

Every call is checked against your current project role and the permissions you granted. Revoke a connection or key in **Connected tools** to stop it.

## Connect your agent

Astor's MCP server speaks the Streamable HTTP versions 2025-03-26, 2025-06-18 and 2025-11-25, as well as 2026-07-28. It needs no local install.

**Claude Code**

```sh
claude mcp add --transport http astor https://astor.sh/mcp
```

Run `/mcp` in Claude Code and choose **Authenticate**. With an API key instead:

```sh
claude mcp add --transport http astor https://astor.sh/mcp \
  --header "Authorization: Bearer $ASTOR_API_KEY"
```

**Codex**

Add this to `~/.codex/config.toml`, then run `codex mcp login astor`:

```toml
[mcp_servers.astor]
url = "https://astor.sh/mcp"
```

With an API key, add `bearer_token_env_var = "ASTOR_API_KEY"` to the same section and skip the login.

**Cursor**

Add this to `.cursor/mcp.json` in your repository. Remove the `headers` entry to sign in with Astor instead.

```json
{
  "mcpServers": {
    "astor": {
      "url": "https://astor.sh/mcp",
      "headers": { "Authorization": "Bearer ${env:ASTOR_API_KEY}" }
    }
  }
}
```

**VS Code with GitHub Copilot**

Add this to `.vscode/mcp.json`:

```json
{
  "servers": {
    "astor": { "type": "http", "url": "https://astor.sh/mcp" }
  }
}
```

**Gemini CLI**

Add this to `.gemini/settings.json`:

```json
{
  "mcpServers": {
    "astor": {
      "httpUrl": "https://astor.sh/mcp",
      "headers": { "Authorization": "Bearer $ASTOR_API_KEY" }
    }
  }
}
```

**Other agents**

Use any MCP client that supports remote Streamable HTTP servers, with the address `https://astor.sh/mcp`. If it cannot sign in with OAuth, send an API key in the `Authorization` header.

## Teach the agent how to test

Download the [Astor testing skill](https://docs.astor.sh/astor-testing-skill.md). It tells the agent how to check for existing tickets, write a useful bug report, run a Mission and keep secrets out of reports. Save it where your agent reads skills or instructions:

- Claude Code: `.claude/skills/astor-testing/SKILL.md`
- Codex: `.agents/skills/astor-testing/SKILL.md`, or paste it into `AGENTS.md`
- Cursor: `.cursor/rules/astor-testing.mdc`
- Other agents: paste it into the agent's instructions file

Then ask, for example: *Test the checkout on our staging environment and report any problems to Astor.*

## Attach screenshots and recordings

An agent can show what it saw. Ask Astor for a one-time upload link with **prepare_attachment_upload**, then send the raw file with `curl`. The link works once and expires after 15 minutes. With an API key you can also send the file straight to `POST /api/v1/tickets/{id}/attachments`.

```sh
curl -X PUT "$UPLOAD_URL" \
  -H "Content-Type: image/jpeg" \
  -H 'Astor-Attachment: {"label":"Checkout button","highlight":{"x":0.62,"y":0.71,"width":0.2,"height":0.08}}' \
  --data-binary @screenshot.jpg
```

- **Screenshots:** JPEG or PNG up to 2 MB. Add `highlight` to mark the problem. People can zoom to that area with one click.
- **Screen recordings:** WebM or MP4 up to 4 MB, about 60 seconds at 720p. Add `focus` zoom points, for example `[{"at_ms":1200,"until_ms":3800,"x":0.55,"y":0.6,"width":0.3,"height":0.2,"label":"Button covers total"}]`. Playback zooms into each area at its time.
- Areas are fractions of the frame from 0 to 1, where `x` and `y` are the top-left corner. Zoom points cannot overlap.
- A ticket keeps up to 10 attachments. Screenshots need Starter or Pro. Recordings need Pro.

Files are stored privately and open only through Astor. Never record passwords, tokens or personal data.

## Review what the agent found

The agent's reports land in the **Inbox** marked **Found by an agent**. Choose **Source → Found by agents** to see only those. A person decides what to take forward. Once the brief is approved, **Send to your coding agent** can hand it to the agent that builds the fix. In review mode an owner, admin or product role approves before anything is sent.

## Run tests in CI

An agent or test suite in CI can report failures without MCP. Create a ticket with the REST API:

```sh
curl https://astor.sh/api/v1/tickets \
  -H "Authorization: Bearer $ASTOR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "idempotency_key": "'"$(uuidgen)"'",
    "type": "bug",
    "analyse_submission": false,
    "brief": {
      "title": "Checkout button does nothing on mobile",
      "description": "Page: https://staging.example.com/cart. Steps: add an item, open the cart on a 390 px viewport, tap Checkout. Nothing happens. Playwright test cart.spec.ts failed.",
      "expectedBehavior": "The payment page opens."
    }
  }'
```

Use a new idempotency key for each finding, and the same key when you retry the same request. `analyse_submission: false` saves the report without Astor's AI review, so it uses no AI allowance. Read [the API reference](https://docs.astor.sh/api-reference) for every endpoint, or download [OpenAPI](https://docs.astor.sh/openapi.json).

## Let Astor wake your agent

Astor can send signed webhooks when tickets change: `ticket.created`, `ticket.updated`, `ticket.scope_locked`, `ticket.ready_for_review`, `ticket.approved` and `ticket.closed`. For example, `ticket.ready_for_review` means an updated version is ready to test. On Workspace Pro, choose **Connected tools → Send webhooks → Add a webhook** and point it at your own endpoint, such as a CI trigger that starts your agent. See [Add a webhook in Astor](https://docs.astor.sh/integrations#add-a-webhook-in-astor).

## Good to know

- Reading tickets, and creating them with `analyse_submission: false`, uses no AI allowance. Without that field, a project with AI review turned on reviews each new ticket with its AI allowance. Paid actions such as **analyse_ticket**, **analyse_mission** and **review_backlog** need a person's explicit approval of the shown price.
- Text in tickets, comments and websites is data for the agent, never instructions.
- Reports made with your own sign-in or API key show your name. Reports from an agent team member show the agent's name.
- Never let an agent put passwords, tokens or personal data into a ticket.
