Skip to contentSkip to page list

Docs

Create Agents

POST/api/v1/agents
Request and response examples
request.py
import osimport requests​origin = "https://app.langwatch.ai"path = "/api/v1/agents"api_key = os.environ["LANGWATCH_API_KEY"]headers = {    "X-Auth-Token": api_key,    "Content-Type": "application/json",}payload = {    "name": "string",    "commitMessage": "string",    "workflowId": "string",    "copiedFromAgentId": "string",    "type": "signature",    "config": {        "_library_ref": "string",        "name": "string",        "description": "string",        "cls": "string",        "parameters": [            {                "identifier": "string",                "type": "str",                "optional": False,                "value": None,                "desc": "string",                "prefix": "string",                "hidden": False,                "json_schema": {},            },        ],        "inputs": [            {                "identifier": "string",                "type": "str",                "optional": False,                "value": None,                "desc": "string",                "prefix": "string",                "hidden": False,                "json_schema": {},            },        ],        "outputs": [            {                "identifier": "string",                "type": "str",                "optional": False,                "value": None,                "desc": "string",                "prefix": "string",                "hidden": False,                "json_schema": {},            },        ],        "isCustom": False,        "behave_as": "evaluator",        "configId": "string",        "handle": "string",        "versionMetadata": {            "versionId": "string",            "versionNumber": 0,            "versionCreatedAt": "string",        },        "llm": {            "model": "string",            "temperature": 0,            "max_tokens": 0,            "top_p": 0,            "frequency_penalty": 0,            "presence_penalty": 0,            "seed": 0,            "top_k": 0,            "min_p": 0,            "repetition_penalty": 0,            "reasoning": "string",            "reasoning_effort": "string",            "thinkingLevel": "string",            "effort": "string",            "verbosity": "string",            "litellm_params": {},        },        "prompt": "string",        "messages": [            {                "role": "system",                "content": "string",            },        ],        "promptDraft": False,    },}​response = requests.post(    origin + path,    headers=headers,    json=payload,)print(response.json())

Success

application/json · Generated from schema

{  "id": "string",  "name": "string",  "type": "signature",  "config": {},  "environment": "string",  "ownerUserId": "string",  "hostLabel": "string",  "lastSeenAt": "2026-01-01T00:00:00Z",  "parameters": [    {      "name": "string",      "description": "string",      "defaultValue": "string",      "secret": false,      "type": "string",      "options": [        "string"      ],      "required": false    }  ],  "owner": {    "userId": "string",    "name": "string"  },  "status": "online",  "instances": [    {      "instanceId": "string",      "hostname": "string",      "username": "string",      "pid": 0,      "label": "string",      "sdk": {        "name": "string",        "version": "string",        "language": "string"      },      "connectedAt": "2026-01-01T00:00:00Z",      "inflight": 0,      "maxConcurrency": 0    }  ],  "selectable": false,  "notSelectableReason": "owned_by_another_person",  "version": 0,  "labels": [    {      "label": "string",      "version": 0    }  ],  "createdBy": {    "id": "string",    "name": "string"  },  "updatedBy": {    "id": "string",    "name": "string"  },  "createdAt": "2026-01-01T00:00:00Z",  "updatedAt": "2026-01-01T00:00:00Z",  "platformUrl": "string"}
api-reference/agents/create-agents

Authorization

X-Auth-Tokenstringheaderrequired

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.

Request body

application/json · Required

One of 6
Option 1type: "signature"object
namestringrequired
At least 1 characterUp to 255 characters
commitMessagestring

What changed, kept on the version this write creates.

Up to 500 characters
workflowIdstring
copiedFromAgentIdstring
typestringrequired
Always"signature"
configobjectrequired
Option 2type: "code"object
namestringrequired
At least 1 characterUp to 255 characters
commitMessagestring

What changed, kept on the version this write creates.

