messages
Creates, updates, deletes, gets or lists a messages resource.
Overview
| Name | messages |
| Type | Resource |
| Id | azure.ai_agents.messages |
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. |
assistant_id | string | If applicable, the ID of the agent that authored this message. Required. |
run_id | string | If applicable, the ID of the run associated with the authoring of this message. Required. |
thread_id | string | The ID of the thread that this message belongs to. Required. |
attachments | array | A list of files attached to the message, and the tools they were added to. Required. |
completed_at | string (date-time) | The Unix timestamp (in seconds) for when the message was completed. Required. |
content | array | The list of content items associated with the agent thread message. Required. |
created_at | string (date-time) | The Unix timestamp, in seconds, representing when this object was created. Required. |
incomplete_at | string (date-time) | The Unix timestamp (in seconds) for when the message was marked as incomplete. Required. |
incomplete_details | object | On an incomplete message, details about why the message is incomplete. 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.message'. Required. Default value is "thread.message". |
role | string | The role associated with the agent thread message. Required. Known values are: "user" and "assistant". (user, assistant) |
status | string | The status of the message. Required. Known values are: "in_progress", "incomplete", and "completed". (in_progress, incomplete, completed) |
| Name | Datatype | Description |
|---|---|---|
id | string | The identifier, which can be referenced in API endpoints. Required. |
assistant_id | string | If applicable, the ID of the agent that authored this message. Required. |
run_id | string | If applicable, the ID of the run associated with the authoring of this message. Required. |
thread_id | string | The ID of the thread that this message belongs to. Required. |
attachments | array | A list of files attached to the message, and the tools they were added to. Required. |
completed_at | string (date-time) | The Unix timestamp (in seconds) for when the message was completed. Required. |
content | array | The list of content items associated with the agent thread message. Required. |
created_at | string (date-time) | The Unix timestamp, in seconds, representing when this object was created. Required. |
incomplete_at | string (date-time) | The Unix timestamp (in seconds) for when the message was marked as incomplete. Required. |
incomplete_details | object | On an incomplete message, details about why the message is incomplete. 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.message'. Required. Default value is "thread.message". |
role | string | The role associated with the agent thread message. Required. Known values are: "user" and "assistant". (user, assistant) |
status | string | The status of the message. Required. Known values are: "in_progress", "incomplete", and "completed". (in_progress, incomplete, completed) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | thread_id, message_id, endpoint | Retrieves an existing message. | |
list | select | thread_id, endpoint | run_id, limit, order, after, before | Gets a list of messages that exist on a thread. |
create | insert | thread_id, endpoint | Creates a new message on a specified thread. | |
update | exec | thread_id, message_id, endpoint | Modifies an existing message on 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: ) |
message_id | string | Identifier of the message. Required. |
thread_id | string | Identifier of the thread. 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. |
run_id | string | Filter messages by the run ID that generated them. Default value is None. |
SELECT examples
- get
- list
Retrieves an existing message.
SELECT
id,
assistant_id,
run_id,
thread_id,
attachments,
completed_at,
content,
created_at,
incomplete_at,
incomplete_details,
metadata,
object,
role,
status
FROM azure.ai_agents.messages
WHERE thread_id = '{{ thread_id }}' -- required
AND message_id = '{{ message_id }}' -- required
AND endpoint = '{{ endpoint }}' -- required
;
Gets a list of messages that exist on a thread.
SELECT
id,
assistant_id,
run_id,
thread_id,
attachments,
completed_at,
content,
created_at,
incomplete_at,
incomplete_details,
metadata,
object,
role,
status
FROM azure.ai_agents.messages
WHERE thread_id = '{{ thread_id }}' -- required
AND endpoint = '{{ endpoint }}' -- required
AND run_id = '{{ run_id }}'
AND limit = '{{ limit }}'
AND order = '{{ order }}'
AND after = '{{ after }}'
AND before = '{{ before }}'
;
INSERT examples
- create
- Manifest
Creates a new message on a specified thread.
INSERT INTO azure.ai_agents.messages (
thread_id,
endpoint
)
SELECT
'{{ thread_id }}',
'{{ endpoint }}'
RETURNING
id,
assistant_id,
run_id,
thread_id,
attachments,
completed_at,
content,
created_at,
incomplete_at,
incomplete_details,
metadata,
object,
role,
status
;
# Description fields are for documentation purposes
- name: messages
props:
- name: thread_id
value: "{{ thread_id }}"
description: Required parameter for the messages resource.
- name: endpoint
value: "{{ endpoint }}"
description: Required parameter for the messages resource.
Lifecycle Methods
- update
Modifies an existing message on an existing thread.
EXEC azure.ai_agents.messages.update
@thread_id='{{ thread_id }}' --required,
@message_id='{{ message_id }}' --required,
@endpoint='{{ endpoint }}' --required
;