Skip to content

Instantly share code, notes, and snippets.

@yoyu777
Last active December 5, 2025 09:30
Show Gist options
  • Select an option

  • Save yoyu777/f4a7227d16abe1b7a9e8cd9275c7f1a0 to your computer and use it in GitHub Desktop.

Select an option

Save yoyu777/f4a7227d16abe1b7a9e8cd9275c7f1a0 to your computer and use it in GitHub Desktop.
Task 3.2: Create the validation session
# We will use the InMemorySessionService for this session
# It means the session data only lives in the computer's memory
# while the program is running.
from google.adk.sessions import InMemorySessionService
session_service = InMemorySessionService()
app_name = "ValidationAgent"
user_id="test_user"
async def create_validation_session():
# Create a session
# `create_session` is an asynchronous function,
# therefore, must be awaited
validation_session = await session_service.create_session(
app_name=app_name,
user_id=user_id
)
return validation_session
# Await the creation of the session properly
# Since this is top-level code, we use asyncio.run to execute the async function
validation_session = asyncio.run(create_validation_session())
display("Validation session initialised")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment