Skip to content

Latest commit

 

History

History
599 lines (392 loc) · 36.7 KB

File metadata and controls

599 lines (392 loc) · 36.7 KB

Workflows.Executions

Overview

Available Operations

get_workflow_execution

Get Workflow Execution

Example Usage

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="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
execution_id str ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.WorkflowExecutionResponse

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

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="<id>", decode_payloads=True)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
execution_id str ✔️ N/A
decode_payloads Optional[bool] N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

Any

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

signal_workflow_execution

Signal Workflow Execution

Example Usage

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="<id>", name="<value>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
execution_id str ✔️ N/A
name str ✔️ The name of the signal to send
input OptionalNullable[models.SignalInvocationBodyInput] Input data for the signal, matching its schema
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.SignalWorkflowResponse

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

query_workflow_execution

Query Workflow Execution

Example Usage

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="<id>", name="<value>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
execution_id str ✔️ N/A
name str ✔️ The name of the query to request
input OptionalNullable[models.QueryInvocationBodyInput] Input data for the query, matching its schema
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.QueryWorkflowResponse

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

terminate_workflow_execution

Terminate Workflow Execution

Example Usage

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="<id>")

    # Use the SDK ...

Parameters

Parameter Type Required Description
execution_id str ✔️ N/A
retries Optional[utils.RetryConfig] 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

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=[
        "<value 1>",
        "<value 2>",
    ])

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
execution_ids List[str] ✔️ List of execution IDs to process
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.BatchExecutionResponse

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

cancel_workflow_execution

Cancel Workflow Execution

Example Usage

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="<id>")

    # Use the SDK ...

Parameters

Parameter Type Required Description
execution_id str ✔️ N/A
retries Optional[utils.RetryConfig] 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

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] ✔️ List of execution IDs to process
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.BatchExecutionResponse

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

reset_workflow

Reset Workflow

Example Usage

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="<id>", event_id=24149, exclude_signals=False, exclude_updates=False)

    # Use the SDK ...

Parameters

Parameter Type Required Description
execution_id str ✔️ N/A
event_id int ✔️ The event ID to reset the workflow execution to
reason OptionalNullable[str] Reason for resetting the workflow execution
exclude_signals Optional[bool] Whether to exclude signals that happened after the reset point
exclude_updates Optional[bool] Whether to exclude updates that happened after the reset point
retries Optional[utils.RetryConfig] 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

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="<id>", name="<value>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
execution_id str ✔️ N/A
name str ✔️ The name of the update to request
input OptionalNullable[models.UpdateInvocationBodyInput] Input data for the update, matching its schema
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.UpdateWorkflowResponse

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

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="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
execution_id str ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.WorkflowExecutionTraceOTelResponse

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

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="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
execution_id str ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.WorkflowExecutionTraceSummaryResponse

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

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="<id>", merge_same_id_events=False, include_internal_events=False)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
execution_id str ✔️ N/A
merge_same_id_events Optional[bool] N/A
include_internal_events Optional[bool] N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.WorkflowExecutionTraceEventsResponse

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

stream

Stream

Example Usage

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="<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 ✔️ N/A
event_source OptionalNullable[models.EventSource] N/A
last_event_id OptionalNullable[str] N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

Union[eventstreaming.EventStream[models.StreamV1WorkflowsExecutionsExecutionIDStreamGetResponseBody], eventstreaming.EventStreamAsync[models.StreamV1WorkflowsExecutionsExecutionIDStreamGetResponseBody]]

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*