Skip to main content

session_items

Creates, updates, deletes, gets or lists a session_items resource.

Overview​

Namesession_items
TypeResource
Iddatabricks_workspace.agentkit.session_items

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
item_idstringStable service-generated item ID.
create_timestring (date-time)Server-assigned time when the append commits. Values are nondecreasing within a session. Item listing orders by this timestamp; equal timestamps are resolved by committed append order.
dataobjectComplete SDK-native, JSON-compatible item. The service stores and returns this value without interpreting provider-specific fields such as ``type``, ``role``, or ``content``.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectsession_store_id, session_id, deployment_name, workspace_domainorder_by, page_size, page_tokenLists items in a session.
appendexecsession_store_id, session_id, deployment_name, workspace_domain, itemsAppends items to a session.
clearexecsession_store_id, session_id, deployment_name, workspace_domainClears all items from a session.
popexecsession_store_id, session_id, deployment_name, workspace_domainPops the newest item from a session.

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.

NameDatatypeDescription
deployment_namestringThe Databricks workspace deployment name: the host prefix of the workspace URL (dbc-abcd0123-a1bc on AWS, adb-1234567890123456.7 on Azure, 1234567890123456.7 on GCP). Set DATABRICKS_DEPLOYMENT_NAME to default it for the session. (default: dbc-abcd0123-a1bc, x-stackQL-envVar: DATABRICKS_DEPLOYMENT_NAME)
session_idstringThe session_id segment of the parent resource name (session-stores/{session_store_id}/sessions/{session_id}). Resource name of the containing session, in the form session-stores/{session_store_id}/sessions/{session_id}.
session_store_idstringThe session_store_id segment of the parent resource name (session-stores/{session_store_id}/sessions/{session_id}). Resource name of the containing session, in the form session-stores/{session_store_id}/sessions/{session_id}.
workspace_domainstringThe Databricks workspace domain suffix for the cloud. Selected by DATABRICKS_CLOUD (aws, azure or gcp; default aws). (default: cloud.databricks.com, x-stackQL-envVarSelector: {"envVar":"DATABRICKS_CLOUD","default":"aws","values":{"aws":"cloud.databricks.com","azure":"azuredatabricks.net","gcp":"gcp.databricks.com"}})
order_bystringSort order. Supported values are create_time asc and create_time desc. The default is create_time desc, which returns the most recently appended items first. Equal timestamps are resolved by committed append order in the requested direction.
page_sizeintegerMaximum number of items to return. Defaults to 10; must be between 1 and 100.
page_tokenstringToken returned by a previous list request.

SELECT examples​

Lists items in a session.

SELECT
item_id,
create_time,
data
FROM databricks_workspace.agentkit.session_items
WHERE session_store_id = '{{ session_store_id }}' -- required
AND session_id = '{{ session_id }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
AND workspace_domain = '{{ workspace_domain }}' -- required
AND order_by = '{{ order_by }}'
AND page_size = '{{ page_size }}'
AND page_token = '{{ page_token }}'
;

Lifecycle Methods​

Appends items to a session.

EXEC databricks_workspace.agentkit.session_items.append
@session_store_id='{{ session_store_id }}' --required,
@session_id='{{ session_id }}' --required,
@deployment_name='{{ deployment_name }}' --required,
@workspace_domain='{{ workspace_domain }}' --required
@@json=
'{
"items": "{{ items }}"
}'
;