google / google/adk-python

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

Đang mở
#4,157 9 bình luận 2 reaction 1 người được giao Được giao cho @wyf7107 Xem trên GitHub
needs review tools
Ngôn ngữ chính
Python
Star
21.5k
Fork
4k
Merge trung bình
1 ngày 22 giờ
Pull request đã merge (30 ngày)
31

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.