Skip to main content
POST
Send one conversation turn to an online connected agent

Authorizations

X-Auth-Token
string
header
required

Project API key for sending traces and accessing project-scoped resources. Format: sk-lw-... (no underscore). Obtain one by creating a project via the Admin API or the LangWatch UI.

Path Parameters

id
string
required

The agent id.

Minimum string length: 1

Body

application/json
messages
object[]
required

The whole conversation so far, OpenAI style.

newMessages
object[]

The messages added since the agent's last turn. Defaults to the last message.

threadId
string

The conversation id. Turns of one conversation share it; a new id starts a new one.

Maximum string length: 255
params
object

Run parameter values by name, as JSON scalars.

session
any

The session the agent returned on its previous turn of this conversation, echoed back as is.

traceparent
string

The W3C trace context the agent adopts, so its spans join this turn's trace.

Maximum string length: 255
run
object

The simulation run this turn belongs to, if any.

kind
enum<string>

A turn, or a scenario run's setup or teardown hook. Defaults to a turn.

Available options:
turn,
setup,
teardown
state
object | null

The scenario run's test data: what setup returned, or a turn's latest update.

timeoutMs
integer

A setup or teardown hook's budget in milliseconds. A turn runs under the agent's own timeout.

Required range: x <= 300000

Response

200 - application/json

Success

output
required

What the function answered: text, one message, or a list of messages.

instance
object
required
durationMs
number
required
session
any

The agent's per-conversation memory, to send on the next turn.

state
object | null

Setup's state, a turn's state update, or the object teardown returned.

Last modified on August 31, 2026