session_items
Creates, updates, deletes, gets or lists a session_items resource.
Overview​
| Name | session_items |
| Type | Resource |
| Id | databricks_workspace.agentkit.session_items |
Fields​
The following fields are returned by SELECT queries:
- list
| Name | Datatype | Description |
|---|---|---|
item_id | string | Stable service-generated item ID. |
create_time | string (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. |
data | object | Complete 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:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | session_store_id, session_id, deployment_name, workspace_domain | order_by, page_size, page_token | Lists items in a session. |
append | exec | session_store_id, session_id, deployment_name, workspace_domain, items | Appends items to a session. | |
clear | exec | session_store_id, session_id, deployment_name, workspace_domain | Clears all items from a session. | |
pop | exec | session_store_id, session_id, deployment_name, workspace_domain | Pops 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.
| Name | Datatype | Description |
|---|---|---|
deployment_name | string | The 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_id | string | The 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_id | string | The 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_domain | string | The 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_by | string | Sort 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_size | integer | Maximum number of items to return. Defaults to 10; must be between 1 and 100. |
page_token | string | Token returned by a previous list request. |
SELECT examples​
- list
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​
- append
- clear
- pop
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 }}"
}'
;
Clears all items from a session.
EXEC databricks_workspace.agentkit.session_items.clear
@session_store_id='{{ session_store_id }}' --required,
@session_id='{{ session_id }}' --required,
@deployment_name='{{ deployment_name }}' --required,
@workspace_domain='{{ workspace_domain }}' --required
;
Pops the newest item from a session.
EXEC databricks_workspace.agentkit.session_items.pop
@session_store_id='{{ session_store_id }}' --required,
@session_id='{{ session_id }}' --required,
@deployment_name='{{ deployment_name }}' --required,
@workspace_domain='{{ workspace_domain }}' --required
;