Set up for Ray on Agent Platform

Before you begin with Ray on Agent Platform, follow these steps to set up your Google project and Agent Platform SDK for Python:

  1. Set up billing for your project, install the gcloud CLI, and enable the Agent Platform API. To do this, follow the steps at Set up a project and a development environment.

    Enable the Agent Platform API

  2. Prerequisite: You must know how to develop programs using open source Ray.

  3. The Ray on Agent Platform SDK for Python used here is a version of the Agent Platform SDK for Python that includes the functionality of the Ray Client, Ray BigQuery connector, Ray cluster management on Gemini Enterprise Agent Platform, and predictions on Gemini Enterprise Agent Platform.

    • If you use Ray on Agent Platform in the Google Cloud console, a Colab Enterprise notebook guides you through the Agent Platform SDK for Python installation process after you create a Ray cluster.

    • If you use Ray on Agent Platform in the Vertex AI Workbench or other interactive Python environment, install the Agent Platform SDK for Python:

      # The latest image in the Ray cluster includes Ray 2.47
      # The latest supported Python version is Python 3.11.
      $ pip install google-cloud-aiplatform[ray]

      After you install the SDK, restart the kernel before you import packages.

  4. Optional: If you plan to read from BigQuery, create a new BigQuery dataset or use an existing dataset. To do this, see create a new BigQuery dataset.

  5. (Optional) To mitigate the risk of data exfiltration from Agent Platform, enable VPC Service Controls and specify a VPC network when you create a cluster. For more information, see VPC Service Controls with Agent Platform.

    If you enable VPC Service Controls, you can't reach resources outside the perimeter, such as files in a Cloud Storage bucket.

  6. (Optional) To use a custom container image, host it on Artifact Registry. A custom image lets you add Python dependencies that aren't included with the prebuilt container images. To build custom images, see Packing your software in the Docker documentation.

  7. (Optional) If you specify a VPC network when creating a Ray cluster on Gemini Enterprise Agent Platform, it's highly recommended that you use an auto mode VPC network in your project. Custom mode VPC networks and multiple VPC networks in the same project aren't supported and may cause cluster creation to fail.

Secure your clusters

Follow Ray best practices and guidelines, including running trusted code on trusted networks, to secure your Ray workloads. Deployment of ray.io in your cloud instances falls under the model of shared responsibility.

For more information about Google Cloud best practices, see the GCP-2024-020 security bulletin.

Supported locations

The Feature availability table lists the available locations for Ray on Agent Platform for Custom model training.

What's next