sessions
Creates, updates, deletes, gets or lists a sessions resource.
Overview
| Name | sessions |
| Type | Resource |
| Id | google.aiplatform.sessions |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
name | string | Identifier. The resource name of the session. Format: 'projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}'. |
createTime | string (google-datetime) | Output only. Timestamp when the session was created. |
displayName | string | Optional. The display name of the session. |
expireTime | string (google-datetime) | Optional. Timestamp of when this session is considered expired. This is always provided on output, regardless of what was sent on input. The minimum value is 24 hours from the time of creation. |
labels | object | The labels with user-defined metadata to organize your Sessions. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. See https://goo.gl/xmQnxf for more information and examples of labels. |
sessionState | object | Optional. Session specific memory which stores key conversation points. |
ttl | string (google-duration) | Optional. Input only. The TTL for this session. The minimum value is 24 hours. |
updateTime | string (google-datetime) | Output only. Timestamp when the session was updated. |
userId | string | Required. Immutable. String id provided by the user |
| Name | Datatype | Description |
|---|---|---|
name | string | Identifier. The resource name of the session. Format: 'projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}'. |
createTime | string (google-datetime) | Output only. Timestamp when the session was created. |
displayName | string | Optional. The display name of the session. |
expireTime | string (google-datetime) | Optional. Timestamp of when this session is considered expired. This is always provided on output, regardless of what was sent on input. The minimum value is 24 hours from the time of creation. |
labels | object | The labels with user-defined metadata to organize your Sessions. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. See https://goo.gl/xmQnxf for more information and examples of labels. |
sessionState | object | Optional. Session specific memory which stores key conversation points. |
ttl | string (google-duration) | Optional. Input only. The TTL for this session. The minimum value is 24 hours. |
updateTime | string (google-datetime) | Output only. Timestamp when the session was updated. |
userId | string | Required. Immutable. String id provided by the user |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | projectsId, locationsId, reasoningEnginesId, sessionsId | Gets details of the specific Session. | |
list | select | projectsId, locationsId, reasoningEnginesId | filter, orderBy, pageSize, pageToken | Lists Sessions in a given reasoning engine. |
create | insert | projectsId, locationsId, reasoningEnginesId | sessionId | Creates a new Session. |
patch | update | projectsId, locationsId, reasoningEnginesId, sessionsId | updateMask | Updates the specific Session. |
delete | delete | projectsId, locationsId, reasoningEnginesId, sessionsId | Deletes details of the specific Session. | |
append_event | exec | projectsId, locationsId, reasoningEnginesId, sessionsId | Appends an event to a given session. | |
compact | exec | projectsId, locationsId, reasoningEnginesId, sessionsId | Compacts the event history of a given Session, which may run an LLM summarization call and rewrite the full event history. Compaction is a storage-side rewrite that can apply a stackable pipeline of rules (event-horizon preservation, tool-response truncation, thought stripping, and LLM summarization etc.) |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
locationsId | string | |
projectsId | string | |
reasoningEnginesId | string | |
sessionsId | string | |
filter | string | |
orderBy | string | |
pageSize | integer (int32) | |
pageToken | string | |
sessionId | string | |
updateMask | string (google-fieldmask) |
SELECT examples
- get
- list
Gets details of the specific Session.
SELECT
name,
createTime,
displayName,
expireTime,
labels,
sessionState,
ttl,
updateTime,
userId
FROM google.aiplatform.sessions
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND reasoningEnginesId = '{{ reasoningEnginesId }}' -- required
AND sessionsId = '{{ sessionsId }}' -- required
;
Lists Sessions in a given reasoning engine.
SELECT
name,
createTime,
displayName,
expireTime,
labels,
sessionState,
ttl,
updateTime,
userId
FROM google.aiplatform.sessions
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND reasoningEnginesId = '{{ reasoningEnginesId }}' -- required
AND filter = '{{ filter }}'
AND orderBy = '{{ orderBy }}'
AND pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}'
;
INSERT examples
- create
- Manifest
Creates a new Session.
INSERT INTO google.aiplatform.sessions (
data__displayName,
data__expireTime,
data__labels,
data__name,
data__sessionState,
data__ttl,
data__userId,
projectsId,
locationsId,
reasoningEnginesId,
sessionId
)
SELECT
'{{ displayName }}',
'{{ expireTime }}',
'{{ labels }}',
'{{ name }}',
'{{ sessionState }}',
'{{ ttl }}',
'{{ userId }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ reasoningEnginesId }}',
'{{ sessionId }}'
RETURNING
name,
done,
error,
metadata,
response
;
# Description fields are for documentation purposes
- name: sessions
props:
- name: projectsId
value: "{{ projectsId }}"
description: Required parameter for the sessions resource.
- name: locationsId
value: "{{ locationsId }}"
description: Required parameter for the sessions resource.
- name: reasoningEnginesId
value: "{{ reasoningEnginesId }}"
description: Required parameter for the sessions resource.
- name: displayName
value: "{{ displayName }}"
description: |
Optional. The display name of the session.
- name: expireTime
value: "{{ expireTime }}"
description: |
Optional. Timestamp of when this session is considered expired. This is *always* provided on output, regardless of what was sent on input. The minimum value is 24 hours from the time of creation.
- name: labels
value: "{{ labels }}"
description: |
The labels with user-defined metadata to organize your Sessions. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. See https://goo.gl/xmQnxf for more information and examples of labels.
- name: name
value: "{{ name }}"
description: |
Identifier. The resource name of the session. Format: 'projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}'.
- name: sessionState
value: "{{ sessionState }}"
description: |
Optional. Session specific memory which stores key conversation points.
- name: ttl
value: "{{ ttl }}"
description: |
Optional. Input only. The TTL for this session. The minimum value is 24 hours.
- name: userId
value: "{{ userId }}"
description: |
Required. Immutable. String id provided by the user
- name: sessionId
value: "{{ sessionId }}"
UPDATE examples
- patch
Updates the specific Session.
UPDATE google.aiplatform.sessions
SET
data__displayName = '{{ displayName }}',
data__expireTime = '{{ expireTime }}',
data__labels = '{{ labels }}',
data__name = '{{ name }}',
data__sessionState = '{{ sessionState }}',
data__ttl = '{{ ttl }}',
data__userId = '{{ userId }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND reasoningEnginesId = '{{ reasoningEnginesId }}' --required
AND sessionsId = '{{ sessionsId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
createTime,
displayName,
expireTime,
labels,
sessionState,
ttl,
updateTime,
userId;
DELETE examples
- delete
Deletes details of the specific Session.
DELETE FROM google.aiplatform.sessions
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND reasoningEnginesId = '{{ reasoningEnginesId }}' --required
AND sessionsId = '{{ sessionsId }}' --required
;
Lifecycle Methods
- append_event
- compact
Appends an event to a given session.
EXEC google.aiplatform.sessions.append_event
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@reasoningEnginesId='{{ reasoningEnginesId }}' --required,
@sessionsId='{{ sessionsId }}' --required
@@json=
'{
"actions": "{{ actions }}",
"author": "{{ author }}",
"content": "{{ content }}",
"errorCode": "{{ errorCode }}",
"errorMessage": "{{ errorMessage }}",
"eventMetadata": "{{ eventMetadata }}",
"invocationId": "{{ invocationId }}",
"name": "{{ name }}",
"rawEvent": "{{ rawEvent }}",
"timestamp": "{{ timestamp }}"
}'
;
Compacts the event history of a given Session, which may run an LLM summarization call and rewrite the full event history. Compaction is a storage-side rewrite that can apply a stackable pipeline of rules (event-horizon preservation, tool-response truncation, thought stripping, and LLM summarization etc.)
EXEC google.aiplatform.sessions.compact
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@reasoningEnginesId='{{ reasoningEnginesId }}' --required,
@sessionsId='{{ sessionsId }}' --required
@@json=
'{
"compaction": "{{ compaction }}"
}'
;