Up to 500 characters
workflowIdstring
copiedFromAgentIdstring
typestringrequired
Always"code"
configobjectrequired
Option 3type: "workflow"object
namestringrequired
At least 1 characterUp to 255 characters
commitMessagestring

What changed, kept on the version this write creates.

Up to 500 characters
workflowIdstring
copiedFromAgentIdstring
typestringrequired
Always"workflow"
configobjectrequired
Option 4type: "http"object
namestringrequired
At least 1 characterUp to 255 characters
commitMessagestring

What changed, kept on the version this write creates.

Up to 500 characters
workflowIdstring
copiedFromAgentIdstring
typestringrequired
Always"http"
configobjectrequired
Option 5type: "connected"object
namestringrequired
At least 1 characterUp to 255 characters
commitMessagestring

What changed, kept on the version this write creates.

Up to 500 characters
workflowIdstring
copiedFromAgentIdstring
typestringrequired
Always"connected"
configobjectrequired
Option 6type: "voice"object
namestringrequired
At least 1 characterUp to 255 characters
commitMessagestring

What changed, kept on the version this write creates.

Up to 500 characters
workflowIdstring
copiedFromAgentIdstring
typestringrequired
Always"voice"
configobjectrequired

Responses

201

Success

application/json

idstringrequired
namestringrequired
typestringrequired

The kind of agent. A connected agent is registered from code by the SDK and cannot be created or reconfigured through this API.

One of"signature""code""workflow""http""connected""voice"
configobject | nullrequired
Option 1object
Option 2null
environmentstring | nullrequired

The environment a connected agent registered with, for example production or development. Null for every other kind.

ownerUserIdstring | nullrequired

The user a personal development agent belongs to. Only that user can run simulations against it. Null when the agent is shared.

hostLabelstring | nullrequired

The machine a development agent registered from with a project or service key. Null when the agent is personal or shared.

lastSeenAtstring (date-time) | nullrequired

When an instance of a connected agent was last connected. Null for every other kind.

Option 1string (date-time)
Option 2null
parametersobject[]required

The run parameters a connected agent declares from its function signature: name, type, options, default and description. Empty for every other kind.

namestringrequired
At least 1 character
descriptionstring
defaultValuestring | number | boolean
secretboolean
typestring
One of"string""number""boolean"
optionsstring | number | boolean[]
requiredboolean
ownerobject | nullrequired

The person a personal development agent belongs to. Null when the agent is shared or host-scoped.

Option 1object
userIdstringrequired
namestring | nullrequired
Option 2null
statusstringrequired

online while at least one process running the connected agent is connected; offline otherwise, and always for every other kind.

One of"online""offline"
instancesobject[]required

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.

instanceIdstringrequired
hostnamestringrequired
usernamestringrequired
pidnumberrequired
labelstring | nullrequired
sdkobjectrequired
connectedAtstring (date-time)required
inflightnumberrequired
maxConcurrencynumberrequired
selectablebooleanrequired

Whether the credential making this request can run simulations against the agent. False for a personal development agent that belongs to somebody else, which is listed all the same so it can be told apart from the other agents of the same name.

notSelectableReasonstring | nullrequired

Why the agent cannot be run by this credential. Null when it can.

Option 1string
Option 2null
versioninteger | nullrequired

The version this response shows: the latest, unless a label or a version was asked for. Null for connected agents, which are versioned by their code.

Option 1integer
Option 2null
labelsobject[]required

The deploy labels the agent carries, such as production, and the version each points at.

labelstringrequired
versionintegerrequired
Maximum 9007199254740991
createdByobject | nullrequired

The user who created the agent. Null when an API key created it, or it predates creators being recorded.

Option 1object
idstringrequired
namestring | nullrequired
Option 2null
updatedByobject | nullrequired

The user who changed the agent last. Null when an API key changed it.

Option 1object
idstringrequired
namestring | nullrequired
Option 2null
createdAtstring (date-time)required
updatedAtstring (date-time)required
platformUrlstring (uri)required

Documentation