Allowing custom events from tools. #1197
gundeep-dialpad
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
Does this feature request address your issue: #1099 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
Some tools can take a long time to complete execution.
It would be great if it's possible to generate intermediate events while the stages inside the tool complete.
Limitation of current adk version
So far, I looked a bit into the source code and found that we need reference to the runner to generate events (I might be wrong here). I haven't looked into the web socket connection yet, but currently, post endpoints interactions don't keep the reference to the runner.
Implementation idea
Each runner can be assigned a runner id and active runners can be saved into a global/singleton dict. Each tool, callback and other flow entrypoints can optionally get access to runner id using an annotation and thus choose to generate intermediate events.
Enabling other possibilities
Maybe runner id is not the only thing that tools, callbacks need; They can also make use of things like session id, so maybe tools, callbacks need a full context, which it currently don't have.
When tools have access to session id, it can access history.
Current workaround
I'm using an extra tool called
listen_to_results_until_tool_result_complete
which intercept model call usingbefore_model_call
callback.Here's the agent code: https://pastebin.com/P3YvU0hj
I'm thinking of converting this workaround into a more organized annotation based, but if something in the core source code and code flow can be updated, for example, using the suggested implementation idea, or some other more holistic/generic implementation, it would be much simpler.
Would like to hear your feedback and other implementation ideas or reasons why it's not a generic enough direction, and should be implemented more like a plugin.
Beta Was this translation helpful? Give feedback.
All reactions