VertexAiSessionService

A SessionService backed by the managed Vertex AI Session Service.

This is a Kotlin port of the Java ADK com.google.adk.sessions.VertexAiSessionService. It talks to the service through a VertexAiSessionsClient over a shared GoogleApiClient. The wire format (defined by session.proto) is modeled with a small set of @Serializable DTOs in the dto sub-package; this class only translates between those DTOs and the ADK domain types via the mapper extensions in com.google.adk.kt.sessions.dto.SessionMappers.

The reasoning engine is fixed at construction from project, location, and reasoningEngineId. Unlike the Python and Java ADK, the session key's SessionKey.appName is never parsed to derive the engine - it is only a label - so the engine must be supplied explicitly here.

Constructors

Link copied to clipboard
constructor(project: String, location: String, reasoningEngineId: String, credentials: GoogleCredentials = GoogleApiClient.defaultCredentials(), httpClient: HttpClient = HttpClient(Java), sessionTtl: Duration? = null)

Creates a service for reasoning engine reasoningEngineId under project and location.

Types

Link copied to clipboard
class Builder

Fluent builder for VertexAiSessionService, provided primarily for Java callers. Any property left unset falls back to the same default as the constructor.

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open suspend override fun appendEvent(session: Session, event: Event): Event

Appends an event to an in-memory session object and updates the session's state based on the event's state delta, if applicable.

Link copied to clipboard
open suspend fun closeSession(session: Session)

Closes a session.

Link copied to clipboard
open suspend override fun createSession(key: SessionKey, state: Map<String, Any>? = null): Session

Creates a new session with the specified parameters.

suspend fun createSession(key: SessionKey, state: Map<String, Any>? = null, ttl: Duration? = null, expireTime: Instant? = null): Session

Creates a session that expires, addressing the reasoning engine fixed at construction.

Link copied to clipboard
open suspend override fun deleteSession(key: SessionKey)

Deletes a specific session.

Link copied to clipboard
open suspend override fun getSession(key: SessionKey, config: GetSessionConfig? = null): Session?

Retrieves a specific session, optionally filtering the events included.

Link copied to clipboard
open suspend override fun listEvents(key: SessionKey): ListEventsResponse

Lists the events within a specific session.

Link copied to clipboard
open suspend override fun listSessions(appName: String, userId: String): ListSessionsResponse

Lists sessions associated with a specific application and user.