What the agent does
- Reads the deployment history and the logs after a release.
- Decides whether the new version is the cause of the errors.
- Finds the last healthy commit or image tag in the deployment history.
- Deploys that version, checks the service is healthy, and reports.
What the policy allows
The agent can
- Find the organization, project and environment by name
- Read the production environment, except environment variables
- Deploy a given commit of the listed applications
- Deploy a given image tag of the listed containers
The agent cannot
- Deploy without naming the version
- Deploy, stop or restart anything else
- Change configuration or environment variables
- Delete anything
401 Unauthorized.
The policy
Copy it, then replace eachREPLACE_WITH_... value with a real ID from your organization.
roll-back-bad-release.rego
You can copy the IDs from the Console URL, or list them with
qovery project list, qovery environment list and qovery application list.
Create the token
- With the coding agent
- In the Console
In a session signed in as an organization Owner or Admin, ask:The
qovery-policy-token skill finds the IDs, writes a policy like the one above, tests it locally and against the API, then creates the token.Prompt for the agent
The agent runs with the Qovery Agent Skills and the Qovery CLI, in Claude Code, Codex, Cursor or any agent that supports skills. Give it the token through the environment, never in the prompt:policy:<token-id>:<token-name>.
Good to know
- The policy cannot know whether a commit is older than the current one. It allows deploying any named commit or tag of the listed services, so the agent could also deploy a newer version. Keep tests and code review on your main branch.
- Qovery already rolls back automatically when new pods fail to start, with the RollingUpdate strategy. This agent handles the other case: the new version starts, but behaves badly.
Related
All agent policy examples
Every use case, from read only to production changes.
API Policy Token (Preview)
How policies are evaluated, the input they see, and the limits.