# Workflows.Executions ## Overview ### Available Operations * [get_workflow_execution](#get_workflow_execution) - Get Workflow Execution * [get_workflow_execution_history](#get_workflow_execution_history) - Get Workflow Execution History * [signal_workflow_execution](#signal_workflow_execution) - Signal Workflow Execution * [query_workflow_execution](#query_workflow_execution) - Query Workflow Execution * [terminate_workflow_execution](#terminate_workflow_execution) - Terminate Workflow Execution * [batch_terminate_workflow_executions](#batch_terminate_workflow_executions) - Batch Terminate Workflow Executions * [cancel_workflow_execution](#cancel_workflow_execution) - Cancel Workflow Execution * [batch_cancel_workflow_executions](#batch_cancel_workflow_executions) - Batch Cancel Workflow Executions * [reset_workflow](#reset_workflow) - Reset Workflow * [update_workflow_execution](#update_workflow_execution) - Update Workflow Execution * [get_workflow_execution_trace_info](#get_workflow_execution_trace_info) - Get Workflow Execution Trace Info * [get_workflow_execution_trace_otel](#get_workflow_execution_trace_otel) - Get Workflow Execution Trace Otel * [get_workflow_execution_trace_summary](#get_workflow_execution_trace_summary) - Get Workflow Execution Trace Summary * [get_workflow_execution_trace_events](#get_workflow_execution_trace_events) - Get Workflow Execution Trace Events * [stream](#stream) - Stream * [get_workflow_execution_logs](#get_workflow_execution_logs) - Get Workflow Execution Logs * [stream_workflow_execution_logs](#stream_workflow_execution_logs) - Stream Workflow Execution Logs ## get_workflow_execution Get Workflow Execution ### Example Usage ```python from mistralai.client import Mistral import os with Mistral( api_key=os.getenv("MISTRAL_API_KEY", ""), ) as mistral: res = mistral.workflows.executions.get_workflow_execution(execution_id="", include_search_keys=False) # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | | `execution_id` | *str* | :heavy_check_mark: | N/A | | `include_search_keys` | *Optional[bool]* | :heavy_minus_sign: | Include the execution's search keys (metadata) in the response. | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response **[models.WorkflowExecutionResponse](../../models/workflowexecutionresponse.md)** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## get_workflow_execution_history Get Workflow Execution History ### Example Usage ```python from mistralai.client import Mistral import os with Mistral( api_key=os.getenv("MISTRAL_API_KEY", ""), ) as mistral: res = mistral.workflows.executions.get_workflow_execution_history(execution_id="", decode_payloads=True) # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | | `execution_id` | *str* | :heavy_check_mark: | N/A | | `decode_payloads` | *Optional[bool]* | :heavy_minus_sign: | N/A | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response **[Any](../../models/.md)** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## signal_workflow_execution Signal Workflow Execution ### Example Usage ```python from mistralai.client import Mistral import os with Mistral( api_key=os.getenv("MISTRAL_API_KEY", ""), ) as mistral: res = mistral.workflows.executions.signal_workflow_execution(execution_id="", name="") # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | | `execution_id` | *str* | :heavy_check_mark: | N/A | | `name` | *str* | :heavy_check_mark: | The name of the signal to send | | `input` | [OptionalNullable[models.SignalInvocationBodyInput]](../../models/signalinvocationbodyinput.md) | :heavy_minus_sign: | Input data for the signal, matching its schema | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response **[models.SignalWorkflowResponse](../../models/signalworkflowresponse.md)** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## query_workflow_execution Query Workflow Execution ### Example Usage ```python from mistralai.client import Mistral import os with Mistral( api_key=os.getenv("MISTRAL_API_KEY", ""), ) as mistral: res = mistral.workflows.executions.query_workflow_execution(execution_id="", name="") # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | | `execution_id` | *str* | :heavy_check_mark: | N/A | | `name` | *str* | :heavy_check_mark: | The name of the query to request | | `input` | [OptionalNullable[models.QueryInvocationBodyInput]](../../models/queryinvocationbodyinput.md) | :heavy_minus_sign: | Input data for the query, matching its schema | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response **[models.QueryWorkflowResponse](../../models/queryworkflowresponse.md)** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## terminate_workflow_execution Terminate Workflow Execution ### Example Usage ```python from mistralai.client import Mistral import os with Mistral( api_key=os.getenv("MISTRAL_API_KEY", ""), ) as mistral: mistral.workflows.executions.terminate_workflow_execution(execution_id="") # Use the SDK ... ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | | `execution_id` | *str* | :heavy_check_mark: | N/A | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## batch_terminate_workflow_executions Batch Terminate Workflow Executions ### Example Usage ```python from mistralai.client import Mistral import os with Mistral( api_key=os.getenv("MISTRAL_API_KEY", ""), ) as mistral: res = mistral.workflows.executions.batch_terminate_workflow_executions(execution_ids=[ "", "", ]) # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | | `execution_ids` | List[*str*] | :heavy_check_mark: | List of execution IDs to process | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response **[models.BatchExecutionResponse](../../models/batchexecutionresponse.md)** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## cancel_workflow_execution Cancel Workflow Execution ### Example Usage ```python from mistralai.client import Mistral import os with Mistral( api_key=os.getenv("MISTRAL_API_KEY", ""), ) as mistral: mistral.workflows.executions.cancel_workflow_execution(execution_id="") # Use the SDK ... ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | | `execution_id` | *str* | :heavy_check_mark: | N/A | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## batch_cancel_workflow_executions Batch Cancel Workflow Executions ### Example Usage ```python from mistralai.client import Mistral import os with Mistral( api_key=os.getenv("MISTRAL_API_KEY", ""), ) as mistral: res = mistral.workflows.executions.batch_cancel_workflow_executions(execution_ids=[]) # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | | `execution_ids` | List[*str*] | :heavy_check_mark: | List of execution IDs to process | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response **[models.BatchExecutionResponse](../../models/batchexecutionresponse.md)** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## reset_workflow Reset Workflow ### Example Usage ```python from mistralai.client import Mistral import os with Mistral( api_key=os.getenv("MISTRAL_API_KEY", ""), ) as mistral: mistral.workflows.executions.reset_workflow(execution_id="", event_id=24149, exclude_signals=False, exclude_updates=False) # Use the SDK ... ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | | `execution_id` | *str* | :heavy_check_mark: | N/A | | `event_id` | *int* | :heavy_check_mark: | The event ID to reset the workflow execution to | | `reason` | *OptionalNullable[str]* | :heavy_minus_sign: | Reason for resetting the workflow execution | | `exclude_signals` | *Optional[bool]* | :heavy_minus_sign: | Whether to exclude signals that happened after the reset point | | `exclude_updates` | *Optional[bool]* | :heavy_minus_sign: | Whether to exclude updates that happened after the reset point | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## update_workflow_execution Update Workflow Execution ### Example Usage ```python from mistralai.client import Mistral import os with Mistral( api_key=os.getenv("MISTRAL_API_KEY", ""), ) as mistral: res = mistral.workflows.executions.update_workflow_execution(execution_id="", name="") # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | | `execution_id` | *str* | :heavy_check_mark: | N/A | | `name` | *str* | :heavy_check_mark: | The name of the update to request | | `input` | [OptionalNullable[models.UpdateInvocationBodyInput]](../../models/updateinvocationbodyinput.md) | :heavy_minus_sign: | Input data for the update, matching its schema | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response **[models.UpdateWorkflowResponse](../../models/updateworkflowresponse.md)** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## get_workflow_execution_trace_info Get Workflow Execution Trace Info ### Example Usage ```python from mistralai.client import Mistral import os with Mistral( api_key=os.getenv("MISTRAL_API_KEY", ""), ) as mistral: res = mistral.workflows.executions.get_workflow_execution_trace_info(execution_id="") # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | | `execution_id` | *str* | :heavy_check_mark: | N/A | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response **[models.ExecutionTraceInfoResponse](../../models/executiontraceinforesponse.md)** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## get_workflow_execution_trace_otel Get Workflow Execution Trace Otel ### Example Usage ```python from mistralai.client import Mistral import os with Mistral( api_key=os.getenv("MISTRAL_API_KEY", ""), ) as mistral: res = mistral.workflows.executions.get_workflow_execution_trace_otel(execution_id="") # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | | `execution_id` | *str* | :heavy_check_mark: | N/A | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response **[models.WorkflowExecutionTraceOTelResponse](../../models/workflowexecutiontraceotelresponse.md)** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## get_workflow_execution_trace_summary Get Workflow Execution Trace Summary ### Example Usage ```python from mistralai.client import Mistral import os with Mistral( api_key=os.getenv("MISTRAL_API_KEY", ""), ) as mistral: res = mistral.workflows.executions.get_workflow_execution_trace_summary(execution_id="") # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | | `execution_id` | *str* | :heavy_check_mark: | N/A | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response **[models.WorkflowExecutionTraceSummaryResponse](../../models/workflowexecutiontracesummaryresponse.md)** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## get_workflow_execution_trace_events Get Workflow Execution Trace Events ### Example Usage ```python from mistralai.client import Mistral import os with Mistral( api_key=os.getenv("MISTRAL_API_KEY", ""), ) as mistral: res = mistral.workflows.executions.get_workflow_execution_trace_events(execution_id="", merge_same_id_events=False, include_internal_events=False) # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | | `execution_id` | *str* | :heavy_check_mark: | N/A | | `merge_same_id_events` | *Optional[bool]* | :heavy_minus_sign: | N/A | | `include_internal_events` | *Optional[bool]* | :heavy_minus_sign: | N/A | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response **[models.WorkflowExecutionTraceEventsResponse](../../models/workflowexecutiontraceeventsresponse.md)** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## stream Stream ### Example Usage ```python from mistralai.client import Mistral import os with Mistral( api_key=os.getenv("MISTRAL_API_KEY", ""), ) as mistral: res = mistral.workflows.executions.stream(execution_id="") with res as event_stream: for event in event_stream: # handle event print(event, flush=True) ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | | `execution_id` | *str* | :heavy_check_mark: | N/A | | `event_source` | [OptionalNullable[models.EventSource]](../../models/eventsource.md) | :heavy_minus_sign: | N/A | | `last_event_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response **[Union[eventstreaming.EventStream[models.StreamV1WorkflowsExecutionsExecutionIDStreamGetResponseBody], eventstreaming.EventStreamAsync[models.StreamV1WorkflowsExecutionsExecutionIDStreamGetResponseBody]]](../../models/.md)** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## get_workflow_execution_logs Retrieve logs for a workflow execution. Use `after`/`before`/`order` on the first request to set the time range and sort order; for the next pages pass the `cursor` from the previous response (it remembers the range and order). ### Example Usage ```python from mistralai.client import Mistral import os with Mistral( api_key=os.getenv("MISTRAL_API_KEY", ""), ) as mistral: res = mistral.workflows.executions.get_workflow_execution_logs(execution_id="", order="asc", limit=50) # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | | `execution_id` | *str* | :heavy_check_mark: | N/A | | `run_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Filter logs by workflow run ID | | `activity_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Filter logs by activity ID | | `after` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Only return logs at or after this timestamp | | `before` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Only return logs before this timestamp | | `order` | [Optional[models.GetWorkflowExecutionLogsOrder]](../../models/getworkflowexecutionlogsorder.md) | :heavy_minus_sign: | First-page sort order: 'asc' (oldest first) or 'desc'. Ignored when `cursor` is set. | | `cursor` | *OptionalNullable[str]* | :heavy_minus_sign: | Pagination cursor from a previous response's `next_cursor`; carries the window and order | | `limit` | *Optional[int]* | :heavy_minus_sign: | Maximum number of logs to return | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response **[models.ExecutionLogSearchResponse](../../models/executionlogsearchresponse.md)** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | ## stream_workflow_execution_logs Stream logs for a workflow execution via SSE. Resume cursor comes from the `Last-Event-ID` header or `last_event_id` query param (header wins) and takes precedence over `after`; omit all to tail from the execution start. ### Example Usage ```python from mistralai.client import Mistral import os with Mistral( api_key=os.getenv("MISTRAL_API_KEY", ""), ) as mistral: res = mistral.workflows.executions.stream_workflow_execution_logs(execution_id="") with res as event_stream: for event in event_stream: # handle event print(event, flush=True) ``` ### Parameters | Parameter | Type | Required | Description | | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | | `execution_id` | *str* | :heavy_check_mark: | N/A | | `run_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Filter logs by workflow run ID | | `activity_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Filter logs by activity ID | | `after` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Start a fresh stream at this timestamp (ignored when resuming via last_event_id) | | `last_event_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Resume from this cursor (a prior response's SSE id) | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response **[Union[eventstreaming.EventStream[models.StreamWorkflowExecutionLogsResponseBody], eventstreaming.EventStreamAsync[models.StreamWorkflowExecutionLogsResponseBody]]](../../models/.md)** ### Errors | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | errors.HTTPValidationError | 422 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* |