Skip to content

fix(agent): hoist structured output defs to tool root#1205

Open
Alexxigang wants to merge 1 commit intoagentscope-ai:mainfrom
Alexxigang:fix/structured-output-root-defs
Open

fix(agent): hoist structured output defs to tool root#1205
Alexxigang wants to merge 1 commit intoagentscope-ai:mainfrom
Alexxigang:fix/structured-output-root-defs

Conversation

@Alexxigang
Copy link
Copy Markdown
Contributor

Summary

  • hoist nested $defs and legacy definitions to the generated generate_response tool schema root
  • reuse the same schema normalization path for structured output wrapping and regular tool schema generation
  • add regression coverage for nested dynamic JSON schemas, validation behavior, and input-schema immutability

Root cause

StructuredOutputCapableAgent wraps the response schema under a top-level response property when it registers the temporary generate_response tool. When the wrapped schema contains nested $ref values like #/$defs/Material, those references resolve from the tool schema document root, but the definitions were still nested under properties.response. That makes validation fail for multi-level structured output schemas.

Validation

  • mvn -pl agentscope-core '-Dtest=JsonSchemaUtilsTest,StructuredOutputDynamicDefineTest,ToolValidatorTest' test -q
  • mvn -pl agentscope-core '-Dtest=JsonSchemaUtilsTest,StructuredOutputDynamicDefineTest,ToolValidatorTest,ReActAgentStructuredOutputTest,StructuredOutputHookTest' test -q
  • mvn -pl agentscope-core spotless:check -q

@Alexxigang Alexxigang force-pushed the fix/structured-output-root-defs branch from 72cf837 to 088debf Compare April 13, 2026 15:18
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.

1 participant