Skip to content

feat: Support output schema with tools for LlmAgent#603

Open
jinnigu wants to merge 1 commit intogoogle:mainfrom
jinnigu:feature/support-output-schema
Open

feat: Support output schema with tools for LlmAgent#603
jinnigu wants to merge 1 commit intogoogle:mainfrom
jinnigu:feature/support-output-schema

Conversation

@jinnigu
Copy link
Contributor

@jinnigu jinnigu commented Nov 21, 2025

Fixes #587

Summary

Adds support for using both output_schema and tools simultaneously in Java ADK. Previously, LlmAgent threw an error when both were configured together. This feature enables structured output alongside tool usage by automatically injecting a special SetModelResponseTool.

Changes

Core Implementation

  • A new tool SetModelResponseTool
  • LlmAgent injects SetModelResponseTool when output_schema and tools are both present
  • Basic.java sets output_schema only when toolsUnion is empty
  • Removed validation error which prevented output_schema and tools combination

This achieves parity with Python ADK: feat: Support both output_schema and tools at the same time in LlmAgent adk-python@af63567

Testing

  • Added 4 unit tests for SetModelResponseTool
  • Updated LlmAgentTest to verify SetModelResponseTool injection
  • All tests pass

@jinnigu jinnigu marked this pull request as ready for review November 21, 2025 07:06
glaforge added a commit to glaforge/adk-java that referenced this pull request Mar 23, 2026
…already implemented, but adding tests from PR google#603)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

adk-python parity: support output schema with tools for LlmAgent

1 participant