google / google/adk-python

VertexAiSearchTool fails with PUBLIC_WEBSITE datastores - "tool vertex_ai_search is not available"

Ouverte
#4,157 9 commentaires 2 réactions 1 personne assignée Assignée à @wyf7107 Voir sur GitHub
needs review tools
Langage dominant
Python
Étoiles
21.5k
Forks
4k
Merge moyen
1 j 14 h
PR mergées (30 j)
37

Description

## Description

`VertexAiSearchTool` fails with datastores that have `contentConfig: PUBLIC_WEBSITE` (website crawling), but works correctly with `contentConfig: CONTENT_REQUIRED` (GCS/PDF files).

## Environment

- **google-adk version**: 1.22.1
- **Python version**: 3.12
- **OS**: Windows 11
- **Deployment**: Both local (`adk web`) and Vertex AI Agent Engine

## Steps to Reproduce

1. Create a datastore from website crawling (PUBLIC_WEBSITE type)
2. Create an agent with VertexAiSearchTool pointing to that datastore
3. Run the agent locally with `adk web` or deploy to Agent Engine
4. Query the agent

## Code Example

```python
from google.adk.agents import LlmAgent
from google.adk.tools import VertexAiSearchTool

# This datastore is PUBLIC_WEBSITE type (website crawling)
WEB_DATASTORE_ID = "projects/{PROJECT_ID}/locations/global/collections/default_collection/dataStores/{WEBSITE_DATASTORE_ID}"

agent = LlmAgent(
name="web_search_agent",
model="gemini-2.5-flash-lite",
instruction="Search for information",
tools=[VertexAiSearchTool(data_store_id=WEB_DATASTORE_ID, max_results=8)],
)
```

## Expected Behavior

The agent should search the datastore and return results.

## Actual Behavior

The agent returns:
```
I am sorry, I cannot fulfill this request. The tool `vertex_ai_search` is not available.
```

## Datastore Configuration Comparison

| Datastore | contentConfig | Status |
|-----------|---------------|--------|
| Website crawling | `PUBLIC_WEBSITE` | ❌ FAILS |
| GCS/PDF files | `CONTENT_REQUIRED` | ✅ WORKS |

## API Response for Failing Datastore (PUBLIC_WEBSITE)

```json
{
"name": "projects/{PROJECT_ID}/locations/global/collections/default_collection/dataStores/{WEBSITE_DATASTORE_ID}",
"displayName": "Website_Datastore",
"industryVertical": "GENERIC",
"solutionTypes": ["SOLUTION_TYPE_SEARCH"],
"contentConfig": "PUBLIC_WEBSITE",
"defaultSchemaId": "default_schema"
}
```

## API Response for Working Datastore (CONTENT_REQUIRED)

```json
{
"name": "projects/{PROJECT_ID}/locations/global/collections/default_collection/dataStores/{PDF_DATASTORE_ID}",
"displayName": "PDF_Datastore",
"industryVertical": "GENERIC",
"solutionTypes": ["SOLUTION_TYPE_SEARCH"],
"contentConfig": "CONTENT_REQUIRED",
"defaultSchemaId": "default_schema",
"documentProcessingConfig": {
"defaultParsingConfig": {
"digitalParsingConfig": {}
}
}
}
```

## Additional Context

- The service account has `roles/discoveryengine.admin` permissions
- The datastores exist and are accessible via the Discovery Engine API
- The issue occurs both locally (`adk web`) and when deployed to Agent Engine
- Multiple agents in a ParallelAgent configuration, each with their own VertexAiSearchTool instance pointing to different datastores
- Only datastores with `CONTENT_REQUIRED` work, all `PUBLIC_WEBSITE` datastores fail with the same error

## Possible Cause

It seems like `VertexAiSearchTool` may have different handling requirements for `PUBLIC_WEBSITE` vs `CONTENT_REQUIRED` datastores, possibly related to the `SearchResultMode` configuration (CHUNKS vs DOCUMENTS).

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.