feat! Update session service interface to be async.

Also keep the sync version in the InMemorySessionService as create_session_sync() as a temporary migration option.

PiperOrigin-RevId: 759252188
This commit is contained in:
Google Team Member
2025-05-15 12:23:33 -07:00
committed by Copybara-Service
parent 5b3204c356
commit 1804ca39a6
23 changed files with 268 additions and 264 deletions

View File

@@ -47,11 +47,11 @@ class _TestingAgent(BaseAgent):
)
async def _create_parent_invocation_context(
def _create_parent_invocation_context(
test_name: str, agent: BaseAgent
) -> InvocationContext:
session_service = InMemorySessionService()
session = await session_service.create_session(
session = session_service.create_session(
app_name='test_app', user_id='test_user'
)
return InvocationContext(
@@ -76,7 +76,7 @@ async def test_run_async(request: pytest.FixtureRequest):
agent2,
],
)
parent_ctx = await _create_parent_invocation_context(
parent_ctx = _create_parent_invocation_context(
request.function.__name__, parallel_agent
)
events = [e async for e in parallel_agent.run_async(parent_ctx)]