Replies: 3 comments
|
From the docs/samples, new_message = types.Content(
role="user",
parts=[types.Part(function_response=types.FunctionResponse(
id=original_function_call.id,
name=original_function_call.name,
response={"status": "completed", "result": result},
))],
)
async for event in runner.run_async(
user_id=user_id,
session_id=session_id,
invocation_id=paused_invocation_id,
new_message=new_message,
):
...The |
|
@barry166 The flow should be as follows: Tool call -----> return pre-response ---> long running ---> (tool completed) ---> how to know user ?? ---> user(or FE) or any outside of runner --> send Function Response to run_async as new message. When Alternatively, when injecting a function response via there were occasional instances where a message indicating that the previous tool had terminated was displayed to the agent, even though the user had connected to the agent with a new request. (This was not always the case; the termination of many past tools was ignored.) In that case, should LongRunningTools, excluding HITL, remain in a waiting state for an extended period? (Can't they perform BG jobs?) Should they be prevented from receiving additional user input while waiting for the tool's final result? |
|
The missing piece is an application-level job channel. For the flow you described, I would structure it like this:
The user therefore learns that the job finished from your application channel; ADK learns it finished only from the matching If the user must keep chatting while the job runs, avoid concurrently appending a completion and an unrelated user turn to the same session history. Serialize runner writes per session (an async lock/queue is enough for one process), or put the background task in a child/separate session and post a notification/result back to the conversational session when it is idle. Otherwise an old completion can be consumed during a newer turn, which matches the intermittent behavior you saw. Also make completion idempotent: persist a If the final result does not need another model turn, you can notify the frontend directly and store the result without resuming the agent. Resume with This is consistent with ADK's guidance for long monitoring jobs: keep the persistent worker outside the agent session and initiate/resume an ADK run when there is something to deliver: #2426 |
Uh oh!
There was an error while loading. Please reload this page.
It's not "HITL."
the tool has a long execution time, so when the user has to wait,
I wonder how to turn the user so that user can ask the next question without blocking(waiting).
and
when the tool is completed, it should be able to inform the user.
The example mentions only a case for HITL.
HITL injects new_message from outside back to Agent.
but. I want to know it without user input(like approval)
https://github.com/google/adk-python/tree/main/contributing/samples/tools/long_running_functions
I am curious about the process from start to in-progress to complete ( not HITL ).
how agent know tool is completed. and how to get result of tool?
All reactions