-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Describe the bug
When initializing ApplicationIntegrationToolset with Gmail connector actions, Pydantic 2.x validation fails with a schema type error, even when using only the most minimal GET operations (list messages, get message). The error indicates that the connector schema contains 'Any' type fields which are not valid JSON Schema types.
The issue appears to be at the connector initialization level rather than with specific actions, as even a single minimal action fails validation.
Error Message:
Input should be 'array', 'boolean', 'integer', 'null', 'number', 'object' or 'string' [type=literal_error, input_value='Any', input_type=str]
For further information visit https://errors.pydantic.dev/2.11/v/literal_error
type.list[literal['array','boolean','integer','null','number','object','string']]
Input should be a valid list [type=list_type, input_value='Any', input_type=str]
For further information visit https://errors.pydantic.dev/2.11/v/list_type
To Reproduce
Installation
pip install google-adk>=1.14.1 pydantic>=2.10 google-cloud-aiplatformMinimal Reproduction Code
import os
import google.auth
from google.adk.tools.application_integration_tool.application_integration_toolset import (
ApplicationIntegrationToolset,
)
# Setup
_, project_id = google.auth.default()
os.environ.setdefault("GOOGLE_CLOUD_PROJECT", project_id)
os.environ.setdefault("GOOGLE_CLOUD_LOCATION", "global")
os.environ.setdefault("GOOGLE_GENAI_USE_VERTEXAI", "True")
# Define minimal actions (only 2 basic GET operations)
MINIMAL_ACTIONS = [
"GET_gmail/v1/users/%7BuserId%7D/messages",
"GET_gmail/v1/users/%7BuserId%7D/messages/%7Bid%7D",
]
# Attempt to initialize toolset
try:
gmail_toolset = ApplicationIntegrationToolset(
project=project_id,
location="europe-west2",
connection="gmail-monitor-agent-integration", # Active Gmail connector
actions=MINIMAL_ACTIONS,
tool_instructions="Gmail assistant for user@example.com",
)
print("Success!")
except Exception as e:
print(f"Failed: {e}")Steps to Reproduce
- Create a Gmail connector in Google Cloud Console (Integration Connectors)
- Complete OAuth authorization for the connector (status: ACTIVE)
- Run the minimal reproduction code above
- Observe Pydantic validation error
Error Output
ValidationError: 2 validation errors for JSONSchemaObjectType
type.literal['array','boolean','integer','null','number','object','string']
Input should be 'array', 'boolean', 'integer', 'null', 'number', 'object' or 'string' [type=literal_error, input_value='Any', input_type=str]
For further information visit https://errors.pydantic.dev/2.11/v/literal_error
type.list[literal['array','boolean','integer','null','number','object','string']]
Input should be a valid list [type=list_type, input_value='Any', input_type=str]
For further information visit https://errors.pydantic.dev/2.11/v/list_type
Expected behavior
The ApplicationIntegrationToolset should successfully initialize with the minimal Gmail connector actions. These are basic GET operations with simple schemas and should not contain 'Any' type fields.
Expected outcome:
gmail_toolset = ApplicationIntegrationToolset(...) # Should succeed
print(type(gmail_toolset)) # <class '...ApplicationIntegrationToolset'>Actual behavior
Initialization fails with Pydantic validation error, suggesting the connector schema (either action schemas or connector metadata) contains 'Any' type fields that Pydantic 2.x rejects.
Desktop Information
- OS: macOS 25.0.0 (darwin)
- Python version: Python 3.11.x (will verify exact version)
- ADK version: 1.15.0
google-adk>=1.14.1 (need to run pip show google-adk for exact version) - Pydantic version:
pydantic>=2.10 (need to verify exact version)
Model Information
- Are you using LiteLLM: No
- Which model is being used: gemini-2.5-flash
- Integration: Vertex AI Agent Engine with Application Integration Connectors
Additional Context
Connector Configuration
- Connector Type: Gmail (from Integration Connectors catalog)
- Connector Status: ACTIVE
- Authentication: OAuth 2.0 (completed authorization flow)
- Location: europe-west2
- Project: vertex-ai-agents-473014
Troubleshooting Attempts
- Progressive Action Sets: Created minimal, basic, standard, and all action sets
- Fallback Strategy: Implemented automatic fallback from complex to simple action sets
- Single Action Test: Even a single GET action fails
- Package Upgrades: Tried upgrading google-adk, pydantic, google-cloud-aiplatform
Theories About Root Cause
- Connector Metadata Schema Issue: The connector's own metadata/configuration contains
'Any'type fields - Action Discovery:
ApplicationIntegrationToolsetmay be fetching and validating ALL available actions during initialization, regardless of which ones are specified - Schema Generation Bug: The connector schema generation process creates invalid JSON Schema with
'Any'types - Pydantic 2.x Strictness: Pydantic 2.x is more strict about JSON Schema validation than previous versions
Workaround Implemented
Created direct Gmail API tools that bypass the connector:
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
def list_messages(max_results: int = 10, query: str = None):
"""Direct Gmail API call - no connector."""
service = build('gmail', 'v1', credentials=creds)
results = service.users().messages().list(
userId='me',
maxResults=max_results,
q=query
).execute()
return resultsThis works reliably but loses the benefits of Application Integration Connectors.
Questions for Maintainers
- Does
ApplicationIntegrationToolsetfetch and validate ALL connector actions during init, even if only specific actions are provided? - Is there a way to skip schema validation or use a more lenient validator?
- Are there known issues with Gmail connector schema generation?
- Is this a Pydantic 2.x compatibility issue that needs ADK updates?
- Can we get the raw connector schema to identify which fields contain
'Any'?
Potential Fixes
- In ADK: Add schema sanitization to replace
'Any'with valid JSON Schema types - In Connectors: Fix schema generation to avoid
'Any'types - In ADK: Add option to skip strict schema validation for known-good actions
- Documentation: Document which connector actions have schema issues
Thank you for looking into this! The Application Integration Connectors are a great feature, but this schema validation issue is preventing adoption.