AI Agent Debugging in Production: Logs, Traces and Session Replay over MCP
Datadog, PagerDuty, Honeycomb and Sentry all shipped AI SRE agents in the last three weeks. The model is rarely the weak point. The evidence is. Here is how to give any agent the full picture, from the user's click to the commit that broke it.
Dmytro Vavreniuk
Product Engineer
Short version: AI debugging in production works when the agent can reach four kinds of evidence and join them by ID: what the user saw (session replay), what the browser did (DevTools), what the backend did (logs and traces) and what changed (deploys and commits). Connect each one as a read-only MCP server, carry session.id and trace_id on every request, and put a short runbook in your repo that makes the agent investigate first, cite an ID for every claim and wait for approval before it changes code.
"AI SRE" went from a startup category to a feature of every observability platform this autumn. Within one week in early November, PagerDuty launched Paige, an SRE agent that investigates and can remediate incidents, Honeycomb announced Team Agents that work between incidents, and Sentry connected Seer Agent to Grafana. A week earlier Datadog described Scout, a model trained specifically for incident investigation. On the developer side, Chrome DevTools MCP passed 56,000 GitHub stars, which says a lot about how many people now let a coding agent drive a browser while it debugs.
The pattern behind all of them is the same: an agent with tool access to telemetry, asked to explain a failure. You do not need a new platform to use it. Any agent that speaks MCP (Cursor, Claude Code, OpenCode, a JetBrains ACP agent) can do this today. What decides whether it finds the root cause or writes a confident wrong story is what data it can reach.
The AI SRE wave, October to November 2026
| Date | Who | What shipped |
|---|---|---|
| Oct 29, 2026 | Datadog | Scout, a model post-trained for incident investigation inside Bits AI SRE (closed preview). Pitch: cheap enough to run on every alert. |
| Nov 3, 2026 | PagerDuty | Paige, an SRE agent that detects, investigates and remediates, with a human in the loop or autonomously for well-understood cases. |
| Nov 3, 2026 | Honeycomb | Personal and Team Agents with four autonomy levels; Team Agents GA on December 1. MCP connectors pull in deploys, docs and cost data. |
| Nov 5, 2026 | Sentry | Seer Agent can now read Grafana telemetry next to Sentry errors, traces and logs. |
| Nov 2026 | Chrome DevTools MCP | Over 56,000 GitHub stars: coding agents get performance traces, network requests and console output from a real Chrome. |
Two details are worth noticing. First, most of these agents still diagnose and propose rather than fix: Datadog says Scout suggests recovery actions while an engineer makes the change, and Honeycomb ties every action to an autonomy level the team grants. Second, the vendors themselves stress grounding. Honeycomb labels every number as measured, derived or estimated, and links each finding to its source query. That is the right instinct, and you should demand the same from your own setup.
Why AI agents get production debugging wrong
Bronto's review of 64 AI SRE tools comes to a blunt conclusion: every one of them will be confidently wrong about something. The failure causes it lists are about data, not models: sampled traces, short retention, slow search, stale service maps and blind spots outside the platform the agent lives in. We see the same three gaps again and again:
- No user-side evidence. The backend shows a 422. It does not show that the user had a saved card from 2024, used Safari and clicked "Pay" twice. Frontend crashes that never produce a request are invisible to backend telemetry.
- No join key. Without
trace_idandsession.idon requests and log lines, the agent matches events by timestamp and guesses. Guessing at scale is how plausible but wrong stories are made. - No view of change. Most incidents follow a deploy or a flag flip. An agent that cannot see the diff will explain the symptom very well and miss the cause.
The four evidence layers an AI debugging agent needs
Think of production debugging as four questions. Each one maps to a data source and, today, to an MCP server the agent can call:
| Layer | Data | MCP server | Question it answers |
|---|---|---|---|
| What the user saw | Session replay: clicks, DOM, errors, network calls per session | LogNroll MCP (search_sessions, get_session_errors, get_session_network) | Which users hit it, on which page, after which action? |
| What the browser did | Console, network waterfall, performance trace | Chrome DevTools MCP (reproduce locally or on staging) | Can I reproduce it, and what exactly does the request look like? |
| What the backend did | Traces, structured logs, error groups | Sentry MCP, Grafana MCP (Loki, Tempo), Honeycomb MCP, Datadog | Which service failed, with which error, for this trace_id? |
| What changed | Deploys, feature flags, commits | Git in the repo, CI/CD or flag provider MCP | What was deployed or toggled right before it started? |
The layers only add up if they share IDs. The browser should send the replay session ID with every API call, and your backend should log it next to the trace_id. Our structured logging guide shows the setup for Node.js, Python and Go in a few lines each. With those two fields in place, the agent walks from a replay to a trace to a log line by lookup, not by inference.
Setup: connect the MCP servers
Here is a working configuration for a typical stack: LogNroll for session replay, Sentry for errors, Grafana (Loki and Tempo) for logs and traces, and Chrome DevTools for reproduction. Swap in your own backend: Honeycomb, Datadog and most log platforms now ship an MCP server too.
// .cursor/mcp.json (Cursor). Comments are for explanation only: remove them in the real file.
// The same servers work in Claude Code, OpenCode and JetBrains ACP agents.
{
"mcpServers": {
"lognroll": { "url": "https://mcp.lognroll.com/mcp" }, // session replay data, read-only
"sentry": { "url": "https://mcp.sentry.dev/mcp" }, // errors, traces, logs (OAuth)
"grafana": { // Loki logs, Tempo traces, dashboards
"command": "docker",
"args": ["run", "--rm", "-i", "-e", "GRAFANA_URL", "-e", "GRAFANA_SERVICE_ACCOUNT_TOKEN",
"mcp/grafana", "-t", "stdio"],
"env": {
"GRAFANA_URL": "https://grafana.internal.example.com",
"GRAFANA_SERVICE_ACCOUNT_TOKEN": "${env:GRAFANA_VIEWER_TOKEN}" // Viewer role only
}
},
"chrome-devtools": { // reproduce in a throwaway browser profile
"command": "npx",
"args": ["-y", "chrome-devtools-mcp@latest", "--isolated"]
}
}
}# Claude Code: same servers, one line each
claude mcp add --transport http lognroll https://mcp.lognroll.com/mcp
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp
claude mcp add chrome-devtools -- npx -y chrome-devtools-mcp@latest --isolatedThe LogNroll MCP server exposes nine read-only tools over real sessions, including search_sessions, get_session_errors and get_session_network, and every call is scoped to your team. Large payloads are truncated with an explicit marker and high-frequency events are left out unless requested, so a single session does not fill the agent's context.
A worked example: checkout errors after a deploy
A typical morning: error rate on checkout is up, nobody can reproduce it, and support has two angry emails. This is the prompt we give the agent. Notice it asks for an investigation and evidence, not a fix:
Checkout returns errors for some users since this morning's deploy.
Investigate before changing any code:
1. Find sessions from the last 6 hours that hit /checkout and recorded an error.
2. For 3 of them, list the failing network calls and the x-session-id / trace_id they carried.
3. Look up those trace_ids in the backend (logs + traces). Which service and error?
4. Check what changed in the last deploy that touches that code path.
5. Reproduce on staging with Chrome DevTools if you can.
Report: evidence with links/IDs for every claim, the root cause with a confidence level,
and a proposed fix. Do not edit files until I approve the diagnosis.And this is the shape of the tool chain that follows (abbreviated, IDs shortened):
> lognroll.search_sessions { query: "/checkout", from: "-6h" } -> 214 sessions
> lognroll.list_sessions { status: "error", ... } -> 37 with errors (17%)
> lognroll.get_session_errors s_9a1f... -> "TypeError: Cannot read properties of undefined (reading 'amount')"
> lognroll.get_session_network s_9a1f... -> POST /api/checkout/quote 422 x-session-id=s_9a1f traceparent=00-6c1e...
(same pattern in s_47bd, s_c03e: all three have a saved card from before 2025, all on Safari)
> grafana.query_loki_logs {service_name="pricing-api"} | json | trace_id="6c1e..."
-> level=error msg="quote validation failed" error.type=missing_billing_country
> sentry: issue PRICING-API-8K3, first seen 07:42 UTC, 1,180 events
> git log --since=yesterday -- services/pricing-api -> a41c9e2 "require billing_country on quote"
> chrome-devtools.navigate_page staging/checkout (seeded legacy card) + list_network_requests
-> 422 reproduced; the frontend reads quote.total.amount without checking the error body
Diagnosis (high confidence): a41c9e2 made billing_country mandatory; legacy saved cards have none,
pricing-api returns 422 and the checkout page crashes on the error body instead of asking for the country.Three things made this work. The agent started from user impact, so it learned early that only legacy saved cards on one browser were affected, which no backend dashboard showed. It followed IDs from the replay's network call to the exact log line. And it reproduced the failure in an isolated browser before proposing anything. The fix it proposed has two parts: a backend default for old cards and a frontend guard that shows a country field instead of crashing. That second part only appears because the agent saw the frontend error in the session data. For more on the frontend side of this loop, see error tracking with session replay.
Put the method in the repo, not in your head
Agents follow written instructions better than habits. Add a short section to AGENTS.md, CLAUDE.md or your Cursor rules so every investigation starts the same way:
## Production debugging (AGENTS.md / CLAUDE.md / .cursor/rules)
- Start from user impact: find affected sessions in LogNroll before reading backend logs.
- Join layers by ID, never by timestamp guessing: session.id -> trace_id -> log lines -> commit.
- Every claim in the report needs an ID or link (session, trace, issue, commit).
- State confidence (high / medium / low) and what evidence would change your mind.
- Read-only during investigation. Propose the fix as a diff; wait for approval.
- Never paste raw personal data (emails, tokens, card data) into the report.Guardrails for AI debugging in production
| Rule | Why |
|---|---|
| Read-only credentials for every MCP server | A Grafana Viewer token, a read-only Sentry scope, the read-only LogNroll MCP. Investigation never needs write access. |
| Autonomy matched to risk | Honeycomb names four levels: Observe, Recommend, Act with review, Operate. Start every new agent at Recommend; promote it only after its diagnoses keep holding up. |
| Evidence or it did not happen | Require an ID for every claim. Confident wrong answers are the most common failure of AI SRE tools in Bronto's evaluation of 64 of them. |
| Mask before the model sees it | Mask inputs in session replay at capture time and redact secrets in the logger. An agent will happily quote whatever it reads. |
| Budget per investigation | Raw event streams are huge. Ask for stats and errors first, full event dumps last. Datadog built Scout because general models were too costly to run on every alert. |
| Isolated browser for reproduction | Run Chrome DevTools MCP with --isolated against staging, never against a browser profile that is signed in to production admin tools. |
If your session data must not leave your infrastructure, the same workflow runs with a local model; we tested that in local LLMs for session replay debugging. For the legal side of recording sessions at all, see session replay and GDPR.
Vendor AI SRE agent or your own coding agent with MCP?
| Aspect | Vendor AI SRE agent | Coding agent + MCP servers |
|---|---|---|
| Setup | Enable in the product; works on day one | An mcp.json and an AGENTS.md section; 30 minutes |
| Data reach | Deep in its own platform; other sources via connectors | Anything with an MCP server: replay, logs, traces, repo, browser |
| Can it fix code? | Usually diagnoses and proposes; some open PRs | Yes: the agent already has the repo and can write the patch and the test |
| Runs without a human | Yes: triggered by alerts, works between incidents | Only if you script it (CI job, agent SDK); otherwise on demand |
| Cost model | Per investigation, per credit or per agent-hour | Your model tokens; watch event-stream size |
| Best for | On-call triage at alert time | The engineer who owns the fix, with full context |
They are not rivals. A vendor agent is the first responder at 3 a.m.; a coding agent with MCP is the engineer's pair the next morning. The pairing that works best for small teams: let the platform agent open the incident with its first diagnosis, then hand the incident link to your coding agent, which confirms it against session data and the repo and prepares the patch with a test.
Readiness checklist
| Item | Quick test |
|---|---|
| Session replay is reachable over MCP | Ask your agent: "list sessions with errors in the last hour". Does it answer with IDs? |
| Requests carry session.id and trace_id | Open one failing request in a replay: is there a header you can paste into your log search? |
| Backend logs are structured and searchable by trace_id | One query from trace_id to the error line, no regex. |
| Deploys are visible to the agent | Can it answer "what shipped to pricing-api today?" from git or CI? |
| All tokens are read-only | Try a write call in a test project. It should fail. |
| A debugging runbook lives in the repo | AGENTS.md or CLAUDE.md tells the agent to investigate first and cite evidence. |
Frequently asked questions
Can an AI agent debug production issues on its own?
It can do most of the investigation: find affected users, pull the failing requests, match them to backend logs and traces, and point at the change that caused it. In late 2026 the vendor agents (Sentry Seer Agent, Datadog Bits AI SRE, PagerDuty Paige, Honeycomb agents) mostly diagnose and propose, and only act on their own in narrow, well-understood cases. Keep a human approving fixes and anything that changes production.
What is MCP debugging?
MCP (Model Context Protocol) debugging means giving an AI agent typed, read-only tools over your debugging data instead of pasting logs into a chat. Each source exposes an MCP server: session replay, error tracking, log and trace backends, the browser through Chrome DevTools MCP. The agent calls the tools it needs and joins the results by IDs such as session.id and trace_id.
Why does an AI agent need session replay if it has logs and traces?
Logs and traces show what the backend did. They do not show what the user did before the request, what the page displayed, or frontend errors that never reached the server. Session replay data gives the agent the user-side half: the clicks, the page state, the console errors and the network calls of real affected sessions. That is usually how it finds the reproduction steps.
Should I buy an AI SRE tool or build my own with MCP?
They solve different moments. A vendor AI SRE agent runs at alert time, works inside one platform and helps on-call triage. A coding agent with MCP servers is best for the engineer who will write the fix, because it sees replay, logs, traces and the repository together. Many teams will use both: the vendor agent opens the incident with a first diagnosis, the coding agent confirms it and prepares the patch.
Is it safe to let an AI agent read production data?
It is reasonable with the same controls you would apply to a new engineer: read-only scoped credentials, masking of personal data at capture and in logs, an audit trail of tool calls, and no write or deploy permissions during investigation. Under GDPR, check that your model provider is covered by a data processing agreement, or run a local model for sensitive data.
Further reading
- MCP server: connect AI agents to session data
- Structured logging best practices for Node.js, Python and Go
- AI product analytics: query event data in plain language
- Debug frontend bugs with session replay
- LogNroll product overview
Give your AI agent the user's side of every incident. Try LogNroll for free and connect it over MCP.