import requests
url = "https://app.langwatch.ai/api/v1/agents/{id}"
payload = {
"name": "<string>",
"config": {},
"workflowId": "<string>"
}
headers = {
"X-Auth-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-Auth-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', config: {}, workflowId: '<string>'})
};
fetch('https://app.langwatch.ai/api/v1/agents/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PUT \
--url https://app.langwatch.ai/api/v1/agents/{id} \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '
{
"name": "<string>",
"config": {},
"workflowId": "<string>"
}
'{
"id": "<string>",
"name": "<string>",
"type": "signature",
"config": {},
"environment": "<string>",
"ownerUserId": "<string>",
"hostLabel": "<string>",
"lastSeenAt": "<string>",
"parameters": [
{
"name": "<string>",
"description": "<string>",
"defaultValue": "<string>",
"secret": true,
"type": "string",
"options": [
"<string>"
],
"required": true
}
],
"owner": {
"userId": "<string>",
"name": "<string>"
},
"status": "online",
"instances": [
{
"instanceId": "<string>",
"hostname": "<string>",
"username": "<string>",
"pid": 123,
"label": "<string>",
"sdk": {
"name": "<string>",
"version": "<string>",
"language": "<string>"
},
"connectedAt": "<string>",
"inflight": 123,
"maxConcurrency": 123
}
],
"createdAt": "<string>",
"updatedAt": "<string>",
"platformUrl": "<string>"
}Update Agents (PUT)
Update an agent: any of name, type, configuration and workflow. The update is partial under PATCH and PUT alike. A connected agent takes no edit and answers 422 agent_register_only.
import requests
url = "https://app.langwatch.ai/api/v1/agents/{id}"
payload = {
"name": "<string>",
"config": {},
"workflowId": "<string>"
}
headers = {
"X-Auth-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-Auth-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', config: {}, workflowId: '<string>'})
};
fetch('https://app.langwatch.ai/api/v1/agents/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PUT \
--url https://app.langwatch.ai/api/v1/agents/{id} \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '
{
"name": "<string>",
"config": {},
"workflowId": "<string>"
}
'{
"id": "<string>",
"name": "<string>",
"type": "signature",
"config": {},
"environment": "<string>",
"ownerUserId": "<string>",
"hostLabel": "<string>",
"lastSeenAt": "<string>",
"parameters": [
{
"name": "<string>",
"description": "<string>",
"defaultValue": "<string>",
"secret": true,
"type": "string",
"options": [
"<string>"
],
"required": true
}
],
"owner": {
"userId": "<string>",
"name": "<string>"
},
"status": "online",
"instances": [
{
"instanceId": "<string>",
"hostname": "<string>",
"username": "<string>",
"pid": 123,
"label": "<string>",
"sdk": {
"name": "<string>",
"version": "<string>",
"language": "<string>"
},
"connectedAt": "<string>",
"inflight": 123,
"maxConcurrency": 123
}
],
"createdAt": "<string>",
"updatedAt": "<string>",
"platformUrl": "<string>"
}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 agent id.
1Body
1 - 255The kind of agent to write. A connected agent is registered from code by the SDK, so "connected" is refused with agent_register_only.
signature, code, workflow, http, connected Show child attributes
Show child attributes
Response
Success
The kind of agent. A connected agent is registered from code by the SDK and cannot be created or reconfigured through this API.
signature, code, workflow, http, connected Show child attributes
Show child attributes
The environment a connected agent registered with, for example production or development. Null for every other kind.
The user a personal development agent belongs to. Only that user can run simulations against it. Null when the agent is shared.
The machine a development agent registered from with a project or service key. Null when the agent is personal or shared.
When an instance of a connected agent was last connected. Null for every other kind.
The run parameters a connected agent declares from its function signature: name, type, options, default and description. Empty for every other kind.
Show child attributes
Show child attributes
The person a personal development agent belongs to. Null when the agent is shared or host-scoped.
Show child attributes
Show child attributes
online while at least one process running the connected agent is connected; offline otherwise, and always for every other kind.
online, offline The processes currently connected for a connected agent: hostname, user, pid, SDK and how many calls each has in flight. Empty for every other kind.
Show child attributes
Show child attributes
Was this page helpful?