Start a chat session with an agent

Begin a chat session with an agent.

You can use the cursor field to continue a multi-turn conversation:

  • Start a new conversation by omitting cursor.
  • Continue a conversation by passing the cursor from the previous response.

When a cursor is provided, there is no need to include previous message history in the messages field.

Tool confirmation flow

Integration tools — Call Function, Run Python code, and Call REST API — require explicit user confirmation before execution. When the agent wants to run one of these tools, the response includes a toolConfirmation action instead of the final result.

To continue, send a follow-up request with the same cursor and a message of type toolConfirmation in the messages array:

{
  "agentExternalId": "my_agent",
  "cursor": "<cursor from previous response>",
  "messages": [
    {
      "role": "action",
      "type": "toolConfirmation",
      "actionId": "<actionId from the toolConfirmation action>",
      "status": "ALLOW"
    }
  ]
}

Set status to "ALLOW" to let the agent execute the tool, or "DENY" to cancel it.

Streaming

Set stream to true in the request to receive Server-Sent Events (SSE) as the agent works. Each event is an AgentSessionResponse whose response.type discriminator indicates the kind of event:

  • progress — status updates while the agent is working (e.g. "Searching knowledge graph…"). Useful for showing a spinner or activity indicator.
  • responseChunk — incremental content fragments of the agent's reply. Concatenate these to build the full response as it streams in.
  • result — the final complete response, including messages, cursor, and any actions. Always the last event in the stream.

When stream is false (the default), only a single result response is returned.

Securityoidc-token or oauth2-client-credentials or oauth2-open-industrial-data or oauth2-auth-code
Request
header Parameters
content-type
required
string (Content-Type)
Request Body schema: application/json
required
Array of objects (Actions) <= 20 items

Custom tool calls that a client can inject.

agentExternalId
string (Agentexternalid) ^[^\x00]{1,128}$

An external ID that uniquely identifies the agent.

agentId
string (Agentid) ^[^\x00]{1,128}$
Deprecated

Deprecated: Use AgentExternalId instead. This field uniquely identifies the agent, but is deprecated and will be removed in a future release. If both AgentId and AgentExternalId are provided, AgentExternalId takes precedence.

cursor
string (Cursor)

The cursor for continuing a multi-turn conversation. Omit this field to start a new conversation. To continue a conversation, pass the cursor value returned in the previous response. When cursor is provided, you do not need to resend earlier conversation history.

required
Array of AgentChatMessageActionDTO (any) or AgentChatMessageUserRequest (object) (Messages) [ 1 .. 1000 ] items

A list of one or multiple input items for the agent, which include various content types used to generate a response.

retentionPolicy
string (RetentionPolicy)

Retention class for the conversation. "persisted" retains the conversation until explicitly deleted. "temporary" (default) can result in the conversation being deleted at any time. This value is only honored when starting a conversation, ignored otherwise.

Enum: "temporary" "persisted"
stream
boolean (Stream)
Default: false

Enable progress message streaming.

Responses
200

Successful Response

400

The response for a failed request.

post/ai/agents/chat
Request samples
application/json
{
  • "actions": [
    • {
      }
    ],
  • "agentExternalId": "string",
  • "agentId": "string",
  • "cursor": "string",
  • "messages": [
    • {
      }
    ],
  • "retentionPolicy": "temporary",
  • "stream": false
}
Response samples
application/json
{
  • "agentExternalId": "string",
  • "agentId": "string",
  • "response": {
    • "cursor": "string",
    • "messages": [
      ],
    • "type": "result"
    }
}