threads
Creates, updates, deletes, gets or lists a threads resource.
Overview
| Name | threads |
| Type | Resource |
| Id | azure.ai_agents.threads |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
id | string | The identifier, which can be referenced in API endpoints. Required. |
created_at | string (date-time) | The Unix timestamp, in seconds, representing when this object was created. Required. |
metadata | object | A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. Required. |
object | string | The object type, which is always 'thread'. Required. Default value is "thread". |
tool_resources | object | A set of resources that are made available to the agent's tools in this thread. The resources are specific to the type of tool. For example, the code_interpreter tool requires a list of file IDs, while the file_search tool requires a list of vector store IDs. Required. |
| Name | Datatype | Description |
|---|---|---|
id | string | The identifier, which can be referenced in API endpoints. Required. |
created_at | string (date-time) | The Unix timestamp, in seconds, representing when this object was created. Required. |
metadata | object | A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. Required. |
object | string | The object type, which is always 'thread'. Required. Default value is "thread". |
tool_resources | object | A set of resources that are made available to the agent's tools in this thread. The resources are specific to the type of tool. For example, the code_interpreter tool requires a list of file IDs, while the file_search tool requires a list of vector store IDs. Required. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | thread_id, endpoint | Gets information about an existing thread. | |
list | select | endpoint | limit, order, after, before | Gets a list of threads that were previously created. |
create | insert | endpoint | Creates a new thread. Threads contain messages and can be run by agents. | |
update | exec | thread_id, endpoint | Modifies an existing thread. |
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 |
|---|---|---|
endpoint | string | The service endpoint host (no scheme), e.g. myaccount.table.cosmos.azure.com:443 - value of the client endpoint parameter. (default: ) |
thread_id | string | The ID of the thread to modify. Required. |
after | string | |
before | string | A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. Default value is None. |
limit | integer | A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None. |
order | string | Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Known values are: "asc" and "desc". Default value is None. |
SELECT examples
- get
- list
Gets information about an existing thread.
SELECT
id,
created_at,
metadata,
object,
tool_resources
FROM azure.ai_agents.threads
WHERE thread_id = '{{ thread_id }}' -- required
AND endpoint = '{{ endpoint }}' -- required
;
Gets a list of threads that were previously created.
SELECT
id,
created_at,
metadata,
object,
tool_resources
FROM azure.ai_agents.threads
WHERE endpoint = '{{ endpoint }}' -- required
AND limit = '{{ limit }}'
AND order = '{{ order }}'
AND after = '{{ after }}'
AND before = '{{ before }}'
;
INSERT examples
- create
- Manifest
Creates a new thread. Threads contain messages and can be run by agents.
INSERT INTO azure.ai_agents.threads (
endpoint
)
SELECT
'{{ endpoint }}'
RETURNING
id,
created_at,
metadata,
object,
tool_resources
;
# Description fields are for documentation purposes
- name: threads
props:
- name: endpoint
value: "{{ endpoint }}"
description: Required parameter for the threads resource.
Lifecycle Methods
- update
Modifies an existing thread.
EXEC azure.ai_agents.threads.update
@thread_id='{{ thread_id }}' --required,
@endpoint='{{ endpoint }}' --required
;