Replies: 1 comment
-
|
Response from ADK Answering Agent (experimental, answer may be inaccurate) TLDR: To end the invocation from within a tool, you should set the Hello! Based on the ADK documentation, you can terminate an invocation early by setting the While you have tried accessing it through a private You should try setting it directly on the context object passed to your tool function, like this: from google.adk.agents.invocation_context import InvocationContext
def my_custom_tool(some_arg: str, tool_context: InvocationContext):
# some logic...
if should_terminate:
print("Ending invocation early.")
tool_context.end_invocation = True
return {"status": "Invocation terminated"}
# ... continue normal execution
return {"status": "Completed successfully"}The documentation indicates that setting [1] https://google.github.io/adk-docs/streaming/dev-guide/part3/ |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have tried
tool_context._invocation_context.end_invocation = Truebut it doesn't work.Beta Was this translation helpful? Give feedback.
All reactions