Beta.Conversations

April 21, 2026 ยท View on GitHub

Overview

(beta) Conversations API

Available Operations

  • start - Create a conversation and append entries to it.
  • list - List all created conversations.
  • get - Retrieve a conversation information.
  • delete - Delete a conversation.
  • append - Append new entries to an existing conversation.
  • get_history - Retrieve all entries in a conversation.
  • get_messages - Retrieve all messages in a conversation.
  • restart - Restart a conversation starting from a given entry.
  • start_stream - Create a conversation and append entries to it.
  • append_stream - Append new entries to an existing conversation.
  • restart_stream - Restart a conversation starting from a given entry.

start

Create a new conversation, using a base model or an agent and append entries. Completion and tool executions are run and the response is appended to the conversation.Use the returned conversation_id to continue the conversation.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.conversations.start(inputs="<value>", completion_args={
        "response_format": {
            "type": "text",
        },
    })

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescription
inputsmodels.ConversationInputs:heavy_check_mark:N/A
storeOptionalNullable[bool]:heavy_minus_sign:N/A
handoff_executionOptionalNullable[models.ConversationRequestHandoffExecution]:heavy_minus_sign:N/A
instructionsOptionalNullable[str]:heavy_minus_sign:N/A
toolsList[models.ConversationRequestTool]:heavy_minus_sign:N/A
completion_argsOptionalNullable[models.CompletionArgs]:heavy_minus_sign:N/A
guardrailsList[models.GuardrailConfig]:heavy_minus_sign:N/A
nameOptionalNullable[str]:heavy_minus_sign:N/A
descriptionOptionalNullable[str]:heavy_minus_sign:N/A
metadataDict[str, Any]:heavy_minus_sign:N/A
agent_idOptionalNullable[str]:heavy_minus_sign:N/A
agent_versionOptionalNullable[models.ConversationRequestAgentVersion]:heavy_minus_sign:N/A
modelOptionalNullable[str]:heavy_minus_sign:N/A
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.ConversationResponse

Errors

Error TypeStatus CodeContent Type
errors.HTTPValidationError422application/json
errors.SDKError4XX, 5XX*/*

list

Retrieve a list of conversation entities sorted by creation time.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.conversations.list(page=0, page_size=100)

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescription
pageOptional[int]:heavy_minus_sign:N/A
page_sizeOptional[int]:heavy_minus_sign:N/A
metadataDict[str, Any]:heavy_minus_sign:N/A
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

List[models.AgentsAPIV1ConversationsListResponse]

Errors

Error TypeStatus CodeContent Type
errors.HTTPValidationError422application/json
errors.SDKError4XX, 5XX*/*

get

Given a conversation_id retrieve a conversation entity with its attributes.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.conversations.get(conversation_id="<id>")

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescription
conversation_idstr:heavy_check_mark:ID of the conversation from which we are fetching metadata.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.ResponseV1ConversationsGet

Errors

Error TypeStatus CodeContent Type
errors.HTTPValidationError422application/json
errors.SDKError4XX, 5XX*/*

delete

Delete a conversation given a conversation_id.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    mistral.beta.conversations.delete(conversation_id="<id>")

    # Use the SDK ...

Parameters

ParameterTypeRequiredDescription
conversation_idstr:heavy_check_mark:ID of the conversation from which we are fetching metadata.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Errors

Error TypeStatus CodeContent Type
errors.HTTPValidationError422application/json
errors.SDKError4XX, 5XX*/*

append

Run completion on the history of the conversation and the user entries. Return the new created entries.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.conversations.append(conversation_id="<id>", store=True, handoff_execution="server", completion_args={
        "response_format": {
            "type": "text",
        },
    })

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescription
conversation_idstr:heavy_check_mark:ID of the conversation to which we append entries.
inputsOptional[models.ConversationInputs]:heavy_minus_sign:N/A
storeOptional[bool]:heavy_minus_sign:Whether to store the results into our servers or not.
handoff_executionOptional[models.ConversationAppendRequestHandoffExecution]:heavy_minus_sign:N/A
completion_argsOptional[models.CompletionArgs]:heavy_minus_sign:White-listed arguments from the completion API
tool_confirmationsList[models.ToolCallConfirmation]:heavy_minus_sign:N/A
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.ConversationResponse

Errors

Error TypeStatus CodeContent Type
errors.HTTPValidationError422application/json
errors.SDKError4XX, 5XX*/*

get_history

Given a conversation_id retrieve all the entries belonging to that conversation. The entries are sorted in the order they were appended, those can be messages, connectors or function_call.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.conversations.get_history(conversation_id="<id>")

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescription
conversation_idstr:heavy_check_mark:ID of the conversation from which we are fetching entries.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.ConversationHistory

Errors

Error TypeStatus CodeContent Type
errors.HTTPValidationError422application/json
errors.SDKError4XX, 5XX*/*

get_messages

Given a conversation_id retrieve all the messages belonging to that conversation. This is similar to retrieving all entries except we filter the messages only.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.conversations.get_messages(conversation_id="<id>")

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescription
conversation_idstr:heavy_check_mark:ID of the conversation from which we are fetching messages.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.ConversationMessages

Errors

