Coding agents are now close enough to your infrastructure to be useful. They can read logs, sketch an environment and request a deploy from the same conversation in which they just changed the code. That is a good workflow only if a bad or unexpected request cannot land in production on its own.

The failure mode is not "the model is evil". It is more ordinary: the agent picks the wrong environment, a prompt includes a secret, a tool call is broader than you thought, or a request that looks like yours was not something you would have typed. You want the agent to be able to ask, and you want a person to approve the exact change before a server acts on it.

Start with read access

Give the agent the smallest scope that still helps. Read access is enough to list environments, inspect service health and fetch redacted logs. That is the right first connection: you can ask "what is running in production?" without also granting "deploy it".

Grant deploy or operate access only for the workflows you intend to use, and only for the organisation you mean. A connection that can see every organisation you belong to, or that was left on from a laptop experiment, is how a casual prompt becomes a production change.

If your client supports it, reconnect and review the scopes instead of assuming last month's defaults still hold. Ask the agent to list environments and services first. If it can already request a deploy at that point, the scope is too wide.

Never let secrets pass through the model

A coding agent that can print a database password or an API key will, sooner or later, put that value in a log, a chat transcript or a tool argument. Treat that as a design constraint, not a policy you hope the model will follow.

Practical rules:

  • The agent can know the names of secrets, not their values.
  • Setting a secret happens on your machine, not in the chat.
  • Production credentials never go into a sandbox, a preview or a paste "so the agent can try it".

If you need to add a key, do it in a local command that reads the value from stdin or a prompt, and confirm afterwards that the chat never saw it. If a tool offers to "set STRIPE_KEY=sk_live_…" for you, refuse the tool and set the value yourself.

Approve the exact job, not a standing permission

A blanket "this agent may deploy" is hard to reason about. A better control is: the agent requests a deploy, the control plane holds the job, and a person signs that exact job. The approval should not be reusable for a different image, service or environment.

Put a time limit on it. A request that sits in a queue overnight is no longer the thing you looked at. The tool result should come back as "this needs your approval" with a link to the job, and nothing should be sent to the server until you sign it.

The shape looks like this:

  1. The agent asks to deploy, roll back or restart.
  2. The job is signed and held. The new release is not running.
  3. You review the exact job and approve it with a passkey.
  4. The server checks that signature and the approval itself, then acts.

Step 4 matters as much as step 3. If the rules live only in the control plane, a compromised control plane can skip them. The stronger version is that the server also knows the policy, and will refuse a deploy that does not have the approvals.

Put a floor on production

Not every environment needs the same friction. A personal preview can be loose. Production should not be.

Set an approval floor on production for deploys, config changes and rollbacks: at least one person, and two if more than one person can already approve. If you can, refuse self-approval, so the person who asked for the change is not also the only person who signs it.

That is the right place to be strict, because a coding agent is otherwise very good at doing exactly what you just implied in a hurry.

Give the agent a place that is not production

When the agent needs to try a change, give it a disposable copy: its own URL, a time limit, and a database that is masked or empty, from a non-production environment. A sandbox should never receive a production secret and should never be able to touch production.

Separately, check the agent's tools for anything that deletes a database, a service or a server. If the answer is not a clear no, do not connect that agent to production.

How Unrent runs this

Unrent is a hosted control plane that deploys onto servers you own. You can connect Claude Code, Codex, Cursor, VS Code or another MCP client to https://mcp.unrent.dev/mcp. On first use, choose one organisation and start with read access. Grant deploy or operate access only for the workflows you intend to use.

Claude Code:

claude mcp add --transport http unrent https://mcp.unrent.dev/mcp 

Then type /mcp in Claude Code, choose unrent and sign in.

Codex CLI:

# ~/.codex/config.toml [mcp_servers.unrent] url = "https://mcp.unrent.dev/mcp" 
codex mcp login unrent 

get_variables returns the names of secrets, never their values, and set_variables refuses anything that looks secret. You set the value on your own machine, where it is sealed, so it never passes through the model:

# the value is read from stdin unrent env set production/web STRIPE_KEY=- --secret 

Deploys, rollbacks and restarts requested by the agent are signed and held. The tool answers approval_required with a link. Nothing is sent to the server until a person approves that exact job with a passkey (Touch ID, Windows Hello or a security key). A job nobody approves within 10 minutes expires. The server enforces the same rule: an approval floor is stored on the server as a policy change, and after that it refuses a deploy that does not have those approvals.

An admin can set an environment to need 0, 1 or 2 approvals. Production's floor is one by default, and you can raise it to two. You can also turn on the two-person rule so nobody approves their own request.

An authorised agent can create a disposable sandbox under the sandbox policy. A sandbox never gets a secret value and never touches production. No MCP tool deletes a database, a service or a server.

A checklist before you let an agent request deploys

  • Does the connection have read access only, until you deliberately grant more?
  • Can the agent read or set secret values, or only their names?
  • Does a deploy, rollback or restart wait for a person to sign that exact job?
  • Does the approval expire if nobody acts on it?
  • Does the server itself refuse a change that lacks those approvals?
  • Does production need at least one approval, and can you require two?
  • Is there a sandbox path that cannot see production secrets?
  • Can the agent delete a database or a server? If the answer is not a clear no, do not connect it.

A coding agent is a fast junior operator. Give it the same rule you would give a person: it can ask, it can inspect, and production does not move until you say so, on that job, with a key only you can use.

More at unrent.dev.