# Run and track PageSpeed tests with Hermes Agent

> Tracking PageSpeed scores with Hermes Agent means giving its cron a standing report: read the stored PageSpeed history for your sites through xSpeed Hub on a timer and say what moved.

Page: https://xspeedcache.com/agent/hermes-agent/pagespeed-tests/
Last updated: October 2026

Hermes Agent runs on a server and has cron, so it can do the check you only do when a client complains. Describe a standing job in plain words: on the first of the month, read get_score_history for each site, compare the latest mobile and desktop scores with the month before, and write up what changed, with the LCP and CLS numbers beside each score. The scheduler lives in the Hermes gateway process, so the gateway has to be running, and each run starts a fresh session. The Hub keeps no timer of its own for agent prompts.

The report is only as fresh as the history. get_score_history returns stored runs and starts nothing, and the Hub does not run PageSpeed tests on a schedule. The Hub pulls the plugin's stored PageSpeed and GTmetrix reports every day, so a month with no new stored report can look unchanged because nothing was measured. A run_speed_test that someone starts goes to the Hub's own report history, which get_score_history may not read. Ask the report to name the date of the newest run for each site, so a flat line is not mistaken for a stable one.

Add run_benchmark to the same job if you also want a response-time reading. It times the home page cached and uncached for every site in a workspace in one call and has no Lighthouse score, so keep it in its own section of the report.

## Set up Hermes Agent once

### 1. Put your sites in xSpeed Hub

Sign in at app.xspeedcache.com with Google or email; the Hub is free and has no site cap. Then connect each WordPress site from its own dashboard: click Connect Hub in the xSpeed Cache top bar, then Connect via xSpeed Hub. Each site needs the free xSpeed Cache plugin.

### 2. Add xSpeed Hub to config.yaml

Add this entry under mcp_servers. auth: oauth tells Hermes to handle discovery, dynamic client registration, PKCE and token refresh itself. If you edit the file from inside a running session, Hermes reloads its MCP connections with a 30 second timeout, which is too short for a browser sign-in, so finish the entry and then run the login in the next step.

File: `~/.hermes/config.yaml`

```yaml
mcp_servers:
  xspeedhub:
    url: "https://app.xspeedcache.com/xspeed/mcp"
    auth: oauth
```

### 3. Sign in with hermes mcp login

Run this once. Hermes prints an authorization URL, opens your browser where it can, and waits for the callback on a local loopback port. Sign in to xSpeed Hub and approve. There is no token to paste; Hermes caches the credentials it receives under ~/.hermes/mcp-tokens. On a remote host, paste the redirect URL back into the terminal when Hermes asks, or forward the callback port over SSH.

```bash
hermes mcp login xspeedhub
hermes mcp test xspeedhub
```

Full setup: https://xspeedcache.com/agent/hermes-agent/

### Before you send a prompt that changes something

Reads change nothing on your sites, though contact_support emails xSpeed support. Writes run once your connection allows them, so your client's approval prompt and a read-only connection (the token's Read-only everywhere switch, or a Viewer sign-in) are the gates that matter. A Hermes server entry has a trust setting. The default, full, adds no approval prompt for that server's tools, and the approvals setting covers dangerous shell commands, not MCP tools. Set trust: untrusted on the xspeedhub entry and Hermes asks before every call to a tool that lacks a readOnlyHint of true. The Hub does not mark its tools that way, so with untrusted every Hub call asks, reads included. To remove writes instead of prompting, set tools.include on the entry to the read tools; the filter takes globs and include wins over exclude. The Hub itself has no confirmation step.

## Prompts

- On the first of each month, use xSpeed Hub to read the PageSpeed history for every site, compare it with the month before and list the sites that got worse. Include the date of the newest run for each.
- Right now, ask xSpeed Hub for the stored scores on shop and blog and tell me which site has the older data.
- With xSpeed Hub, time every site cached and uncached and put it in a separate section from the PageSpeed scores.

## Example session

```
You: Use xSpeed Hub to run the monthly PageSpeed report. Read only, and show the date of each latest run.
  → list_sites [read-only]: 3 sites: shop, blog, docs
  → get_score_history(site: shop) [read-only]: latest mobile 59 (2 days ago), previous 56; desktop 83
  → get_score_history(site: blog) [read-only]: latest mobile 71 (23 days ago), previous 71; desktop 92
  → get_score_history(site: docs) [read-only]: latest mobile 64 (5 weeks ago), previous 66; desktop 88
  → run_benchmark(site: all) [read-only]: 3 sites timed; cached home page faster than uncached on each
Agent: Shop mobile is up three points, measured two days ago. Blog's newest run is 23 days old and docs' is five weeks old, so their flat or lower numbers may only mean nothing new was measured. Benchmarks ran on all three and are listed separately, as they are response times and not scores.
```

## How it works

1. **Read before you test**: get_score_history returns the stored PageSpeed Insights and GTmetrix runs for a site: the score per run, with LCP, FCP, CLS, TBT, Speed Index and TTFB, mobile and desktop. It starts nothing. The Hub tells the agent to use it whenever you ask what your score is, or whether it improved, because a new test spends a shared allowance.
2. **Run a new test when you need one**: run_speed_test runs a real PageSpeed Insights audit on the site from the Hub and returns the score, the Core Web Vitals and the top opportunities. strategy is mobile (the default) or desktop, and one call tests one of them. It can take up to about 2 minutes, so the agent should say it is running before it calls.
3. **Test the other device**: Mobile and desktop scores differ, often by a lot. For both, the agent makes two calls, one per strategy. A failure is reported with its reason: PageSpeed not configured, quota reached, a timeout, or a site the audit cannot reach.
4. **Measure the cache on its own**: run_benchmark times the home page with the cache bypassed and again served from cache, and returns the response times. It is a read tool, and it accepts site: "all" for every site. It does not return a Lighthouse score, so the agent must not use it to answer a PageSpeed question.
5. **Compare over time**: get_benchmark_history returns past benchmark runs, uncached against cached, together with the settings changes on the same timeline, which is how you answer "did that change help?". For PageSpeed scores over time, use get_score_history.

## Reference

| | |
| --- | --- |
| Read stored scores | get_score_history (read): PageSpeed Insights and GTmetrix runs, starts nothing |
| Metrics per run | Score, LCP, FCP, CLS, TBT, Speed Index, TTFB, for mobile and desktop |
| Run a new test | run_speed_test (write, uses the shared allowance): one PageSpeed Insights run per call |
| strategy | mobile (default) or desktop |
| Duration | Up to about 2 minutes per run |
| Why a test is a write | It spends a shared PageSpeed allowance and stores a report; it changes nothing on the site |
| Read-only access | A connection token with Read-only everywhere on, or a Viewer member's sign-in: run_speed_test is refused; get_score_history, run_benchmark and get_benchmark_history still work. An OAuth sign-in gets the scopes the client asks for |
| Benchmark | run_benchmark (read): cached against uncached response time for the home page, no Lighthouse score |
| Benchmark history | get_benchmark_history (read): past runs plus settings changes on the same timeline |
| Scheduling | The Hub does not schedule PageSpeed tests itself; its daily pass only reads reports the plugin already stored |
| Where a new test is stored | In the Hub's own report history, the one the Hub dashboard shows |

## Rules

- Check the history first. Ask for stored scores before starting a test, and run a new one only when you want a fresh measurement or something changed.
- Never answer a PageSpeed or Lighthouse question with run_benchmark. It times your own cache and carries no score.
- run_speed_test changes nothing on your site, but the Hub classes it a write because it spends a shared allowance. A connection token with Read-only everywhere on, or a Viewer sign-in, refuses it. An OAuth sign-in gets the scopes the client asks for, so there your client's approval prompt is the gate.
- Lab scores move a few points between runs of the same page. The agent should compare like with like, same site, same strategy, and not report one run's difference as a trend.
- A new test does not run on a timer. If you want a regular test, the agent has to be started by something else, such as a scheduled job in your client, and a scheduled run that spends the allowance should be one you are comfortable leaving unattended.

## Good to know with Hermes Agent

A cron job has nobody to say no, so make it incapable of starting a test rather than hoping it will not. Hermes adds no prompt for a server by default, and its approvals setting covers shell commands, not MCP tools. Setting trust to untrusted makes Hermes ask before every Hub call, reads included, because the Hub marks no tool read-only, and a scheduled run cannot answer. So connect the agent to the Hub read-only for scheduled work (the connection token with Read-only everywhere on, or a Viewer sign-in), or set tools.include on the entry to the read tools, and the job cannot start a test whatever the prompt says. If you want fresh data, run that test in a normal session with you present, since each test spends the shared speed-test allowance.

## More prompts for this job

They work in any client connected to xSpeed Hub.

- Using xSpeed Hub, what is the mobile PageSpeed score for shop? Check the stored history before you run anything.
- Use xSpeed Hub to run a new mobile PageSpeed test on blog and tell me the score, LCP and the top opportunities.
- With xSpeed Hub, test shop on desktop and mobile and tell me which one is worse.
- Using xSpeed Hub, has the PageSpeed score on docs improved over the last few runs?
- Use xSpeed Hub to benchmark the cache on every site and tell me which one saves the least time.
- Did turning on minification on shop help? Use xSpeed Hub to compare the benchmark history around that change.
- My PageSpeed test failed on staging. Use xSpeed Hub to tell me why.

## Frequently asked questions

### Can Hermes Agent run PageSpeed tests on a cron schedule?

It can call run_speed_test from a cron job, but the Hub does not schedule tests itself, and an unattended run spends the shared speed-test allowance with no one to approve it. A report-only job that reads get_score_history is the safer pattern, using a read-only connection (the connection token with Read-only everywhere on, or a Viewer sign-in).

### Why does my monthly report show no change?

Often because nothing new was measured. get_score_history returns stored runs, so with no new run the numbers repeat. Have the report print the date of each site's newest run, and start a run_speed_test yourself when a date is too old.

### What is the difference between run_speed_test and run_benchmark?

run_speed_test runs a real PageSpeed Insights audit and returns a Lighthouse score with Core Web Vitals. run_benchmark measures how fast your own cache answers compared with an uncached request for the home page, and returns no Lighthouse score. Use the first for "what is my PageSpeed score" and the second for "is my caching working".

### How long does a PageSpeed test take?

A single run can take up to about 2 minutes, so the agent should tell you it has started before it calls. One call tests one device, mobile or desktop, so checking both takes two calls.

### Can I ask for the last score without running a new test?

Yes. get_score_history reads the stored PageSpeed Insights and GTmetrix runs for the site and starts nothing. The Hub tells the agent to read it first whenever you ask what your score is, because a new test spends a shared allowance.

### Will the Hub run PageSpeed tests on a schedule?

No. The Hub does not schedule PageSpeed tests itself. Its daily pass re-verifies sites, snapshots cache status and pulls the PageSpeed and GTmetrix reports the plugin has already stored, and it can alert on a score regression. If you want regular new tests, they have to be started by a client that can run scheduled jobs.

### Why is a speed test treated as a write tool?

It does not change your site. The Hub classes run_speed_test as a write because it spends a shared PageSpeed allowance and stores a report, and a read-only connection (the connection token with Read-only everywhere on, or a Viewer sign-in) should not be able to cost the owner anything. Such a connection can still read stored scores with get_score_history.

## Track PageSpeed scores with other agents

[Claude Code](https://xspeedcache.com/agent/claude-code/pagespeed-tests/) · [Claude](https://xspeedcache.com/agent/claude/pagespeed-tests/) · [Claude Cowork](https://xspeedcache.com/agent/claude-cowork/pagespeed-tests/) · [ChatGPT](https://xspeedcache.com/agent/chatgpt/pagespeed-tests/) · [Codex](https://xspeedcache.com/agent/codex/pagespeed-tests/) · [Cursor](https://xspeedcache.com/agent/cursor/pagespeed-tests/) · [GitHub Copilot in VS Code](https://xspeedcache.com/agent/github-copilot/pagespeed-tests/) · [Windsurf](https://xspeedcache.com/agent/windsurf/pagespeed-tests/) · [Gemini CLI](https://xspeedcache.com/agent/gemini-cli/pagespeed-tests/) · [Antigravity](https://xspeedcache.com/agent/antigravity/pagespeed-tests/) · [Zed](https://xspeedcache.com/agent/zed/pagespeed-tests/) · [Kiro](https://xspeedcache.com/agent/kiro/pagespeed-tests/) · [OpenCode](https://xspeedcache.com/agent/opencode/pagespeed-tests/) · [OpenClaw](https://xspeedcache.com/agent/openclaw/pagespeed-tests/) · [Grok Build](https://xspeedcache.com/agent/grok-build/pagespeed-tests/) · [ChatGPT dots](https://xspeedcache.com/agent/chatgpt-dots/pagespeed-tests/) · [Grok](https://xspeedcache.com/agent/grok/pagespeed-tests/) · [Grok Bot](https://xspeedcache.com/agent/grok-bot/pagespeed-tests/) · [Muse](https://xspeedcache.com/agent/muse/pagespeed-tests/) · [Manus](https://xspeedcache.com/agent/manus/pagespeed-tests/) · [Kimi Code](https://xspeedcache.com/agent/kimi/pagespeed-tests/) · [Paperclip](https://xspeedcache.com/agent/paperclip/pagespeed-tests/) · [NanoClaw](https://xspeedcache.com/agent/nanoclaw/pagespeed-tests/)

## More with Hermes Agent

- [Purge the WordPress cache with Hermes Agent](https://xspeedcache.com/agent/hermes-agent/purge-cache/)
- [Find out why WordPress pages are not cached with Hermes Agent](https://xspeedcache.com/agent/hermes-agent/troubleshoot-cache/)
- [Scan a website for speed problems with Hermes Agent](https://xspeedcache.com/agent/hermes-agent/speed-scan/)
- [Raise a WordPress site's PageSpeed score with Hermes Agent](https://xspeedcache.com/agent/hermes-agent/optimize-site/)
- [Tune WordPress cache settings with Hermes Agent](https://xspeedcache.com/agent/hermes-agent/cache-settings/)
- [Warm the WordPress cache with Hermes Agent](https://xspeedcache.com/agent/hermes-agent/preload-cache/)
- [Set up the Redis object cache with Hermes Agent](https://xspeedcache.com/agent/hermes-agent/object-cache/)
- [Manage Cloudflare caching with Hermes Agent](https://xspeedcache.com/agent/hermes-agent/cloudflare/)
- [Manage every WordPress site at once with Hermes Agent](https://xspeedcache.com/agent/hermes-agent/fleet/)

## Documentation

- How to run a speed test: https://xspeedcache.com/docs/external-score/
- PageSpeed Insights integration: https://xspeedcache.com/docs/pagespeed-insights-integration/
- Running speed tests in xSpeed Hub: https://xspeedcache.com/docs/hub-speed-tests-and-notifications/
- How to run a PageSpeed audit: https://xspeedcache.com/docs/pagespeed/
