8000 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) · Issue #1276 · google/adk-python · GitHub
[go: up one dir, main page]

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
Open
@ZakisCodes

Description

@ZakisCodes

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0