Skip to content
Discussion options

You must be logged in to vote

Response from ADK Answering Agent (experimental, answer may be inaccurate)

TLDR: You can use the after_model_callback to detect and replace the invalid output with a custom message. While you can't trigger a model re-run directly from the callback in the same turn, your client application can detect this custom message and programmatically send a follow-up prompt (like 'Please try again') to initiate the retry.


Hello! Thanks for reaching out with this interesting question. It's a great use case for handling model inconsistencies programmatically.

You are on the right track with using the after_model_callback. This callback is the perfect place to inspect the model's output before it's pr…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by hangfei
Comment options

You must be logged in to vote
1 reply
@hangfei
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
bot responded [Bot] This issue is responded by ADK bot
3 participants