We have a production backend on Vertex AI + ADK with two agents:
-
a main reply agent
-
a memory agent
Both agents have their own instructions and are expected to return strict backend-owned JSON contracts.
We recently switched our runtime path so that reply and memory tasks go through the ADK / Reasoning Engine agent runtime path instead of a direct structured Gemini call.
After that switch, the agent runtime starts correctly, but the request fails inside the remote ADK runtime when structured-output parameters are involved.
What we want
We want to use:
-
the agent’s own instruction/runtime path
-
plus strict JSON output for backend contracts
In other words:
-
agent behavior must come from ADK agent instructions
-
backend still needs strict JSON output (
reply_text + system_payloadfor reply, typed JSON for memory tasks)
Observed behavior
The request reaches Reasoning Engine successfully:
-
VERTEX_AGENT_INVOCATION_START -
QueryReasoningEngine -
CreateSession -
StreamQueryReasoningEngine
Then the remote runtime fails with:
TypeError: Runner.run_async() got an unexpected keyword argument 'response_mime_type'
After that, backend-side structured extraction fails with:
Vertex structured output extraction contract violation: no valid candidate
Relevant log excerpt
VERTEX_AGENT_INVOCATION_START
QueryReasoningEngine
CreateSession
VERTEX_AGENT_STREAM_QUERY_START
StreamQueryReasoningEngine
ERROR: Runner.run_async() got an unexpected keyword argument 'response_mime_type'
VERTEX_AGENT_INVOCATION_ERROR
Exception: Vertex structured output extraction contract violation: no valid candidate
LLM_TASK_FAILED
task=reply
provider=vertex
error_type=invalid_output
reply_path=agent_runtime
execution_path=agent_runtime
Important context
Before this change, the same task worked through a direct structured Gemini path:
-
direct
GenerateContent -
response_mime_type="application/json" -
response_schema -
strict backend validation succeeded
That path produced valid JSON, but it bypassed the ADK agent instruction contour, which is not acceptable for our use case.
Now we have the opposite:
-
ADK agent runtime is active
-
but strict structured output fails inside the ADK / Reasoning Engine stream path
Question
What is the correct supported way to combine:
-
ADK / Reasoning Engine agent runtime path
-
agent-owned instructions / role behavior
-
strict JSON output contract for backend integration
Specifically:
-
Is
stream_queryexpected to support structured output in this setup? -
Is
response_mime_type/ schema supposed to be passed through the transport layer at all? -
Should this be done only inside the deployed ADK agent runtime?
-
Is non-streaming
querythe only supported option for strict structured JSON with ADK agents? -
If supported, what is the correct pattern for enforcing a typed JSON contract from an ADK agent without bypassing the agent contour?
Environment
-
Vertex AI Reasoning Engine / ADK runtime
-
Python backend calling remote agent runtime
-
Gemini model behind Vertex
-
strict backend-owned JSON contracts
-
no tool side effects inside the agent
-
side effects remain in backend only
Why this matters
This is not just about formatting.
We need both:
-
instruction-owned agent behavior
-
strict machine-valid JSON output for backend orchestration
Right now we can get either:
-
correct JSON through direct Gemini structured path
-
or agent runtime behavior through ADK path
But not both together reliably.
If needed, I can provide:
-
a minimal reproduction
-
the relevant provider code path
-
the exact payload shape used before and after the runtime switch
-
full logs