Skip to content

greenlet_spawn has not been called; can't call await_only() here. Was IO attempted in an unexpected place? (Background on this error at: https://sqlalche.me/e/20/xd2s) #1276

Closed

Description

@zakinabdul

Is your feature request related to a problem? Yes

I'm frustrated when trying to integrate the Google ADK DataBaseSessionServices with modern async Python web frameworks like FastAPI. The current session service implementations appear to be synchronous, which creates performance bottlenecks and blocking operations in async applications. This is particularly problematic when:

  • Building FastAPI applications that need to handle high concurrency
  • Integrating with async database operations using SQLAlchemy's async engine
  • Maintaining non-blocking I/O operations throughout the application stack
  • Scaling applications that require efficient resource utilization

I alway got this particular error while using DatabaseSessionService for Neon DB.
greenlet_spawn has not been called; can't call await_only() here. Was IO attempted in an unexpected place? (Background on this error at: https://sqlalche.me/e/20/xd2s)

My solution:

I would like to see an AsyncDatabaseSessionService added to the Google ADK session services that provides:

  1. Fully async/await compatible methods for all session operations:

    • async def create_session(...)
    • async def get_session(...)
    • async def list_sessions(...)
    • async def delete_session(...)
    • async def append_event(...)
  2. Native async database support using:

    • SQLAlchemy's create_async_engine and AsyncSession
    • Proper async context managers for database connections
    • Non-blocking database operations throughout
  3. Seamless FastAPI integration that allows developers to:

    • Use dependency injection with async session services
    • Maintain async context throughout request handling
    • Achieve optimal performance in high-concurrency scenarios
  4. Backward compatibility with existing session service interfaces while extending them for async operations

Additional context

Framework Compatibility: This enhancement would make Google ADK more compatible with the modern Python async ecosystem, including:

  • FastAPI
  • Starlette
  • aiohttp
  • async SQLAlchemy patterns

Activity

  1. added
    services[Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc
    on Jun 14, 2025
  2. self-assigned this
    on Jun 17, 2025
  3. added theissue type on Jul 2, 2025
  4. added this to the 08/11 FixIt Week milestone on Aug 8, 2025
  5. changed the issue type fromtoon Aug 14, 2025
  6. self-assigned this
    on Oct 8, 2025
  7. klateefa commented on Oct 8, 2025

    @klateefa

    Hi @zakisCodes and thanks to everyone who participated in this thread.

    We're currently doing some housekeeping on our issue tracker. Given the rapid pace of development and the number of updates since this was last active, there's a good chance this issue has been resolved in a newer version. To help us keep our backlog focused on current issues, we are closing this as stale.

    If you're still facing this problem, could you please update to the very latest version of the library and confirm the issue still exists? If it does, please comment here, and we will be happy to reopen this issue and investigate further.

    Thanks for your contribution and understanding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

services[Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions