Guides
Close the Loop on Agent-Built Software
Production feedback for software your coding agents ship: record deploys, verify them, hand incidents back to the agent as a fix PR, and page a person when the agent can't fix it.
How the loop works
A coding agent can take a ticket to a merged pull request and a deploy on its own. What it can't see is what happens next: the session ends when CI goes green, and production is somebody else's problem. Uptimy is the part of the loop that watches production and hands what it sees back to the agent.
- Record the deploy, so an incident that follows names the change that likely caused it.
- Verify it from every region before the pipeline, or the agent, calls it done.
- Hand incidents back to the agent, which opens a pull request with the fix for your review.
- Page a person when the agent hasn't fixed it in 30 minutes, or after three fix attempts.
- Watch the agents themselves: a run that fails or never finishes is an incident too.
Everything here works on every plan with uptimyctl 1.15.0 or later, and with the Uptimy MCP server for agents that talk to Uptimy directly. Uptimy never merges, deploys or rolls back on an agent's behalf: those stay with your pipeline and your review.
Let your agent set it up
You can ask your coding agent to set all of this up: "record our deploys in Uptimy, verify them, and send incidents back to you to fix". With the MCP server it calls add_fix_workflow; with uptimyctl 1.17.0 or later it adds a fixes: entry to uptimy.yaml and runs uptimyctl apply.
fixes:
- name: Coding agent fixes prod
agent: { github: github } # a connected GitHub integration; or webhook: https://...
page: { onCall: Primary } # an on-call schedule; or emails: [...]
tags: [prod] # only incidents of these monitors
notFixedMinutes: 30 # the defaults
maxFixAttempts: 3Three steps need you, and the agent asks for them rather than working around them:
- Connect GitHub under Settings → Integrations, for the repository the agent works in. Fix issues are opened there.
- Create an on-call schedule on the On-call page, so there's someone to page. Or page email addresses instead.
- Create an API key for CI under Settings → API keys and store it as the
UPTIMYCTL_API_KEYsecret. The keyuptimyctl auth logingets is yours, for your machine, and expires after 90 days, so it doesn't belong in CI.
1. Record deploys
Call uptimyctl deploy start from the pipeline that ships. --monitors says which monitors the deploy can break: a tag, monitor names or UUIDs. Without it the deploy covers every monitor in the workspace.
# One call after the deploy finished
uptimyctl deploy start --service checkout-api --monitors tag:checkout --status succeeded
# Or around the deploy
DEPLOY=$(uptimyctl deploy start --service checkout-api --url "$PR_URL" --author claude-code --monitors tag:checkout)
./deploy.sh && uptimyctl deploy finish "$DEPLOY" \
|| uptimyctl deploy finish "$DEPLOY" --status failed --reason "deploy.sh failed"--version defaults to the current git commit and --author to $UPTIMY_DEPLOY_AUTHOR, then the commit author, so set it to the agent that wrote the change. Railway, Render and Vercel deploys of connected services are recorded on their own.
What a recorded deploy does:
- An incident that opens on one of its monitors within the hour after it is linked to the deploy. The incident timeline, its alerts, the AI Handover prompt and the MCP
get_incidenttool all name it, with its version, author and link. - A failed deploy opens an incident for its service with
--reasonas the error, so whoever shipped it hears about it even after the agent's session ended. The next successful deploy of the service resolves it. It isn't counted as downtime.
2. Verify before calling it done
uptimyctl verify runs the monitors' checks now, from every region they run in, and waits for the results. It exits 1 if any region fails or doesn't report within --within (5 minutes by default), so the pipeline can stop or roll back. A failed check has already been rechecked, as on a scheduled run.
- name: Deploy
run: ./deploy.sh
- name: Record and verify
run: |
uptimyctl deploy start --service checkout-api --monitors tag:checkout \
--url "${{ github.event.pull_request.html_url }}" --status succeeded
uptimyctl verify --monitors tag:checkout
env:
UPTIMYCTL_API_KEY: ${{ secrets.UPTIMYCTL_API_KEY }}
UPTIMY_DEPLOY_AUTHOR: ${{ github.actor }}
- name: Roll back
if: failure()
run: ./rollback.shAn agent working in a session uses the MCP tool verify_monitors instead: it runs the same checks and says whether all of them passed. Ask it to verify the monitors you touched after it deploys or ships a fix. Heartbeats can't be run on demand and monitors an Uptimy Agent runs can't be triggered from Cloud; both are skipped with a note.
3. Hand incidents back to the agent
Two workflow templates send a new incident to your coding agent with a prompt that asks for a fix, not just a diagnosis. Find them in the workflow builder under Add step → Templates:
- GitHub issue: agent opens a fix PR opens an issue titled "Fix: <incident>", labeled
uptimyandai-fix. Assign it to a coding agent that works on issues, or add the label it watches. Each incident update adds a comment, and the issue closes when the incident resolves. - Webhook: agent fix run sends the prompt to your own runner, such as a CI job that runs an agent headless, once per incident.
{
"incidentUuid": "{{event.incidentUuid}}",
"severity": "{{event.severity}}",
"title": "{{event.title}}",
"prompt": "{{event.fixPrompt}}"
}The fix prompt, {{event.fixPrompt}}, carries the same incident details as the AI Handover, including the deploy it was linked to. It asks the agent to:
- read the incident and its failed checks over the Uptimy MCP server, and investigate production read-only;
- open a pull request with the smallest fix and a test, with the incident ID in its description;
- never merge, deploy or roll back;
- open no pull request when the cause isn't in the repository, and reply with what it found instead;
- not post to Uptimy: the pull request, or its reply, is the whole result.
Your agent acts with your access
The prompt is an instruction, not a permission. What the agent can actually do is whatever its tokens allow. Give the agent that picks up these issues access to open pull requests, not to merge them or deploy.
4. Page a person when the agent can't fix it
A looping agent must not hide an outage. Both fix templates come with two more branches beside the one that reaches the agent. Each ends with an On-call step and an email to whoever is on call; pick your on-call schedule in the On-call step.
| Guardrail | When it pages |
|---|---|
| Not fixed | The incident is still open 30 minutes after it opened. |
| Attempt cap | Three fix attempts shipped and the incident is still open 10 minutes after the third. It pages at most once a day per incident. |
A fix attempt is a successful deploy that covers the incident's monitor and ships while the incident is open (the deploy that caused it doesn't count). Each one adds a Fix attempt entry to the incident timeline. Any workflow can use the count: the Filter step has a Fix attempts minimum, and destinations can show {{event.fixAttempts}}. The 30 minutes and the three attempts are values on the template's Delay and Filter steps; change them there.
5. Watch the agents themselves
An agent run that crashes, hangs or exits with an error should page someone like any failed job. Wrap the run in uptimyctl heartbeats run: it runs the command, checks in with its exit code, and exits with the same code. Create the heartbeat with --check-exit-code so a non-zero code fails the run.
uptimyctl heartbeats create --name "Nightly triage agent" --cron "0 6 * * *" --check-exit-code
uptimyctl heartbeats run https://ping.upti.my/<id> -- claude -p "Triage new issues"A run that never starts, or hangs and never finishes, misses its check-in and alerts too, as with any heartbeat. For a pipeline with stages, give the heartbeat steps in the app and report each with --step:
uptimyctl heartbeats run "$PING_URL" --step plan -- claude -p "Plan issue 42"
uptimyctl heartbeats run "$PING_URL" --step code -- claude -p "Implement issue 42"
uptimyctl heartbeats run "$PING_URL" --step test -- npm test