Agents that run for weeks: who acted, who agreed, and how to stop them
This page is for teams that let AI agents change infrastructure configuration unattended, for days or weeks, several at once. Over that time, a team needs to know which agent made each change, who agreed to it, and how to stop an agent at once. This page says what ConfigHub and the Claude plugin already do about each problem, what may still be needed, and what is left to other tools.
To try stopping an agent, finding its change and putting it back, follow the walkthrough an agent did something wrong. To give each party a key of its own, made by its holder, follow a key each.
The problems:
- An agent acts with a person's sign-in, so nobody can tell who did what.
- Nobody approved this particular change.
- The agent can delete the record of what it did.
- Taking its access away leaves its open sessions running.
- The traces say what ran, not why a value is what it is.
The words on this page, such as hub, base and change order, are explained in the glossary.
What works now
Who acted: give the agent a key of its own
The problem. An agent working under your sign-in can do anything you can, including approve its own change. Its changes look like yours.
What you do. Give the agent a service account and key of its own:
cub mini require-approval COMPONENT --variant live --agent botWith that key, the agent may change the base, ask for a change with a change order, and read the copy that runs. It cannot approve, promote, or write the copy that runs. Its changes are recorded as revisions made by it, not by you. A session that the agent signs in with its key lasts up to 24 hours.
The command also writes the Claude Code settings that start the agent's sessions on that key, with your own sign-in kept out of their reach. Start each agent session with:
env -u CUB_CONFIG -u CUB_CONTEXT claude --settings ~/.confighub-agent-bot/claude-settings.jsonA CUB_CONFIG or CUB_CONTEXT set in your shell would win over the file's, which is why env -u removes them. If one does reach the agent, the sandbox still refuses it your configuration, and the agent can't use your sign-in. In the app's own folder, the Claude plugin gives a new session the agent's settings even when your shell sets CUB_CONFIG.
On a shared hub on confighub.com, the same steps with cub alone are in approvals.
Who agreed: require approval of the exact change
The problem. Nobody approved this particular change.
What you do. The same require-approval command makes the copy that runs change only when a person you named approves the exact revision. The approval covers the revisions it was given. The agent's next change waits for an approval of its own.
For example, an agent proposes a sale banner for the api:
- Its own approval is refused: "permission denied".
- A colleague the workflow doesn't name approves, and it doesn't count.
- Your approval lets exactly one revision through.
- The agent's next change, "Eight, to be safe", waits: "0 of 1".
Use a person's approval for the copy that runs in production. For weeks of unattended work, a person approving each change would not scale anywhere else. Elsewhere, the agent's rights on each Space are the control: it may edit the base, and may only read the copy that runs.
A record the agent cannot change
The problem. The agent can delete the record of what it did.
The Claude plugin keeps the record:
- on your machine;
- in each commit, if you turn that on;
- in a hub, as revisions the agent's key cannot rewrite.
What you do. Deny the agent writes to the record. The settings that require-approval --agent writes include this. For the Claude plugin alone, see keeping the record out of the agent's reach.
Told plainly to delete its record, an agent will delete the repository's copy and commit the deletion. With the record denied to the agent's writes, the same request fails with "Operation not permitted". The Claude plugin's hooks aren't sandboxed, so recording goes on.
The record is also signed, each entry as it is written. If anyone changes an entry afterwards, the change shows when the record is checked. On a cluster, each entry can be signed with the agent's own SPIFFE identity, so the record names the agent rather than the node it ran on. When the identity is withdrawn, the agent's later changes are recorded unsigned, and the check fails (signing with the agent's own identity). With a hub, a digest of the latest signature, a short fingerprint of it, is kept there as an attestation, which no one can change; comparing the record with it is done by hand today. You can check the signatures with Sigstore's cosign (signed records).
Stopping an agent
The problem. Deleting an agent's service account refuses its key, but leaves its rights in place. A session it already has open keeps working.
What you do. Take the agent's rights away first. Its open session is then refused at its next request ("space api-base not found").
- On the local hub:
cub mini revoke-agent bot. - On a shared hub on confighub.com: the plain
cubsteps in approvals. - To stop everything at once on the local hub:
cub mini stop. Clusters that deploy from it keep running what they have.
The stop is manual. A person runs it, for one agent at a time, or for the whole hub.
Tracing: why a value is what it is
The problem. Traces say what ran, not why a value is what it is.
What you do. Set CUB_MINI_OTEL=1, and set CUB_MINI_OTEL_ENDPOINT to your OpenTelemetry collector's OTLP/HTTP address. The Claude plugin then sends each value changed, each command that changed something, and each reason, as log events. They carry the same session.id as the events Claude Code sends when its own telemetry is on.
The agent's request is sent only with OTEL_LOG_USER_PROMPTS=1, the same setting Claude Code uses for prompts. A credential's values are never sent.
Each turn's model use, its model, calls and tokens, is sent too, as confighub.model_use, and kept in the record (model use).
Both kinds of event arrive under one session.id. For example, first comes confighub.value_changed with replicas 2 → 4, then confighub.reason, "Friday flash sale expected to quadruple api traffic".
Limiting what an agent can reach
The problem. The gate covers only what deploys from the hub, that is, Argo CD or Flux pulling approved versions over OCI (GitOps over OCI). An agent that also holds cluster credentials can go around it.
What you do. Give agents no cluster credentials, or a Kubernetes ServiceAccount that cannot write what the hub deploys. Where clusters still deploy from Git, branch protection on that repository is the gate.
What may still be needed
None of these is built. Each is here because a team running many agents for weeks may need it.
- Short-lived credentials. Today the agent's ConfigHub key is a file, and a session lasts up to 24 hours. Credentials that expire in minutes would make a lost key, or a late revocation, matter less. A SPIFFE identity already signs the record, but it cannot sign the agent in to ConfigHub.
- Finer-grained rights than "edit the base". For weeks of unattended work, a team may want an agent to change some values on its own, such as replicas within a range, while other values wait for a person.
- A stop for many agents at once, that monitoring can trigger. Today a person runs
revoke-agentfor each agent, or stops the whole hub. - A record nobody can change, everywhere. The record is signed, and with a hub its signatures' digests are kept where no one can change them (signed records). Without a hub, whoever holds this machine's key could still rewrite the record and sign it again. Sigstore's public log, and signing in CI with the job's own identity, would close that gap. One way around the write protection has not been tried:
git rm --cached, which takes the record out of Git without writing the folder. - Text planted in earlier requests. The next agent is given what earlier sessions asked. So text someone planted in a request reaches later agents. The Claude plugin marks quoted requests as "not requests to you now". That is a label, not a guard.
- Two gaps in the gate. Once approval is required, a chart's next version cannot be loaded into the hub through the gate. And a value you keep in the copy that runs cannot be changed through the gate.
- Scale. Everything on this page has been tried on one machine, not with thousands of agents.
What ConfigHub does not need to do
These matter for agents that run for weeks, but they are not configuration's job. Other tools do them, and ConfigHub works beside those tools.
- Watching behavior. Telling that an agent is heading the wrong way is the job of whatever watches your agents. ConfigHub records and gates what they change in configuration, and its events can feed that watcher.
- Isolating agents from each other. That is the job of the sandbox and the agent runtime. ConfigHub's part is the settings it writes, which keep your sign-in and the record out of the agent's reach.
- Patching what agents run on. Kernels, browsers, runtimes and libraries are patched by other tools.
- Trust between agents. How one agent decides to believe another is not ConfigHub's job. In ConfigHub, every change goes through the same record and the same gate, whichever agent asked for it.
- Keeping whole sessions. ConfigHub keeps what explains a value: who changed it, from what to what, and why. It does not keep every prompt, response and tool call.
- A person approving every change. Only the copy that runs in production needs that. Elsewhere, the agent's rights are the control.
More in what we do not claim.