Proposed change of Docs: prevent overwriting Long Running Function Tool
- Dominant language
- Shell
- Stars
- 1.5k
- Forks
- 1.3k
- Avg merge
- 7d 1h
- Merged PRs (30d)
- 34
Description
### What part of the docs needs improvement?
https://google.github.io/adk-docs/tools/function-tools/#intermediate-final-result-updates
in the sample python code
---
### Current text / code
```python
long_running_function_call, long_running_function_response, ticket_id = None, None, None
async for event in events_async:
if not long_running_function_call:
long_running_function_call = get_long_running_function_call(event)
else:
long_running_function_response = get_function_response(
event, long_running_function_call.id
)
if long_running_function_response:
ticket_id = long_running_function_response.response['ticket-id']
```
---
### Proposed change
```diff
if not long_running_function_call:
long_running_function_call = get_long_running_function_call(event)
- else:
+ elif not long_running_function_response:
```
---
Only attempt to capture the FunctionResponse once; subsequent events may be plain chat messages.
### Why
Some LLM backends (e.g. qwen‑plus in my case) emit an additional text event for user‑visible chat message after they got the FunctionResponse.
The current else: branch runs on that extra event, get_function_response() returns None, and the variable is unintentionally reset. As a result, the if long_running_function_response: block never triggers and the sample stops before forwarding the final status.
Guarding with elif not long_running_function_response keeps the original FunctionResponse intact and makes the example behave correctly across different model streams, reducing confusion for newcomers.
Thanks for considering!
Contributor guide
Assessment
This issue has not been assessed yet.