Environment
- SDK version: 0.1.9
- Python version: 3.10.20
- OS / platform: macOS ARM64 (darwin)
- Install method:
pip install google-antigravity
Description
FunctionDeclaration.from_callable_with_api_option(...) emits JSON Schema with uppercase enum values for type fields ("OBJECT", "STRING", etc.). OpenAI-compatible endpoints require lowercase ("object", "string"). This breaks all custom Python tools when using LocalOpenAIAgentConfig with an OpenAI-compatible local server (Ollama, LM Studio, etc.).
Steps to Reproduce
- Install
google-antigravity via pip.
- Run a local OpenAI-compatible server, e.g. LM Studio at
http://127.0.0.1:1234.
- Create a simple custom tool:
def get_temperature(location: str) -> str:
return f"The temperature in {location} is 72°F."
- Configure the agent:
config = LocalOpenAIAgentConfig(
model="google/gemma-4-e2b",
base_url="http://127.0.0.1:1234",
tools=[get_temperature],
)
- Send a prompt that triggers the tool:
"What's the temperature in Mountain View?"
Expected Behavior
The agent calls get_temperature with {"location": "Mountain View"} and returns the result.
Actual Behavior
The local LLM server returns HTTP 400:
{
"error": [
{
"code": "invalid_union_discriminator",
"options": ["object"],
"path": [2, "function", "parameters", "type"],
"message": "Invalid discriminator value. Expected 'object'"
}
]
}
The SDK then surfaces: model output error: model output must contain either output text or tool calls, these cannot both be empty, please try again
Additional Context
- The broken schema originates in
google/antigravity/connections/local/local_connection.py:199-213 (callable_to_tool_proto).
decl.parameters.model_dump(exclude_none=True) preserves genai_types.Type enum values as uppercase strings.
- Workaround: wrap tools in
ToolWithSchema with an explicit lowercase JSON Schema.
- Local patch applied in source tree: recursive
_normalize_schema_types() converts genai_types.Type values to lowercase before json.dumps().
Environment
pip install google-antigravityDescription
FunctionDeclaration.from_callable_with_api_option(...)emits JSON Schema with uppercase enum values for type fields ("OBJECT","STRING", etc.). OpenAI-compatible endpoints require lowercase ("object","string"). This breaks all custom Python tools when usingLocalOpenAIAgentConfigwith an OpenAI-compatible local server (Ollama, LM Studio, etc.).Steps to Reproduce
google-antigravityvia pip.http://127.0.0.1:1234."What's the temperature in Mountain View?"Expected Behavior
The agent calls
get_temperaturewith{"location": "Mountain View"}and returns the result.Actual Behavior
The local LLM server returns HTTP 400:
{ "error": [ { "code": "invalid_union_discriminator", "options": ["object"], "path": [2, "function", "parameters", "type"], "message": "Invalid discriminator value. Expected 'object'" } ] }The SDK then surfaces:
model output error: model output must contain either output text or tool calls, these cannot both be empty, please try againAdditional Context
google/antigravity/connections/local/local_connection.py:199-213(callable_to_tool_proto).decl.parameters.model_dump(exclude_none=True)preservesgenai_types.Typeenum values as uppercase strings.ToolWithSchemawith an explicit lowercase JSON Schema._normalize_schema_types()convertsgenai_types.Typevalues to lowercase beforejson.dumps().