google / google/adk-python

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

Abierto
#4,157 9 comentarios 2 reacciones 1 asignado Asignado a @wyf7107 Ver en GitHub
needs review tools
Lenguaje dominante
Python
Estrellas
21.5k
Forks
4k
Merge medio
1 d 14 h
PR fusionados (30 d)
37

Descripción

## 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).

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.