AI SRE Agent
The Traceway AI SRE agent (opens in a new tab) answers production errors with pull requests. It runs on your own machine or a server you control, watches Traceway, and when a new error is reported it starts Claude Code or Codex in a fresh git worktree of your code. The coding tool finds the root cause with the traceway CLI, proves a fix with your tests, and the agent opens a draft pull request that explains what happened. When the cause is not in the code, such as infrastructure or a dependency, it opens a GitHub issue instead. If the error paged someone, the agent acknowledges the page once the pull request is open; when it cannot fix the error, the page keeps escalating to people.
The agent never merges anything. Pull requests open as drafts, so a person still decides what ships.
| AI SRE agent | Auto-Fix | |
|---|---|---|
| Where it runs | Your machine or server, as a background service | Your repository's GitHub Actions |
| How it learns about an error | Polls Traceway every 30 seconds | Traceway opens a GitHub issue, which starts a workflow |
| Coding tool | Claude Code or Codex, already logged in on the machine | Claude Code with an API key in CI, or your own agent |
| On-call pages | Can acknowledge them | Not involved |
This page covers what the agent reacts to, what Traceway needs for it to get work, and how to tell why it is idle. Every config option is in the agent's README (opens in a new tab) and its config.example.yaml (opens in a new tab).
What the agent reacts to
The agent reads two sources, both on by default:
| Source | What it reads | What Traceway needs |
|---|---|---|
pages | Open on-call pages. The only kind the agent can acknowledge. | An alert rule that sends to an escalation policy channel, with a policy and a schedule behind it. Without one, Traceway never opens a page. |
alert_history | Notifications that alert rules already sent to an ordinary channel: email, Slack, Telegram, a webhook and so on. | Only the alert rules. Needs traceway CLI 2.0.11 or newer. |
Most teams start with rules that send email or Slack and have no on-call schedule. For them alert_history is the source that matters. With sources: [pages] and no escalation channel the agent polls forever and never gets work.
By default the agent only reacts to two rule types: new_error (New Issue) and error_regression (Error Regression). Both point at one issue with a stack trace, which the agent can fix in code. Latency, Apdex, metric and other alerts are ignored, because otherwise every one of those notifications would start a job. The filter applies to both sources:
traceway:
sources: [pages, alert_history] # the default
rule_types: [new_error, error_regression] # the default; [] reacts to every rule typeAdd rule types such as endpoint_p95_threshold, apdex_drop or metric_threshold to have the agent investigate those alerts too.
alert_history looks back 60 minutes on every poll (alert_history_lookback_minutes). An alert sent while the agent was stopped for longer than that is not picked up. Run it by hand instead.
What Traceway needs
- An error rule in every project the agent watches. Create a New Issue rule, and an Error Regression rule if you archive fixed issues, as in Alerts, Step 2. Any channel works. A rule that already emails your team is enough.
- For pages, an escalation channel. Follow On-Call through Step 4. To have the agent take only the pages meant for it, put a member for the agent on the schedule and set
only_paged_userin its config. - For acknowledging pages, Agent Access. An organization admin turns on Settings > Agent Access > Allow agent writes. See Agent Write Access. Without it the agent still opens pull requests, but pages keep escalating.
Set it up
Install
curl -fsSL https://raw.githubusercontent.com/tracewayapp/traceway-ai-sre-agent/main/scripts/install.sh | shThis puts traceway-sre-agent in ~/.local/bin. It runs on Linux and macOS as your own user. The machine also needs git with push access to your repositories, gh logged in, and claude or codex logged in.
Log in the Traceway CLIs
The agent reads Traceway through the traceway CLI and acknowledges pages through traceway-write. Install both:
curl -fsSL https://cli.tracewayapp.com/install.sh | sh
curl -fsSL https://cli.tracewayapp.com/install.sh | sh -s -- --writeLog traceway in with a read-only personal access token, in a profile of its own. Pick No expiration or note the expiry date:
traceway login --url https://cloud.tracewayapp.com --profile sre --token-stdinPrefer a token for the agent over a browser login. A browser login renews itself every 15 minutes with a refresh token that works once. If the CLI cannot save the renewed login, for example because the disk is full, it presents the old refresh token on the next poll, the server ends the session, and the agent stops reading Traceway until someone logs in again. A token has nothing to renew.
Log traceway-write in only if the agent should acknowledge pages. A write token must expire within 90 days, so a browser login is the practical choice here:
traceway-write login --url https://cloud.tracewayapp.com --profile sreConfigure
Create the config from the example and fill in your projects:
mkdir -p ~/.config/traceway-sre-agent
curl -fsSL https://raw.githubusercontent.com/tracewayapp/traceway-ai-sre-agent/main/config.example.yaml \
-o ~/.config/traceway-sre-agent/config.yamlA complete config:
agent:
tool: claude-code # or codex
model: opus
effort: high
traceway:
server_url: https://cloud.tracewayapp.com
profile: sre # the profile you logged `traceway` in with
write_profile: sre # the profile you logged `traceway-write` in with
projects:
- traceway_project: My Backend # project name or id in Traceway
repos:
- path: ~/code/my-backend # local checkout of its code
allowed_commands: ["go test ./..."] # what the agent may run to prove a fixtraceway-sre-agent config shows which config file is in use and ends with It loads without errors. when it is valid.
Check and start it
traceway-sre-agent --check # every tool, login, project and repository
traceway-sre-agent service install # run in the background, start at login--check prints a line per dependency and the command that fixes each failure. On Linux, run loginctl enable-linger $USER once to keep the service running while you are logged out.
Check that it works
The service log is ~/.local/state/traceway-sre-agent/logs/service.log. Its first lines name the sources in use:
INFO polling every 30s, https://cloud.tracewayapp.com: My Backend -> 1 repo(s) tool="Claude Code" model="opus" effort="high" sources=[Pages, AlertHistory]To see what the agent would do with the notifications pending right now, without running the coding tool, pushing or opening anything:
traceway-sre-agent --once --dry-runRun one job by hand
trigger runs the whole pipeline for one issue without waiting for an alert. Use it for an issue that fired before the agent was running:
traceway-sre-agent trigger --project "My Backend" --issue 927eb0316311e138The issue hash is the 16 characters after /issues/ in the issue's URL.
When the agent does nothing
Work through these in order:
- The log says
sources=[Pages]. The config pins the agent to on-call pages. Unless a rule in the project sends to an escalation channel, addalert_historytosourcesand restart the service. - The alert's rule type is filtered out. Only
new_erroranderror_regressionare handled by default. Compare the rule type in the project's notification history withrule_types. - The notification is older than the lookback.
alert_historyonly sees the last 60 minutes. Usetrigger. - The log says
could not poll the ... source. The agent logs a failing source once and stays quiet until it recovers, when it logsthe ... source recovered. The usual cause is a login that ended. Runtraceway --profile sre projects listto see the error, log in again, and the agent recovers on its next poll without a restart. - The agent has nothing in its state.
~/.local/state/traceway-sre-agent/state.jsonlists every notification the agent handled. An emptyhandledmeans it never picked one up.
A failing source is easy to miss, because the agent keeps running. Give the agent a project of its own in Traceway, set its telemetry section so its failures arrive there as issues, and add a New Issue rule to that project that notifies you.