Description
Describe the bug
When using ChatCompletionAgent instances as plugins with GoogleAIChatCompletion service, the application crashes with ValueError: Unknown field for Schema: anyOf during schema conversion from Semantic Kernel to Google AI's protobuf format.
To Reproduce
Steps to reproduce the behavior:
Create multiple ChatCompletionAgent instances using GoogleAIChatCompletion service
Add these agents as plugins to another ChatCompletionAgent using the plugins parameter
Call get_response() method on the parent agent with any message
See error: ValueError: Unknown field for Schema: anyOf
Minimal reproduction code:
pythonimport asyncio
from semantic_kernel.agents import ChatCompletionAgent
from semantic_kernel.connectors.ai.google.google_ai import GoogleAIChatCompletion
Initialize Google AI chat completion service
chat_completion = GoogleAIChatCompletion(
gemini_model_id="gemini-2.0-flash",
api_key="YOUR_API_KEY"
)
Create child agents
billing_agent = ChatCompletionAgent(
service=chat_completion,
name="BillingAgent",
instructions="You handle billing issues."
)
refund_agent = ChatCompletionAgent(
service=chat_completion,
name="RefundAgent",
instructions="Assist users with refund inquiries.",
)
Create parent agent with child agents as plugins
triage_agent = ChatCompletionAgent(
service=chat_completion,
name="TriageAgent",
instructions="Evaluate user requests and forward them to other agents.",
plugins=[billing_agent, refund_agent], # This causes the error
)
async def main():
# This call triggers the error
response = await triage_agent.get_response(
messages="test message",
thread=None,
)
asyncio.run(main())
Expected behavior
The triage agent should successfully process the user input and coordinate with the plugin agents to provide a response without any schema-related errors.
Screenshots
Full error traceback:
Traceback (most recent call last):
File "C:\gen-ai\agents_poc\semantic_kernel\venv\Lib\site-packages\proto\marshal\rules\message.py", line 36, in to_proto
return self._descriptor(**value)
~~~~~~~~~~~~~~~~^^^^^^^^^
TypeError: Parameter to CopyFrom() must be instance of same class: expected <class 'Schema'> got <class 'dict'>.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\gen-ai\agents_poc\semantic_kernel\venv\Lib\site-packages\proto\marshal\rules\message.py", line 36, in to_proto
return self._descriptor(**value)
~~~~~~~~~~~~~~~~^^^^^^^^^
ValueError: Protocol message Schema has no "anyOf" field.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "google_check3.py", line 69, in
asyncio.run(main())
ValueError: Unknown field for Schema: anyOf
Platform
Language: Python 3.13
Source: pip package (please run pip show semantic-kernel to get exact version)
AI model: Google AI Gemini 2.0 Flash
IDE: VS Code
OS: Windows
Additional context
This error occurs specifically when using the Google AI connector with agent plugins. The issue appears to be that Semantic Kernel generates JSON schemas containing "anyOf" fields, but Google AI's protobuf Schema definition doesn't support these fields.
The error occurs in the schema conversion process at:
File: google\generativeai\types\content_types.py
Function: FunctionDeclaration.init()
During: _rename_schema_fields() processing
This issue prevents using the agent plugin architecture with Google AI services, while other providers (OpenAI, Azure) may work correctly. A schema transformation layer or validation step may be needed to make Semantic Kernel compatible with Google AI's function declaration requirements.
Metadata
Metadata
Assignees
Type
Projects
Status