What the agent does
- Reads the status and the deployment history of each listed environment.
- Decides which ones are idle, for example no deployment for 24 hours or outside working hours.
- Stops the idle environments.
- Starts them again at the time you choose, with a deploy.
What the policy allows
The agent can
- Find the organization, project and environment by name
- Read the status and deployment history of the listed environments
- Stop a listed environment, or start it again with a deploy
The agent cannot
- Stop or deploy production, staging or any environment that is not listed
- Delete an environment or a service
- Change any configuration
401 Unauthorized.
The policy
Copy it, then replace eachREPLACE_WITH_... value with a real ID from your organization.
stop-idle-environments.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
- If a fixed schedule is enough, use deployment rules instead: they start and stop environments on a schedule with no agent at all. Use an agent when the decision depends on activity.
- Starting an environment is a deploy. The policy allows a deploy of the listed environments only.
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.