Zum Hauptinhalt springen

Run the AIssistant on a chat and stream its answer

POST/v2/aissistant-chats/{chatId}/actions/run
API-Version
v2
Request-Methode
POST
Operation-ID
aissistant-run-chat

The response streams one AG-UI event per SSE data: frame, each a de.mittwald.v1.aissistant.RunEvent. A run ends with RUN_FINISHED, or with RUN_ERROR when it fails. A client tool call ends the run without an answer, and the client executes the call and starts a new run whose resume answers the interrupt. The chat does not need to be saved before it is run.

Request​

  • chatIdstring (uuid)required

    The AG-UI threadId of the chat, created by the client. The request body's threadId must equal it.

    Beispiel:"7f0c6a52-3a8e-4b8f-9d1e-2c4b5a6d7e8f"

Responses​

Nutzungsbeispiele​

$ curl \
--fail \
--location \
-X POST \
-d '{"context":[{"description":"string","value":"string","string":null}],"forwardedProps":{"context":{"appInstallationId":"string","customerId":"string","projectId":"string","route":"string"},"contractVersion":123,"model":"default"},"messages":[{"content":null,"encryptedValue":"string","id":"string","metadata":null,"name":"string","role":"user","subagentRunId":"string","string":null}],"parentRunId":"string","protocolVersion":"string","resume":[{"interruptId":"string","metadata":null,"payload":null,"status":"resolved","string":null}],"runId":"string","state":null,"threadId":"string","tools":[{"description":"string","metadata":null,"name":"string","parameters":null,"string":null}]}' \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
-H 'Content-Type: application/json' \
https://api.mittwald.de/v2/aissistant-chats/f0f86186-0a5a-45b2-aa33-502777496347/actions/run
import { MittwaldAPIV2Client } from "@mittwald/api-client";
import { assertStatus } from "@mittwald/api-client-commons";

const client = MittwaldAPIClient.newWithToken(process.env.MITTWALD_API_TOKEN);
const response = await client.aissistant.runChat({
"chatId": "f0f86186-0a5a-45b2-aa33-502777496347",
"data": {
"context": [
{
"description": "string",
"value": "string",
"string": null
}
],
"forwardedProps": {
"context": {
"appInstallationId": "string",
"customerId": "string",
"projectId": "string",
"route": "string"
},
"contractVersion": 123,
"model": "default"
},
"messages": [
{
"content": null,
"encryptedValue": "string",
"id": "string",
"metadata": null,
"name": "string",
"role": "user",
"subagentRunId": "string",
"string": null
}
],
"parentRunId": "string",
"protocolVersion": "string",
"resume": [
{
"interruptId": "string",
"metadata": null,
"payload": null,
"status": "resolved",
"string": null
}
],
"runId": "string",
"state": null,
"threadId": "string",
"tools": [
{
"description": "string",
"metadata": null,
"name": "string",
"parameters": null,
"string": null
}
]
}
});

assertStatus(response, 200);

use \Mittwald\ApiClient\Generated\V2\Clients\AIssistant\RunChat\RunChatRequest;
use \Mittwald\ApiClient\Generated\V2\Clients\AIssistant\RunChat\RunChatRequestBody;

$client = MittwaldAPIClient::newWithToken(getenv('MITTWALD_API_TOKEN'));

// TODO: Please consult the properties and constructor signature of
// RunChatRequestBody to learn how to construct a valid instance
$body = new RunChatRequestBody(/* TODO: ... */);

$request = (new RunChatRequest(
chatId: "f0f86186-0a5a-45b2-aa33-502777496347",
body: $body
));
$response = $client->aissistant()->runChat($request);

var_dump($response->getBody();

Auf dieser Seite