Skip to content

fix: add missing await to create_session calls in callback examples#1976

Merged
koverholt merged 2 commits into
google:mainfrom
Syed-Umer-Ali:fix/missing-await-create_session-callbacks
Jul 20, 2026
Merged

fix: add missing await to create_session calls in callback examples#1976
koverholt merged 2 commits into
google:mainfrom
Syed-Umer-Ali:fix/missing-await-create_session-callbacks

Conversation

@Syed-Umer-Ali

Copy link
Copy Markdown
Contributor

InMemorySessionService.create_session is async def, but the before_agent_callback.py and after_agent_callback.py examples call it without await. This returns an unawaited coroutine — the session is never created, and subsequent runner.run_async() fails with SessionNotFoundError.
Fixed by adding await to both create_session calls in both files.

InMemorySessionService.create_session is async, so calls without await
return unawaited coroutines and the sessions are never created, causing
SessionNotFoundError on subsequent runner.run_async() calls.
@netlify

netlify Bot commented Jul 18, 2026

Copy link
Copy Markdown

Deploy Preview for adk-docs-preview ready!

Name Link
🔨 Latest commit 0826f72
🔍 Latest deploy log https://app.netlify.com/projects/adk-docs-preview/deploys/6a5e8e1e1d8b4f0009299d23
😎 Deploy Preview https://deploy-preview-1976--adk-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@google-cla

google-cla Bot commented Jul 18, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@koverholt koverholt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks for contributing this fix, which would cause a SessionNotFoundError. I verified the fix against the latest ADK Python SDK. LGTM, merging!

@Syed-Umer-Ali
Syed-Umer-Ali requested a review from koverholt July 20, 2026 21:25
@koverholt
koverholt merged commit cd7b193 into google:main Jul 20, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants