runs
Creates, updates, deletes, gets or lists a runs resource.
Overview
| Name | runs |
| Type | Resource |
| Id | azure.ai_agents.runs |
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 | The ID of the agent associated with the thread this run was performed against. Required. |
thread_id | string | The ID of the thread associated with this run. Required. |
cancelled_at | string (date-time) | The Unix timestamp, in seconds, representing when this was cancelled. Required. |
completed_at | string (date-time) | The Unix timestamp, in seconds, representing when this completed. Required. |
created_at | string (date-time) | The Unix timestamp, in seconds, representing when this object was created. Required. |
expires_at | string (date-time) | The Unix timestamp, in seconds, representing when this item expires. Required. |
failed_at | string (date-time) | The Unix timestamp, in seconds, representing when this failed. Required. |
incomplete_details | object | Details on why the run is incomplete. Will be null if the run is not incomplete. Required. |
instructions | string | The overridden system instructions used for this agent thread run. Required. |
last_error | object | The last error, if any, encountered by this agent thread run. Required. |
max_completion_tokens | integer | The maximum number of completion tokens specified to have been used over the course of the run. Required. |
max_prompt_tokens | integer | The maximum number of prompt tokens specified to have been used over the course of the run. 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. |
model | string | The ID of the model to use. Required. |
object | string | The object type, which is always 'thread.run'. Required. Default value is "thread.run". |
parallel_tool_calls | boolean | Determines if tools can be executed in parallel within the run. Required. |
required_action | object | The details of the action required for the agent thread run to continue. |
response_format | object | The response format of the tool calls used in this run. Required. Is one of the following types: str, Union[str, "_models.AgentsResponseFormatMode"], AgentsResponseFormat, ResponseFormatJsonSchemaType |
started_at | string (date-time) | The Unix timestamp, in seconds, representing when this item was started. Required. |
status | string | The status of the agent thread run. Required. Known values are: "queued", "in_progress", "requires_action", "cancelling", "cancelled", "failed", "completed", and "expired". (queued, in_progress, requires_action, cancelling, cancelled, failed, completed, expired) |
temperature | number | The sampling temperature used for this run. If not set, defaults to 1. |
tool_choice | object | Controls whether or not and which tool is called by the model. Required. Is one of the following types: str, Union[str, "_models.AgentsToolChoiceOptionMode"], AgentsNamedToolChoice |
tool_resources | object | Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis. |
tools | array | The overridden enabled tools used for this agent thread run. Required. |
top_p | number | The nucleus sampling value used for this run. If not set, defaults to 1. |
truncation_strategy | object | The strategy to use for dropping messages as the context windows moves forward. Required. |
usage | object | Usage statistics related to the run. This value will be null if the run is not in a terminal state (i.e. in_progress, queued, etc.). Required. |
| Name | Datatype | Description |
|---|---|---|
id | string | The identifier, which can be referenced in API endpoints. Required. |
assistant_id | string | The ID of the agent associated with the thread this run was performed against. Required. |
thread_id | string | The ID of the thread associated with this run. Required. |
cancelled_at | string (date-time) | The Unix timestamp, in seconds, representing when this was cancelled. Required. |
completed_at | string (date-time) | The Unix timestamp, in seconds, representing when this completed. Required. |
created_at | string (date-time) | The Unix timestamp, in seconds, representing when this object was created. Required. |
expires_at | string (date-time) | The Unix timestamp, in seconds, representing when this item expires. Required. |
failed_at | string (date-time) | The Unix timestamp, in seconds, representing when this failed. Required. |
incomplete_details | object | Details on why the run is incomplete. Will be null if the run is not incomplete. Required. |
instructions | string | The overridden system instructions used for this agent thread run. Required. |
last_error | object | The last error, if any, encountered by this agent thread run. Required. |
max_completion_tokens | integer | The maximum number of completion tokens specified to have been used over the course of the run. Required. |
max_prompt_tokens | integer | The maximum number of prompt tokens specified to have been used over the course of the run. 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. |
model | string | The ID of the model to use. Required. |
object | string | The object type, which is always 'thread.run'. Required. Default value is "thread.run". |
parallel_tool_calls | boolean | Determines if tools can be executed in parallel within the run. Required. |
required_action | object | The details of the action required for the agent thread run to continue. |
response_format | object | The response format of the tool calls used in this run. Required. Is one of the following types: str, Union[str, "_models.AgentsResponseFormatMode"], AgentsResponseFormat, ResponseFormatJsonSchemaType |
started_at | string (date-time) | The Unix timestamp, in seconds, representing when this item was started. Required. |
status | string | The status of the agent thread run. Required. Known values are: "queued", "in_progress", "requires_action", "cancelling", "cancelled", "failed", "completed", and "expired". (queued, in_progress, requires_action, cancelling, cancelled, failed, completed, expired) |
temperature | number | The sampling temperature used for this run. If not set, defaults to 1. |
tool_choice | object | Controls whether or not and which tool is called by the model. Required. Is one of the following types: str, Union[str, "_models.AgentsToolChoiceOptionMode"], AgentsNamedToolChoice |
tool_resources | object | Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis. |
tools | array | The overridden enabled tools used for this agent thread run. Required. |
top_p | number | The nucleus sampling value used for this run. If not set, defaults to 1. |
truncation_strategy | object | The strategy to use for dropping messages as the context windows moves forward. Required. |
usage | object | Usage statistics related to the run. This value will be null if the run is not in a terminal state (i.e. in_progress, queued, etc.). Required. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | thread_id, run_id, endpoint | Gets an existing run from an existing thread. | |
list | select | thread_id, endpoint | limit, order, after, before | Gets a list of runs for a specified thread. |
create | insert | thread_id, endpoint | include[] | Creates a new run for an agent thread. |
update | exec | thread_id, run_id, endpoint | Modifies an existing thread run. | |
submit_tool_outputs | exec | thread_id, run_id, endpoint | Submits outputs from tools as requested by tool calls in a run. | |
cancel | exec | thread_id, run_id, endpoint | Cancels a run of an in‐progress 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: ) |
run_id | string | Identifier of the run. 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. |
include[] | array | A list of additional fields to include in the response. Currently the only supported value is step_details.tool_calls[*].file_search.results[*].content to fetch the file search result content. 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 an existing run from an existing thread.
SELECT
id,
assistant_id,
thread_id,
cancelled_at,
completed_at,
created_at,
expires_at,
failed_at,
incomplete_details,
instructions,
last_error,
max_completion_tokens,
max_prompt_tokens,
metadata,
model,
object,
parallel_tool_calls,
required_action,
response_format,
started_at,
status,
temperature,
tool_choice,
tool_resources,
tools,
top_p,
truncation_strategy,
usage
FROM azure.ai_agents.runs
WHERE thread_id = '{{ thread_id }}' -- required
AND run_id = '{{ run_id }}' -- required
AND endpoint = '{{ endpoint }}' -- required
;
Gets a list of runs for a specified thread.
SELECT
id,
assistant_id,
thread_id,
cancelled_at,
completed_at,
created_at,
expires_at,
failed_at,
incomplete_details,
instructions,
last_error,
max_completion_tokens,
max_prompt_tokens,
metadata,
model,
object,
parallel_tool_calls,
required_action,
response_format,
started_at,
status,
temperature,
tool_choice,
tool_resources,
tools,
top_p,
truncation_strategy,
usage
FROM azure.ai_agents.runs
WHERE thread_id = '{{ thread_id }}' -- required
AND endpoint = '{{ endpoint }}' -- required
AND limit = '{{ limit }}'
AND order = '{{ order }}'
AND after = '{{ after }}'
AND before = '{{ before }}'
;
INSERT examples
- create
- Manifest
Creates a new run for an agent thread.
INSERT INTO azure.ai_agents.runs (
thread_id,
endpoint,
include[]
)
SELECT
'{{ thread_id }}',
'{{ endpoint }}',
'{{ include[] }}'
RETURNING
id,
assistant_id,
thread_id,
cancelled_at,
completed_at,
created_at,
expires_at,
failed_at,
incomplete_details,
instructions,
last_error,
max_completion_tokens,
max_prompt_tokens,
metadata,
model,
object,
parallel_tool_calls,
required_action,
response_format,
started_at,
status,
temperature,
tool_choice,
tool_resources,
tools,
top_p,
truncation_strategy,
usage
;
# Description fields are for documentation purposes
- name: runs
props:
- name: thread_id
value: "{{ thread_id }}"
description: Required parameter for the runs resource.
- name: endpoint
value: "{{ endpoint }}"
description: Required parameter for the runs resource.
- name: include[]
value: "{{ include[] }}"
description: A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. Default value is None.
description: A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. Default value is None.
Lifecycle Methods
- update
- submit_tool_outputs
- cancel
Modifies an existing thread run.
EXEC azure.ai_agents.runs.update
@thread_id='{{ thread_id }}' --required,
@run_id='{{ run_id }}' --required,
@endpoint='{{ endpoint }}' --required
;
Submits outputs from tools as requested by tool calls in a run.
EXEC azure.ai_agents.runs.submit_tool_outputs
@thread_id='{{ thread_id }}' --required,
@run_id='{{ run_id }}' --required,
@endpoint='{{ endpoint }}' --required
;
Cancels a run of an in‐progress thread.
EXEC azure.ai_agents.runs.cancel
@thread_id='{{ thread_id }}' --required,
@run_id='{{ run_id }}' --required,
@endpoint='{{ endpoint }}' --required
;