Sessionboxer

Let a coding agent investigate an incident: read-only dashboards, logs and databases, and no passwords in the chat

An alert fires at 3 a.m. and you want an agent to read the dashboards and logs first. How to give it read-only access without pasting a password into the chat.

Sessionboxer's Global settings with the MCP servers section, a connected GitHub entry, and the Devices and remote access section with a pairing QR code

The alert says checkout errors are up. It is 3 a.m., and the first twenty minutes of any incident look the same: open Grafana, pick the time window, check what was deployed, search the logs for the first stack trace, compare with yesterday. A coding agent can do that part while you find your glasses. The trouble is what it needs to do it. It needs logins to systems where one wrong call changes production, and the easy way to give it a login is to paste the password into the chat.

This post is for the person on call who wants the agent to look first and report back. It covers three things: what "read-only" should mean for each system, how to keep credentials out of the conversation, and how to write the investigation down once so the agent follows it every time. Then it shows how we set this up in Sessionboxer, and where that setup stops.

Read-only has to live in the credential

You can tell an agent "only look, do not change anything", and most of the time it will listen. But an instruction cannot stop a call the login allows. A tired agent with a write token makes the same mistakes a tired person does, as the agent that deleted a production database in nine seconds showed. So the first job is to give each system a login that cannot write, and to treat any instruction as a second layer on top.

Most of the tools an SRE uses already support this.

Grafana. Create a service account for the agent and give it the Viewer role. Grafana's docs note that service account tokens do not expire by default, and suggest a short expiry, a few hours or less, when you are not sure how long you need one. For an incident, that is a good fit. If the agent talks to Grafana through the Grafana MCP server, start it with --disable-write, which removes the create and update tools. The same README describes --prometheus-enforced-matchers and --loki-enforced-matchers. They add fixed label matchers to every query, so you can keep the agent to environment=~"prod|staging" and away from series with customer labels. Both need --disable-api.

uvx mcp-grafana --disable-write \
  --loki-enforced-matchers 'environment=~"prod|staging"' --disable-api

MongoDB. The MongoDB MCP server has a --readOnly flag. With it, only tools with read, connect and metadata operation types are registered, and the create, update and delete tools are not. All the examples in its README include the flag. The README also names a database user with limited privileges as another safeguard. Use both. The flag protects you from the MCP server's own tools, and the user protects you from everything else the agent might run.

PostgreSQL. Make a separate login for the agent and grant it the predefined role pg_read_all_data. It reads tables, views and sequences as if it had SELECT on all of them. Grant the login nothing else. The docs point out one catch: it does not bypass row-level security, so with RLS in place some rows stay hidden.

Logs, queues and deploy tools follow the same rule: look for a reader role in each one and give the agent that. If a system has no read-only login, think hard before you hand the agent a full one.

Keep the passwords out of the conversation

Once you have the right logins, you still have to hand them over. Pasting password: hunter2 into the chat works, and then the password is in the transcript, in the model's context on every turn after that, in the request your provider logs, and in any export of the session. Keeping secrets away from your coding agent goes through where they end up.

The better pattern is to let the agent use a credential by name. The tool that runs the command, or types into the login form, fills in the value at the last moment. The agent learns that the login worked and never sees the value. Most teams already do a version of this with environment variables and a wrapper script. What matters is that the value never passes through the model.

Write the investigation down once

On-call runbooks are usually a page of "check the deploys, then the error rate, then the logs around the first failure". An agent can follow that page well, if it can find it. Coding agents read skills: a SKILL.md file with a name, a description of when to use it, and the steps. Put your runbook in one and the agent will load it when an incident fits the description.

A good investigation skill says, in order:

  1. Pin down the symptom and write the time window down in UTC.
  2. List what changed in that window: deploys, config, feature flags, dependencies.
  3. Find where it fails: error rate and latency per endpoint compared with the day before, the logs around the first failure, one failing request traced end to end.
  4. Reproduce only outside production.
  5. Report the cause, or the two candidates and what would tell them apart, with the queries and log lines as evidence.

The last step is the one you read on your phone, so ask for the evidence along with the conclusion.

How we set this up in Sessionboxer

We make Sessionboxer, so this section is about our own product. Each session runs in its own box, a Docker container (or a Windows or macOS VM) with the agent you already pay for.

The systems around your software are called Utilities. You register each one once in Global settings: Grafana, Graylog, New Relic, Argo CD, RabbitMQ, MongoDB, a web app, an SSH host, or something custom. Each Utility belongs to an Environment, prod, staging and qa by default. An Environment marked production is off for new sessions, and the agent is told it may only look there. Every Utility also has a Read-only switch, on by default.

Credentials are write-only in Settings and are never shown again. When a Utility is on for a session, its credentials go to files on tmpfs inside the box, never into the workspace or a snapshot. The agent reads a manifest with the names and the credential names, never the values. Then it works by name:

  • sb-util curl grafana /api/search?query=checkout calls the HTTP API with the headers filled in.
  • ${util:graylog.password}, typed with the desktop keyboard tool, becomes the real password on the way to the screen, so the agent can log into a web UI on its desktop and the password does not appear in the transcript.
  • ${util:graylog.otp} becomes the current 2FA code.
  • A Utility can carry an MCP server, such as mongodb-mcp-server --readOnly. It joins the session's MCP servers only while that Utility is on, so turning prod off removes its tools.

Your runbook goes in as a Procedure. Settings has an "Investigate an incident" template with the five steps above, and each Procedure becomes a skill in every session whose Utilities it names. After an investigation that went well, the agent can propose an improved version, and you allow it from a card in the chat.

When you have a candidate fix, fork the session and switch on only staging in the Fork dialog. The fork keeps the whole investigation. It tries the fix where nothing real breaks, and the original session stays as the record of what you found. With the phone paired and notifications on, you get a push when the agent's turn ends, with the first line of its reply.

What this does not protect you from

The Read-only switch and the production flag are instructions in the agent's briefing. They help, and the agent can still ignore them. If the credential behind a Utility can write, the agent can write.

The tmpfs files are readable by anything that runs as the box's user, and that includes the agent's own commands. sb-util and the placeholders keep values out of the chat and out of the model's context. They do not stop an agent that decides to cat the file. Its briefing tells it not to, but the protection is still a least-privilege login.

Sessionboxer does not filter outbound traffic. A box can reach any address your machine can, including the production systems you did not register. If that matters, put the limit in your network.

The agent's report is a starting point. It can be wrong about a cause with full confidence, which is why the skill above asks for queries and log lines you can check yourself. Start with the Grafana Viewer token that expires in a few hours. It is the cheapest change on this page, and it makes the rest safer.

Features mentioned

Keep reading