Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Guardrails for a coding agent that can reach production

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…

Coding agents have advanced to the point where they can interact with your infrastructure, such as reading logs, sketching the environment and requesting a deployment, all within the same conversation. However, this capability poses risks if an agent makes a bad or unexpected request and deploys it to production without oversight.

The failure mode isn't that the model is malevolent; it's more likely that the agent made a mistake, such as pointing to the wrong environment, including a secret in a prompt, or requesting a broader tool call than intended. To mitigate these risks, it's crucial to give the agent the smallest scope necessary to perform its function effectively.

Begin by granting the agent read-only access to enable tasks like listing environments, inspecting service health, and retrieving redacted logs. Only provide deploy or operating permissions for specific workflows that are intended to be used. If the client supports it, regularly review and adjust the scopes to ensure they are not overly permissive.

Never allow the agent to handle secrets directly. Instead, treat the agent's knowledge of secret names as a design constraint rather than a policy the model should enforce. Practical methods include setting secrets on your local machine, where they remain confidential, and avoiding the inclusion of secrets in logs, chats, or tool arguments.

If a tool asks to set a secret, refuse it and manually set the value in a local command. Additionally, always approve the specific job you want the agent to execute, rather than granting ongoing permissions. This approval process should not be reusable for different jobs, environments, or services, and it should have a time limit.

When the agent requests a deploy, roll back, or restart, the job should be held and signed by a person before the server can act on it. The approval should be unique to that specific job, not reusable for other tasks. Moreover, the server should verify both the approval and the policy before performing any action. Establish different levels of approval based on the environment.

While personal preview environments can have looser restrictions, production environments should have stricter controls, requiring at least one person to approve and potentially two if multiple people can approve. Avoid allowing self-approval, as this could lead to the person who requested the change also being the only person who signs it.

Lastly, provide the agent with a separate environment for testing changes, rather than using production resources. This could be a sandbox with its own URL, time limit, and masked or empty database, all sourced from a non-production environment. The agent should never have access to secrets or be able to affect production directly.

Tools used by the agent should also be checked for any capabilities that could delete databases, services, or servers. If such functionality exists, the connection to production should be denied. Unrent, a hosted control plane, allows you to connect coding agents like Claude Code or Codex to their MCP service. To start, connect to Unrent using the provided URL and set up read access for the initial use.

Gradually add deploy or operate access only for the specific workflows you intend to use. When using the agent, follow the outlined approval process, ensuring that the server enforces the necessary approvals before any deployment occurs.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

More from Dev.to on urgent.news

Report a problem with this story

Get the day's news by email. Daily, weekly or monthly. Sign up

More in Tech

More from Wednesday, 2 December 2026 →