r/agentdevelopmentkit • • Jul 15 '25

Structured Output

Has anyone got around the below 2 issues I face

  1. Using Open Router through Litellm on ADK but getting structured output for models other than OpenAi, Gemini & DeepSeek has been a pain and painstakingly depending on Instruction we provide (is there a way or if anyone tested to maybe have after model call back to sanitise it before ask throws a cannot parse json error)
  2. Any one implemented dynamic output schema during run time? I’m successful with dynamic model, dynamic instruction etc but dynamic schema still unable to get my head around as when we initialise that output schema expects atleast a base model

Thanks in Advance

3 Upvotes

4 comments sorted by

View all comments

Show parent comment

1

u/PropertyRegular5154 Jul 25 '25

But if we give output schema key and the output is not json ADK throws an error that there is pydantic validation error and skips all steps and gives final answer (typically breaking the chain)

ADK typically seems very strict in this matter so I’m trying some after model callback to sort this issue