# Proactive cost optimization

> [!IMPORTANT]
> **Important:** Proactive cost optimization is in private preview, and is only available to users that have a [Premium Support contract](https://cloud.google.com/support/premium).   
>
> Use of this private preview offering of Gemini Cloud Assist is subject to the Google Cloud Agreement, including the Pre-GA Offering Terms of the [Google Cloud Specific Service Terms](https://cloud.google.com/terms/services?e=48754805), as supplemented by the terms for the [Gemini for Google Cloud Trusted Tester Program](https://cloud.google.com/trusted-tester/gemini-for-google-cloud-preview?e=48754805).

You can use Proactive Mode in Gemini Cloud Assist to automatically
identify cost anomalies and gain actionable insights into your cloud spending.

## Before you begin

Before Proactive Mode can analyze cost data, you must
[set up Proactive Mode](https://docs.cloud.google.com/cloud-assist/proactive-agents-setup).

## How proactive cost optimization works

Proactive Mode monitors your billing data in the background. When a
[cost anomaly is detected](https://docs.cloud.google.com/billing/docs/how-to/manage-anomalies) by
Cloud Billing, the agent automatically starts an investigation to
determine the root cause. This investigation can happen at most once a day per
project.

The agent correlates the cost spike to changes in your infrastructure, such as:

- Significant changes in spending patterns over time.
- Specific resources responsible for a spike.
- Resources that are underutilized but represent high spending.

## View investigation results

Once an investigation is complete, you can review the root-cause analysis and
remediation suggestions.

To view results, go to the **Cloud Hub Optimization** page in the
Google Cloud console:

[Go to Cloud Hub Optimization](https://console.cloud.google.com/cloud-hub/optimization)

## Automate cost notifications

You can build automated workflows that react when a cost investigation is
complete by using Eventarc.

To isolate cost-specific notifications from other agent activities, you must
configure your destination service, such as a Cloud Run functions, to filter
the delivered event payload.

1. Create an Eventarc trigger with the attribute `proactive=true` and the event type `google.cloud.geminicloudassist.task.v1.completed`.
2. Configure your code to inspect the `title` field in the delivered event data. Cost investigations include the string "Cost Anomaly" or "Cost Optimization" in the title.

For a technical integration guide, see
[Automate Proactive Agent activities](https://docs.cloud.google.com/cloud-assist/proactive-agents-tasks).

## What's next

- Learn about [agent identity](https://docs.cloud.google.com/cloud-assist/proactive-agents-concepts).
- Learn how to [set up Proactive Mode](https://docs.cloud.google.com/cloud-assist/proactive-agents-setup).
- Review [IAM requirements](https://docs.cloud.google.com/cloud-assist/iam-requirements) for optimization.