Error TypeStatus CodeContent Type
errors.HTTPValidationError422application/json
errors.SDKError4XX, 5XX*/*

restart

Given a conversation_id and an id, recreate a conversation from this point and run completion. A new conversation is returned with the new entries returned.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.conversations.restart(conversation_id="<id>", from_entry_id="<id>", store=True, handoff_execution="server", completion_args={
        "response_format": {
            "type": "text",
        },
    })

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescription
conversation_idstr:heavy_check_mark:ID of the original conversation which is being restarted.
from_entry_idstr:heavy_check_mark:N/A
inputsOptional[models.ConversationInputs]:heavy_minus_sign:N/A
storeOptional[bool]:heavy_minus_sign:Whether to store the results into our servers or not.
handoff_executionOptional[models.ConversationRestartRequestHandoffExecution]:heavy_minus_sign:N/A
completion_argsOptional[models.CompletionArgs]:heavy_minus_sign:White-listed arguments from the completion API
guardrailsList[models.GuardrailConfig]:heavy_minus_sign:N/A
metadataDict[str, Any]:heavy_minus_sign:Custom metadata for the conversation.
agent_versionOptionalNullable[models.ConversationRestartRequestAgentVersion]:heavy_minus_sign:Specific version of the agent to use when restarting. If not provided, uses the current version.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.ConversationResponse

Errors

Error TypeStatus CodeContent Type
errors.HTTPValidationError422application/json
errors.SDKError4XX, 5XX*/*

start_stream

Create a new conversation, using a base model or an agent and append entries. Completion and tool executions are run and the response is appended to the conversation.Use the returned conversation_id to continue the conversation.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.conversations.start_stream(inputs=[
        {
            "object": "entry",
            "type": "function.result",
            "tool_call_id": "<id>",
            "result": "<value>",
        },
    ], completion_args={
        "response_format": {
            "type": "text",
        },
    })

    with res as event_stream:
        for event in event_stream:
            # handle event
            print(event, flush=True)

Parameters

ParameterTypeRequiredDescription
inputsmodels.ConversationInputs:heavy_check_mark:N/A
storeOptionalNullable[bool]:heavy_minus_sign:N/A
handoff_executionOptionalNullable[models.ConversationStreamRequestHandoffExecution]:heavy_minus_sign:N/A
instructionsOptionalNullable[str]:heavy_minus_sign:N/A
toolsList[models.ConversationStreamRequestTool]:heavy_minus_sign:N/A
completion_argsOptionalNullable[models.CompletionArgs]:heavy_minus_sign:N/A
guardrailsList[models.GuardrailConfig]:heavy_minus_sign:N/A
nameOptionalNullable[str]:heavy_minus_sign:N/A
descriptionOptionalNullable[str]:heavy_minus_sign:N/A
metadataDict[str, Any]:heavy_minus_sign:N/A
agent_idOptionalNullable[str]:heavy_minus_sign:N/A
agent_versionOptionalNullable[models.ConversationStreamRequestAgentVersion]:heavy_minus_sign:N/A
modelOptionalNullable[str]:heavy_minus_sign:N/A
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

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

Errors

Error TypeStatus CodeContent Type
errors.HTTPValidationError422application/json
errors.SDKError4XX, 5XX*/*

append_stream

Run completion on the history of the conversation and the user entries. Return the new created entries.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.conversations.append_stream(conversation_id="<id>", store=True, handoff_execution="server", completion_args={
        "response_format": {
            "type": "text",
        },
    })

    with res as event_stream:
        for event in event_stream:
            # handle event
            print(event, flush=True)

Parameters

ParameterTypeRequiredDescription
conversation_idstr:heavy_check_mark:ID of the conversation to which we append entries.
inputsOptional[models.ConversationInputs]:heavy_minus_sign:N/A
storeOptional[bool]:heavy_minus_sign:Whether to store the results into our servers or not.
handoff_executionOptional[models.ConversationAppendStreamRequestHandoffExecution]:heavy_minus_sign:N/A
completion_argsOptional[models.CompletionArgs]:heavy_minus_sign:White-listed arguments from the completion API
tool_confirmationsList[models.ToolCallConfirmation]:heavy_minus_sign:N/A
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

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

Errors

Error TypeStatus CodeContent Type
errors.HTTPValidationError422application/json
errors.SDKError4XX, 5XX*/*

restart_stream

Given a conversation_id and an id, recreate a conversation from this point and run completion. A new conversation is returned with the new entries returned.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.conversations.restart_stream(conversation_id="<id>", from_entry_id="<id>", store=True, handoff_execution="server", completion_args={
        "response_format": {
            "type": "text",
        },
    })

    with res as event_stream:
        for event in event_stream:
            # handle event
            print(event, flush=True)

Parameters

ParameterTypeRequiredDescription
conversation_idstr:heavy_check_mark:ID of the original conversation which is being restarted.
from_entry_idstr:heavy_check_mark:N/A
inputsOptional[models.ConversationInputs]:heavy_minus_sign:N/A
storeOptional[bool]:heavy_minus_sign:Whether to store the results into our servers or not.
handoff_executionOptional[models.ConversationRestartStreamRequestHandoffExecution]:heavy_minus_sign:N/A
completion_argsOptional[models.CompletionArgs]:heavy_minus_sign:White-listed arguments from the completion API
guardrailsList[models.GuardrailConfig]:heavy_minus_sign:N/A
metadataDict[str, Any]:heavy_minus_sign:Custom metadata for the conversation.
agent_versionOptionalNullable[models.ConversationRestartStreamRequestAgentVersion]:heavy_minus_sign:Specific version of the agent to use when restarting. If not provided, uses the current version.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

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

Errors

Error TypeStatus CodeContent Type
errors.HTTPValidationError422application/json
errors.SDKError4XX, 5XX*/*