GoogleCloudPlatform / GoogleCloudPlatform/generative-ai

[Bug]: Evaluating ADK notebook

Open
#2,103 0 comments 0 reactions 1 assignee Claimed by @inardini View on GitHub
Dominant language
Jupyter Notebook
Stars
17.7k
Forks
4.5k
Avg merge
12h 38m
Merged PRs (30d)
42

Description

### File Name

gemini/getting-started/evaluating_adk_agent.ipynb

### What happened?

When using InMemorySessionService and calling Runner.run(...), the session previously created via create_session(...) is not recognized, resulting in a ValueError: Session not found. This happens because Runner.run() internally spawns a new thread and runs the async flow using asyncio.run(...), which does not share the in-memory session state across threads. As a result, the session appears to be missing even though it was just created.

### Relevant log output

```shell
Exception in thread Thread-25 (_asyncio_thread_main):
Traceback (most recent call last):
File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.10/dist-packages/google/adk/runners.py", line 138, in _asyncio_thread_main
asyncio.run(_invoke_run_async())
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/usr/local/lib/python3.10/dist-packages/google/adk/runners.py", line 126, in _invoke_run_async
async for event in self.run_async(
File "/usr/local/lib/python3.10/dist-packages/google/adk/runners.py", line 179, in run_async
raise ValueError(f'Session not found: {session_id}')
ValueError: Session not found: session_one
```

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.