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.
Create Call
Try this endpoint
app.langwatch.ai
API key · X-Auth-Token
Kept in this tab. Cleared when you reload.
The agent id.
The whole conversation so far, OpenAI style.
The messages added since the agent's last turn. Defaults to the last message.
The conversation id. Turns of one conversation share it; a new id starts a new one.
Run parameter values by name, as JSON scalars.
The session the agent returned on its previous turn of this conversation, echoed back as is.
The W3C trace context the agent adopts, so its spans join this turn's trace.
A turn, or a scenario run's setup or teardown hook. Defaults to a turn.
The scenario run's test data: what setup returned, or a turn's latest update.
A setup or teardown hook's budget in milliseconds. A turn runs under the agent's own timeout.
This sends a live request to app.langwatch.ai.
Request and response examples
import osimport requestsorigin = "https://app.langwatch.ai"path = "/api/v1/agents/<id>/call"api_key = os.environ["LANGWATCH_API_KEY"]headers = { "X-Auth-Token": api_key, "Content-Type": "application/json",}payload = {}response = requests.post( origin + path, headers=headers, json=payload,)print(response.json())const url = "https://app.langwatch.ai/api/v1/agents/<id>/call";const response = await fetch(url, { method: "POST", headers: { "X-Auth-Token": process.env.LANGWATCH_API_KEY!, "Content-Type": "application/json", }, body: JSON.stringify({}),});const data = await response.json();curl --request POST \ --url 'https://app.langwatch.ai/api/v1/agents/<id>/call' \ --header "X-Auth-Token: $LANGWATCH_API_KEY" \ --header 'Content-Type: application/json' \ --data '{}'Call the LangWatch API from this project: Send one conversation turn to an online connected agent.Request: POST https://app.langwatch.ai/api/v1/agents/<id>/callReference: https://langwatch.ai/docs/api-reference/agents/action-call.mdAuthentication: send the X-Auth-Token header, read from the LANGWATCH_API_KEY environment variable. Never hard-code the key.Body (application/json):```json{}```Use the HTTP client this project already uses, handle non-2xx responses, and show me the parsed result.Success
application/json · Generated from schema
{ "output": "string", "session": null, "state": {}, "instance": { "hostname": "string", "label": "string" }, "durationMs": 0}Path parameters
idstringrequiredThe agent id.
Request body
application/json · Required
messagesobject[]requiredThe whole conversation so far, OpenAI style.
newMessagesobject[]The messages added since the agent's last turn. Defaults to the last message.
threadIdstringThe conversation id. Turns of one conversation share it; a new id starts a new one.
paramsobjectRun parameter values by name, as JSON scalars.
sessionanyThe session the agent returned on its previous turn of this conversation, echoed back as is.
traceparentstringThe W3C trace context the agent adopts, so its spans join this turn's trace.
runobjectThe simulation run this turn belongs to, if any.
kindstringA turn, or a scenario run's setup or teardown hook. Defaults to a turn.
"turn""setup""teardown"stateobject | nullThe scenario run's test data: what setup returned, or a turn's latest update.
timeoutMsintegerA setup or teardown hook's budget in milliseconds. A turn runs under the agent's own timeout.
Responses
200Success
application/json
outputstring | object | object[]requiredWhat the function answered: text, one message, or a list of messages.
sessionanyThe agent's per-conversation memory, to send on the next turn.
stateobject | nullSetup's state, a turn's state update, or the object teardown returned.
instanceobjectrequireddurationMsnumberrequired