What the agent does
- Reads production status, deployment history and logs to find the bug.
- Pushes a fix on a branch and opens a pull request (in your Git provider, outside Qovery).
- Deploys or redeploys the preview environment of that pull request and checks that it works.
- Stops the preview when the check is done.
What the policy allows
The agent can
- Find the organization, project and environment by name
- Read every environment of the project, production included, except environment variables
- Deploy, redeploy, restart or stop a preview environment, or one of its services
The agent cannot
- Deploy, restart or stop production or staging
- Change configuration or environment variables, even in a preview
- Delete anything, or clone an environment
- Act on another project
401 Unauthorized.
The policy
Copy it, then replace eachREPLACE_WITH_... value with a real ID from your organization.
fix-in-preview-environment.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 see whether an environment is a preview. It allows every environment of the project except the ones you list in
protected_environment_ids. Add any new long-lived environment to that list. - To also let the agent delete previews, use the preview cleanup policy, or add its delete rule to this one.
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.