---
source_url: "https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/grounding/grounding-with-parallel"
title: "Grounding with Parallel Web Search  |  Gemini Enterprise Agent Platform  |  Google Cloud Documentation"
mirrored_at: 2026-08-14T01:33:22.380Z
host: docs.cloud.google.com
cited_in_42a: true
mirror_canonical: "https://index.42a.ai/docs.cloud.google.com/gemini-enterprise-agent-platform/models/grounding/grounding-with-parallel"
---

> **Original source:** https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/grounding/grounding-with-parallel

[Parallel Web Systems](https://parallel.ai/) offers a search API that provides access to publicly available web data that's optimized for use by large language models for grounding. This page explains how to ground Gemini responses by using Parallel.

Grounding with Parallel on Gemini Enterprise Agent Platform is a Separate Offering (as defined in your Google Cloud Agreement) that connects Gemini models to public web data provided by [Parallel Web Systems' search API](https://parallel.ai/). This service gives Gemini access to live information from billions of web pages to ensure more up-to-date and factual responses.

To use Grounding with Parallel Web Search, you must set up your access. You have two options:

Integrating through Google Cloud Marketplace lets you manage your Grounding with Parallel Web Search service directly within Google Cloud. To get started, subscribe to the Grounding with Parallel Web Search service on Google Cloud Marketplace, accept the terms of service, and review the pricing.

If you prefer to manage your Parallel billing and API access separately, you can provide your own API key. To use this method, you need to get an API key from the [Parallel developer platform](https://platform.parallel.ai/). This API key is used directly in your REST API requests to Gemini.

Request grounded responses from Gemini by using Agent Studio in the Google Cloud console, the Google Gen AI SDK, or the REST API. For best performance, we recommend using default settings for optional parameters unless you strictly require non-default values.

If you subscribed to Grounding with Parallel Web Search on Google Cloud Marketplace , verify that the billing account used for your subscription is active in your Google Cloud project.

Before you run the samples, complete the [prerequisites](#before-you-begin), including [subscribing on Google Cloud Marketplace](#subscribe-on-marketplace) or providing a Parallel API key.

Each SDK sample reads your project and location from the environment variables shown in its tab. In the sample code, replace `MODEL_ID` with a [supported model](#supported-models) ID, such as `gemini-2.5-flash`.

### Console

To ground Gemini responses with Parallel Web Search by using Agent Studio on Gemini Enterprise Agent Platform, follow these steps:

1.  In the Google Cloud console, go to the **Agent Studio** page.
    
    [Go to Agent Studio](https://console.cloud.google.com/agent-platform/studio/multimodal;mode=prompt)
    
2.  In the side panel, under **Model settings**, in the **Grounding** section, turn on the **Partners** toggle (**Search results from grounding partners**).
    
3.  Select **Parallel Web Search** as the grounding partner, and then click **Apply**. To use Parallel Web Search, you must first [subscribe to it on Google Cloud Marketplace](#subscribe-on-marketplace).
    
4.  Enter your prompt in the text box and submit it.
    

Your prompt responses now use Grounding with Parallel Web Search.

### Python

#### Install

pip install --upgrade google-genai

To learn more, see the [SDK reference documentation](https://googleapis.github.io/python-genai/).

Set environment variables to use the Google Gen AI SDK with Vertex AI:

\# Replace the \`GOOGLE\_CLOUD\_PROJECT\` and \`GOOGLE\_CLOUD\_LOCATION\` values
\# with appropriate values for your project.
export GOOGLE\_CLOUD\_PROJECT\=GOOGLE\_CLOUD\_PROJECT
export GOOGLE\_CLOUD\_LOCATION\=global
export GOOGLE\_GENAI\_USE\_ENTERPRISE\=True

```
from google import genai
from google.genai import types

client = genai.Client()

response = client.models.generate_content(
    model="MODEL_ID",
    contents="Who won the 2025 Las Vegas F1 Grand Prix?",
    config=types.GenerateContentConfig(
        tools=[
            types.Tool(
                parallel_ai_search=types.ToolParallelAiSearch(
                    # Optional. Omit api_key if you subscribed to Grounding with
                    # Parallel Web Search on Google Cloud Marketplace. Otherwise,
                    # provide your Parallel API key.
                    # api_key="API_KEY",
                    # Optional. Customize the search. See the REST tab for the
                    # full list of supported parameters. Keys inside custom_configs
                    # are Parallel.ai Search API params (snake_case).
                    custom_configs={
                        "mode": "basic",
                        "max_results": 10,
                        "source_policy": {"include_domains": ["wikipedia.org"]},
                    },
                )
            )
        ],
    ),
)

print(response.text)
# Example response:
# Max Verstappen won the 2025 Las Vegas F1 Grand Prix ...

# The grounding metadata contains the web sources used to ground the response.
print(response.candidates[0].grounding_metadata.grounding_chunks)
```

To customize the search, set the `custom_configs` field of `ToolParallelAiSearch`. This field accepts the same optional parameters that are described in the **REST** tab, such as `source_policy`, `excerpts`, `max_results`, and `mode`.

### Java

Learn how to install or update the [Java](https://docs.cloud.google.com/vertex-ai/generative-ai/docs/sdks/overview).

To learn more, see the [SDK reference documentation](https://central.sonatype.com/artifact/com.google.genai/google-genai).

Set environment variables to use the Google Gen AI SDK with Vertex AI:

\# Replace the \`GOOGLE\_CLOUD\_PROJECT\` and \`GOOGLE\_CLOUD\_LOCATION\` values
\# with appropriate values for your project.
export GOOGLE\_CLOUD\_PROJECT\=GOOGLE\_CLOUD\_PROJECT
export GOOGLE\_CLOUD\_LOCATION\=global
export GOOGLE\_GENAI\_USE\_ENTERPRISE\=True

```
import com.google.genai.Client;
import com.google.genai.types.GenerateContentConfig;
import com.google.genai.types.GenerateContentResponse;
import com.google.genai.types.Tool;
import com.google.genai.types.ToolParallelAiSearch;
import java.util.List;
import java.util.Map;

public class ParallelGroundingSample {
  public static void main(String[] args) {
    try (Client client = Client.builder().build()) {

      GenerateContentConfig config =
          GenerateContentConfig.builder()
              .tools(
                  // Omit apiKey if you subscribed to Grounding with Parallel Web
                  // Search on Google Cloud Marketplace. Otherwise, set apiKey to
                  // your Parallel API key.
                  Tool.builder()
                      .parallelAiSearch(
                          ToolParallelAiSearch.builder()
                              // Optional. Customize the search. See the REST tab
                              // for the full list of supported parameters. Keys
                              // inside customConfigs are Parallel.ai Search API
                              // params (snake_case).
                              .customConfigs(
                                  Map.of(
                                      "mode", "basic",
                                      "max_results", 10,
                                      "source_policy",
                                      Map.of(
                                          "include_domains",
                                          List.of("wikipedia.org"))))
                              .build())
                      .build())
              .build();

      GenerateContentResponse response =
          client.models.generateContent(
              "MODEL_ID", "Who won the 2025 Las Vegas F1 Grand Prix?", config);

      System.out.println(response.text());
    }
  }
}
```

To customize the search, set the `customConfigs` field of `ToolParallelAiSearch`. This field accepts the same optional parameters that are described in the **REST** tab, such as `source_policy`, `excerpts`, `max_results`, and `mode`.

### Node.js

#### Install

npm install @google/genai

To learn more, see the [SDK reference documentation](https://googleapis.github.io/js-genai/).

Set environment variables to use the Google Gen AI SDK with Vertex AI:

\# Replace the \`GOOGLE\_CLOUD\_PROJECT\` and \`GOOGLE\_CLOUD\_LOCATION\` values
\# with appropriate values for your project.
export GOOGLE\_CLOUD\_PROJECT\=GOOGLE\_CLOUD\_PROJECT
export GOOGLE\_CLOUD\_LOCATION\=global
export GOOGLE\_GENAI\_USE\_ENTERPRISE\=True

```
import {GoogleGenAI} from '@google/genai';

const ai = new GoogleGenAI({});

const response = await ai.models.generateContent({
  model: 'MODEL_ID',
  contents: 'Who won the 2025 Las Vegas F1 Grand Prix?',
  config: {
    tools: [
      // Omit apiKey if you subscribed to Grounding with Parallel Web Search on
      // Google Cloud Marketplace. Otherwise, set apiKey to your Parallel API key.
      {
        parallelAiSearch: {
          // Optional. Customize the search. See the REST tab for the full
          // list of supported parameters. Keys inside customConfigs are
          // Parallel.ai Search API params (snake_case).
          customConfigs: {
            mode: 'basic',
            max_results: 10,
            source_policy: {include_domains: ['wikipedia.org']},
          },
        },
      },
    ],
  },
});

console.log(response.text);
```

To customize the search, set the `customConfigs` field of the `parallelAiSearch` tool. This field accepts the same optional parameters that are described in the **REST** tab, such as `source_policy`, `excerpts`, `max_results`, and `mode`.

### REST

Before using any of the request data, make the following replacements:

-   LOCATION: The region to process the request. To use the global endpoint, exclude the location from the endpoint name and configure the location of the resource to \`global\`.
-   PROJECT\_ID: Your Google Cloud project ID.
-   MODEL\_ID: The ID of the model to use.
-   TEXT: The text prompt to send to the model.
-   API\_KEY: Your API key for Parallel Web Search. If you specify an API key and are also subscribed to Grounding with Parallel Web Search on Google Cloud Marketplace, the API key takes precedence.
-   ENABLE\_ZERO\_DATA\_RETENTION: Optional: Switch to the [ZDR version of Parallel Web Search](https://console.cloud.google.com/marketplace/product/parallel-web-systems-public/parallel-web-systems-zdr) to enable Zero Data Retention on sensitive workloads. Set to `true` to use the ZDR offering for your request. You _must_ be subscribed to the ZDR-specific offering for these requests to succeed. If not specified, it defaults to the [standard version](https://console.cloud.google.com/marketplace/product/parallel-web-systems-public/parallel-web-systems). The ZDR version is only available via Google Cloud Marketplace.
-   EXCLUDE\_DOMAINS: Optional: List of domains to exclude from grounding sources. If specified, sources from these domains are excluded. Acceptable values are domains (www.example.com) or domain extensions starting with a period ( .gov, .edu, .co.uk). You can specify up to 200 domains.
-   INCLUDE\_DOMAINS: Optional: List of domains to include in grounding sources. If specified, sources from these domains are included. Acceptable values are domains (www.example.com) or domain extensions starting with a period ( .gov, .edu, .co.uk). You can specify up to 200 domains.
-   MAX\_CHARS\_PER\_RESULT: Optional: The maximum number of characters to include in each search result excerpt. If not specified, defaults to `30000`. The allowed range is `[1000, 100000]`.
-   MAX\_CHARS\_TOTAL: Optional: The maximum total characters from all search result excerpts. If not specified, defaults to `100000`. The allowed range is `[1000, 1000000]`.
-   MAX\_RESULTS: Optional: The maximum number of search results to use for grounding. If not specified, defaults to `10`. The allowed range is `[1, 20]`.
-   MODE: Optional: Mode to be used for the request either `basic` or `advanced`. The default is `basic`. Consider `advanced` mode if you want more thorough search results at the expense of higher latency.
-   SEARCH\_LOCATION: Optional: [ISO 3166-1 alpha-2 country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) for geo-targeted search results. Example: `"us"`.

HTTP method and URL:

POST https://LOCATION\-aiplatform.googleapis.com/v1/projects/PROJECT\_ID/locations/LOCATION/publishers/google/models/MODEL\_ID:generateContent

Request JSON body:

{
  "contents": \[{
    "role": "user",
    "parts": \[{
      "text": "TEXT"
    }\]
  }\],
  "tools": \[{
    "parallelAiSearch": {
        "api\_key": "API\_KEY",
        "enable\_zero\_data\_retention": ENABLE\_ZERO\_DATA\_RETENTION,
        "customConfigs": {
            "mode": "MODE",
            "location": "SEARCH\_LOCATION",
            "max\_results": MAX\_RESULTS,
            "source\_policy": {
                "exclude\_domains": \["EXCLUDE\_DOMAINS"\],
                "include\_domains": \["INCLUDE\_DOMAINS"\]
            },
            "excerpts": {
                "max\_chars\_per\_result": MAX\_CHARS\_PER\_RESULT,
                "max\_chars\_total": MAX\_CHARS\_TOTAL
            }
        }
    }
}\],
  "model": "projects/PROJECT\_ID/locations/LOCATION/publishers/google/models/MODEL\_ID"
}

To send your request, expand one of these options:

#### curl (Linux, macOS, or Cloud Shell)

Save the request body in a file named `request.json`, and execute the following command:

curl -X POST \\  
     -H "Authorization: Bearer $(gcloud auth print-access-token)" \\  
     -H "Content-Type: application/json; charset=utf-8" \\  
     -d @request.json \\  
     "https://LOCATION\-aiplatform.googleapis.com/v1/projects/PROJECT\_ID/locations/LOCATION/publishers/google/models/MODEL\_ID:generateContent"

#### PowerShell (Windows)

Save the request body in a file named `request.json`, and execute the following command:

$cred = gcloud auth print-access-token  
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest \`  
    -Method POST \`  
    -Headers $headers \`  
    -ContentType: "application/json; charset=utf-8" \`  
    -InFile request.json \`  
    -Uri "https://LOCATION\-aiplatform.googleapis.com/v1/projects/PROJECT\_ID/locations/LOCATION/publishers/google/models/MODEL\_ID:generateContent" | Select-Object -Expand Content

You should receive a JSON response similar to the following.

#### Response

{
  "candidates": \[
    {
      "content": {
        "role": "model",
        "parts": \[
          {
            "text": "The most recent Super Bowl was Super Bowl LIX (59), which was played in 2025. The winner of Super Bowl LIX was the \*\*Philadelphia Eagles\*\*, who defeated the Kansas City Chiefs with a score of 40-22."
          }
        \]
      },
      "finishReason": "STOP",
      "groundingMetadata": {
        "webSearchQueries": \[
          "who won the last super bowl"
        \],
        "groundingChunks": \[
          {
            "web": {
              "uri": "https://...",
              "title": "Super Bowl LIX",
              "domain": "domain.com"
            }
          },
          {
            "web": {
              "uri": "https://...",
              "title": "Super Bowl LIX Results",
              "domain": "domain.com"
            }
          }
        \],
        "groundingSupports": \[
          {
            "segment": {
              "endIndex": 77,
              "text": "The most recent Super Bowl was Super Bowl LIX (59), which was played in 2025."
            },
            "groundingChunkIndices": \[
              0,
              1
            \]
          },
          {
            "segment": {
              "startIndex": 78,
              "endIndex": 198,
              "text": "The winner of Super Bowl LIX was the \*\*Philadelphia Eagles\*\*, who defeated the Kansas City Chiefs with a score of 40-22."
            },
            "groundingChunkIndices": \[
              0
            \]
          },
        \]
      }
    }
  \],
  "usageMetadata": {
    "promptTokenCount": 33,
    "candidatesTokenCount": 106,
    "totalTokenCount": 284,
    "billablePromptUsage": {
      "textCount": 142
    },
    "trafficType": "ON\_DEMAND",
    "promptTokensDetails": \[
      {
        "modality": "TEXT",
        "tokenCount": 33
      }
    \],
    "candidatesTokensDetails": \[
      {
        "modality": "TEXT",
        "tokenCount": 106
      }
    \],
    "toolUsePromptTokensDetails": \[
      {
        "modality": "TEXT",
        "tokenCount": 39
      }
    \],
    "toolUsePromptTokenCount": 39,
    "thoughtsTokenCount": 106
  },
  "modelVersion": "MODEL\_VERSION",
  "createTime": "CREATE\_TIME",
  "responseId": "RESPONSE\_ID"
}

The default quota is 200 prompts per minute. To request an increase to your rate limits, provide your use case and requirements to the appropriate contact: