Let an agent propose fixes, with auto-approve for safe changes
Give an agent the right to propose, have people approve what matters, and let a rule restart pods in staging on its own, inside a limit.
The situation
shop runs web-staging and web-production. An agent watches them and, when something looks wrong, proposes a fix. You want three things:
- The agent can read and propose, and nothing else. It never approves, merges or holds a write credential.
- A person approves anything that touches production, and every change to code or config arrives as a pull request that your own review merges.
- One narrow case needs no human: restarting a stuck pod in staging, at most four times an hour.
A remediation is what the agent proposes. Wardn computes the diff of exactly what it would do, and makes the change itself, with its own credentials, only after a person approves it or a rule you wrote covers it.
What is not built yet
Execution is tested only against fakes: a fake GitHub and a fake cluster, not yet the real ones. A config change always waits for a person today, because its dry run is not available, and scaling is refused until the operator has a scale command.
What you need
| Object | Setting |
|---|---|
Team platform | Owns the agent. Its members can see and manage it. |
Deployments web-staging, web-production | In environments staging and production. |
| The agent's model key | The agent uses your own model key. Wardn does not bill for agents. |
Settings
Create the agent
The agent may act with approval at most. Raise it to autonomous only for the stages where a rule should be able to cover its proposals.
api() { curl -fsS -H "Authorization: Bearer $WARDN_TOKEN" -H 'Content-Type: application/json' "$@"; }
AGENT_ID=$(api -X POST "$WARDN_API_URL/api/v1/agents" -d '{
"name": "Shop SRE",
"runtime": "claude_code",
"placement": "cloud",
"teamId": "'"$PLATFORM_TEAM_ID"'",
"maxAutonomy": "autonomous",
"stageAutonomy": [{"stageId": "'"$PIPELINE_ID"'/production", "autonomy": "act_with_approval"}]
}' | jq -r .id)stageAutonomy is keyed pipelineId/stageName. A stage that is not listed gets the agent's most, so list production and say what it may do there: even with a matching rule, an agent that must be approved is never auto-approved at that stage.
Give it a role that proposes and reads
An agent holds only the roles you give it. It does not take its team's. A role with remediation:propose, deployment:read and app:read is enough for this job. Give it that role on the deployments it should watch.
api -X POST "$WARDN_API_URL/api/v1/role-bindings" -d '{
"roleId": "'"$PROPOSER_ROLE_ID"'",
"subject": {"kind": "agent", "id": "'"$AGENT_ID"'"},
"scope": {"kind": "environment", "id": "'"$STAGING_ENV_ID"'", "label": "Staging"}
}'You can only give what you hold yourself. Naming remediation:approve or remediation:rules in the role does nothing: the agent's page lists them as locked.
Write the rule
The rule covers one kind of proposal, narrowed to what is safe: a restart, in staging, from this agent, four times an hour.
api -X POST "$WARDN_API_URL/api/v1/remediation-rules" -d '{
"name": "Restart stuck pods in staging",
"enabled": true,
"kind": "cluster_action",
"action": "restart",
"environmentIds": ["'"$STAGING_ENV_ID"'"],
"agentIds": ["'"$AGENT_ID"'"],
"limit": {"count": 4, "window": "hour"}
}'Creating a rule needs remediation:rules, which no agent can hold. The limit is counted under a lock on the rule, so five proposals arriving together under a limit of four approve four. A rule is off until you enable it.
What happens
- The agent calls
propose_remediationwith acluster_actionpayload for a pod ofweb-staging. Wardn checks that the agent may propose and reads where the change lands. - The rule matches, the agent may act on its own at
staging, nothing on the never auto-approved list applies, and the limit has room. The proposal is approved by the rule, and a job is queued. - Wardn restarts the pod through the operator, under a capability minted for this one proposal. The audit log reads "Executed by Wardn under rule Restart stuck pods in staging, proposed by agent Shop SRE", and the agent's track record counts it as approved.
A restart in production matches no rule, so it waits as pending. A person with remediation:approve at that deployment, who is not the person who asked the agent, opens the proposal, reads the diff and decides:
api -X POST "$WARDN_API_URL/api/v1/remediations/$RM_ID/decision" -d '{"decision": "approve"}'A code fix works the same way, without a rule: Wardn pushes an agent/… branch and opens a pull request that says who proposed and who approved it. It has no way to merge it.
Check that it holds
GET /remediation-rules/lockedlists what no rule can ever approve. A change to production is on it, whatever the rules say.- Pause the agent (
POST /agents/{id}/pause) and its next call is refused within seconds, on every replica.PUT /agent-kill-switchpauses every agent. - Propose something stale on purpose: push a commit to the base branch after the agent proposed a code fix. The proposal expires instead of being approved, and nothing is pushed.