Skip to main content
A cost agent that sets the CPU and memory of applications from their real usage over the last 30 days. It can change CPU and memory within bounds you choose, then redeploy. The number of instances and the Git branch must stay as they are. Level: Cost. See all the agent policy examples.

What the agent does

  1. Reads the usage of each listed application over the last 30 days.
  2. Proposes new CPU and memory values, with some headroom.
  3. Applies them, within the bounds of the policy.
  4. Redeploys the application and checks that it is healthy.

What the policy allows

The agent can

  • Find the organization, project and environment by name
  • Read the staging environment, except environment variables
  • Change CPU and memory of the listed applications, within the bounds
  • Redeploy the listed applications

The agent cannot

  • Set CPU or memory outside the bounds
  • Change the minimum or maximum number of instances
  • Change the Git branch
  • Change or redeploy any application that is not listed
  • Read or change production, delete anything
Anything the policy does not allow is refused with 401 Unauthorized.

The policy

Copy it, then replace each REPLACE_WITH_... value with a real ID from your organization.
right-size-applications.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

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:
Then give the agent its task:
Every call the agent makes appears in the audit logs as policy:<token-id>:<token-name>.

Good to know

  • Editing an application sends its full configuration. The policy checks CPU, memory, the number of instances and the Git branch. Other fields in the same request are not checked: add a rule for any other field you want to freeze.
  • Start on staging. Once you trust the results, copy the policy for production with tighter bounds.
  • The qovery-optimize skill uses Qovery observability data when it is enabled on the cluster. See Agent Skills.

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.