import requests
url = "https://app.langwatch.ai/api/v1/agents/{id}/call"
payload = { "messages": [{ "role": "<string>" }] }
headers = {
"X-Auth-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Auth-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({messages: [{role: '<string>'}]})
};
fetch('https://app.langwatch.ai/api/v1/agents/{id}/call', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/v1/agents/{id}/call \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '
{
"messages": [
{
"role": "<string>"
}
]
}
'{
"output": "<string>",
"instance": {
"hostname": "<string>",
"label": "<string>"
},
"durationMs": 123,
"session": "<unknown>"
}Create Call
Send one conversation turn to a connected agent and get its answer. The agent must be online: a process running the decorated function must be connected.
import requests
url = "https://app.langwatch.ai/api/v1/agents/{id}/call"
payload = { "messages": [{ "role": "<string>" }] }
headers = {
"X-Auth-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Auth-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({messages: [{role: '<string>'}]})
};
fetch('https://app.langwatch.ai/api/v1/agents/{id}/call', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/v1/agents/{id}/call \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '
{
"messages": [
{
"role": "<string>"
}
]
}
'{
"output": "<string>",
"instance": {
"hostname": "<string>",
"label": "<string>"
},
"durationMs": 123,
"session": "<unknown>"
}Authorizations
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
The connected agent id.
1Body
The whole conversation so far, OpenAI style.
Show child attributes
Show child attributes
The messages added since the agent's last turn. Defaults to the last message.
Show child attributes
Show child attributes
The conversation id. Turns of one conversation share it; a new id starts a new one.
255Run parameter values by name, as JSON scalars.
Show child attributes
Show child attributes
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.
255The simulation run this turn belongs to, if any.
Show child attributes
Show child attributes
Was this page helpful?