Updates an existing agent
curl --request PATCH \
--url https://api.langdock.com/agent/v1/update \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"instruction": "<string>",
"emoji": "<string>",
"model": "<string>",
"creativity": 0.5,
"conversationStarters": [
"<string>"
],
"actions": [
{
"actionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"requiresConfirmation": true
}
],
"inputFields": [
{
"slug": "<string>",
"label": "<string>",
"order": 1,
"description": "<string>",
"required": false,
"options": [],
"fileTypes": "<string>",
"emailDomain": "<string>"
}
],
"webSearch": true,
"imageGeneration": true,
"dataAnalyst": true,
"extendedThinking": true,
"attachments": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"knowledgeFolderIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}
'import requests
url = "https://api.langdock.com/agent/v1/update"
payload = {
"agentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"instruction": "<string>",
"emoji": "<string>",
"model": "<string>",
"creativity": 0.5,
"conversationStarters": ["<string>"],
"actions": [
{
"actionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"requiresConfirmation": True
}
],
"inputFields": [
{
"slug": "<string>",
"label": "<string>",
"order": 1,
"description": "<string>",
"required": False,
"options": [],
"fileTypes": "<string>",
"emailDomain": "<string>"
}
],
"webSearch": True,
"imageGeneration": True,
"dataAnalyst": True,
"extendedThinking": True,
"attachments": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"knowledgeFolderIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agentId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: '<string>',
description: '<string>',
instruction: '<string>',
emoji: '<string>',
model: '<string>',
creativity: 0.5,
conversationStarters: ['<string>'],
actions: [{actionId: '3c90c3cc-0d44-4b50-8888-8dd25736052a', requiresConfirmation: true}],
inputFields: [
{
slug: '<string>',
label: '<string>',
order: 1,
description: '<string>',
required: false,
options: [],
fileTypes: '<string>',
emailDomain: '<string>'
}
],
webSearch: true,
imageGeneration: true,
dataAnalyst: true,
extendedThinking: true,
attachments: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
knowledgeFolderIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a']
})
};
fetch('https://api.langdock.com/agent/v1/update', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.langdock.com/agent/v1/update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'agentId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => '<string>',
'description' => '<string>',
'instruction' => '<string>',
'emoji' => '<string>',
'model' => '<string>',
'creativity' => 0.5,
'conversationStarters' => [
'<string>'
],
'actions' => [
[
'actionId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'requiresConfirmation' => true
]
],
'inputFields' => [
[
'slug' => '<string>',
'label' => '<string>',
'order' => 1,
'description' => '<string>',
'required' => false,
'options' => [
],
'fileTypes' => '<string>',
'emailDomain' => '<string>'
]
],
'webSearch' => true,
'imageGeneration' => true,
'dataAnalyst' => true,
'extendedThinking' => true,
'attachments' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'knowledgeFolderIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.langdock.com/agent/v1/update"
payload := strings.NewReader("{\n \"agentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"instruction\": \"<string>\",\n \"emoji\": \"<string>\",\n \"model\": \"<string>\",\n \"creativity\": 0.5,\n \"conversationStarters\": [\n \"<string>\"\n ],\n \"actions\": [\n {\n \"actionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"requiresConfirmation\": true\n }\n ],\n \"inputFields\": [\n {\n \"slug\": \"<string>\",\n \"label\": \"<string>\",\n \"order\": 1,\n \"description\": \"<string>\",\n \"required\": false,\n \"options\": [],\n \"fileTypes\": \"<string>\",\n \"emailDomain\": \"<string>\"\n }\n ],\n \"webSearch\": true,\n \"imageGeneration\": true,\n \"dataAnalyst\": true,\n \"extendedThinking\": true,\n \"attachments\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"knowledgeFolderIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.langdock.com/agent/v1/update")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"instruction\": \"<string>\",\n \"emoji\": \"<string>\",\n \"model\": \"<string>\",\n \"creativity\": 0.5,\n \"conversationStarters\": [\n \"<string>\"\n ],\n \"actions\": [\n {\n \"actionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"requiresConfirmation\": true\n }\n ],\n \"inputFields\": [\n {\n \"slug\": \"<string>\",\n \"label\": \"<string>\",\n \"order\": 1,\n \"description\": \"<string>\",\n \"required\": false,\n \"options\": [],\n \"fileTypes\": \"<string>\",\n \"emailDomain\": \"<string>\"\n }\n ],\n \"webSearch\": true,\n \"imageGeneration\": true,\n \"dataAnalyst\": true,\n \"extendedThinking\": true,\n \"attachments\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"knowledgeFolderIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langdock.com/agent/v1/update")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"instruction\": \"<string>\",\n \"emoji\": \"<string>\",\n \"model\": \"<string>\",\n \"creativity\": 0.5,\n \"conversationStarters\": [\n \"<string>\"\n ],\n \"actions\": [\n {\n \"actionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"requiresConfirmation\": true\n }\n ],\n \"inputFields\": [\n {\n \"slug\": \"<string>\",\n \"label\": \"<string>\",\n \"order\": 1,\n \"description\": \"<string>\",\n \"required\": false,\n \"options\": [],\n \"fileTypes\": \"<string>\",\n \"emailDomain\": \"<string>\"\n }\n ],\n \"webSearch\": true,\n \"imageGeneration\": true,\n \"dataAnalyst\": true,\n \"extendedThinking\": true,\n \"attachments\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"knowledgeFolderIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Agent updated successfully",
"agent": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"instruction": "<string>",
"emojiIcon": "<string>",
"model": "<string>",
"temperature": 0.5,
"conversationStarters": [
"<string>"
],
"inputType": "PROMPT",
"webSearchEnabled": true,
"imageGenerationEnabled": true,
"canvasEnabled": true,
"extendedThinking": true,
"actions": [
{
"actionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"requiresConfirmation": true
}
],
"inputFields": [
{
"type": "TEXT",
"label": "<string>",
"description": "<string>",
"required": true,
"order": 1
}
],
"attachments": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"knowledgeFolderIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}Agents API
Agent Update API
Update an existing agent programmatically
PATCH
/
agent
/
v1
/
update
Updates an existing agent
curl --request PATCH \
--url https://api.langdock.com/agent/v1/update \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"instruction": "<string>",
"emoji": "<string>",
"model": "<string>",
"creativity": 0.5,
"conversationStarters": [
"<string>"
],
"actions": [
{
"actionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"requiresConfirmation": true
}
],
"inputFields": [
{
"slug": "<string>",
"label": "<string>",
"order": 1,
"description": "<string>",
"required": false,
"options": [],
"fileTypes": "<string>",
"emailDomain": "<string>"
}
],
"webSearch": true,
"imageGeneration": true,
"dataAnalyst": true,
"extendedThinking": true,
"attachments": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"knowledgeFolderIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}
'import requests
url = "https://api.langdock.com/agent/v1/update"
payload = {
"agentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"instruction": "<string>",
"emoji": "<string>",
"model": "<string>",
"creativity": 0.5,
"conversationStarters": ["<string>"],
"actions": [
{
"actionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"requiresConfirmation": True
}
],
"inputFields": [
{
"slug": "<string>",
"label": "<string>",
"order": 1,
"description": "<string>",
"required": False,
"options": [],
"fileTypes": "<string>",
"emailDomain": "<string>"
}
],
"webSearch": True,
"imageGeneration": True,
"dataAnalyst": True,
"extendedThinking": True,
"attachments": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"knowledgeFolderIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agentId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
name: '<string>',
description: '<string>',
instruction: '<string>',
emoji: '<string>',
model: '<string>',
creativity: 0.5,
conversationStarters: ['<string>'],
actions: [{actionId: '3c90c3cc-0d44-4b50-8888-8dd25736052a', requiresConfirmation: true}],
inputFields: [
{
slug: '<string>',
label: '<string>',
order: 1,
description: '<string>',
required: false,
options: [],
fileTypes: '<string>',
emailDomain: '<string>'
}
],
webSearch: true,
imageGeneration: true,
dataAnalyst: true,
extendedThinking: true,
attachments: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
knowledgeFolderIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a']
})
};
fetch('https://api.langdock.com/agent/v1/update', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.langdock.com/agent/v1/update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'agentId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'name' => '<string>',
'description' => '<string>',
'instruction' => '<string>',
'emoji' => '<string>',
'model' => '<string>',
'creativity' => 0.5,
'conversationStarters' => [
'<string>'
],
'actions' => [
[
'actionId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'requiresConfirmation' => true
]
],
'inputFields' => [
[
'slug' => '<string>',
'label' => '<string>',
'order' => 1,
'description' => '<string>',
'required' => false,
'options' => [
],
'fileTypes' => '<string>',
'emailDomain' => '<string>'
]
],
'webSearch' => true,
'imageGeneration' => true,
'dataAnalyst' => true,
'extendedThinking' => true,
'attachments' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'knowledgeFolderIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.langdock.com/agent/v1/update"
payload := strings.NewReader("{\n \"agentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"instruction\": \"<string>\",\n \"emoji\": \"<string>\",\n \"model\": \"<string>\",\n \"creativity\": 0.5,\n \"conversationStarters\": [\n \"<string>\"\n ],\n \"actions\": [\n {\n \"actionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"requiresConfirmation\": true\n }\n ],\n \"inputFields\": [\n {\n \"slug\": \"<string>\",\n \"label\": \"<string>\",\n \"order\": 1,\n \"description\": \"<string>\",\n \"required\": false,\n \"options\": [],\n \"fileTypes\": \"<string>\",\n \"emailDomain\": \"<string>\"\n }\n ],\n \"webSearch\": true,\n \"imageGeneration\": true,\n \"dataAnalyst\": true,\n \"extendedThinking\": true,\n \"attachments\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"knowledgeFolderIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.langdock.com/agent/v1/update")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"instruction\": \"<string>\",\n \"emoji\": \"<string>\",\n \"model\": \"<string>\",\n \"creativity\": 0.5,\n \"conversationStarters\": [\n \"<string>\"\n ],\n \"actions\": [\n {\n \"actionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"requiresConfirmation\": true\n }\n ],\n \"inputFields\": [\n {\n \"slug\": \"<string>\",\n \"label\": \"<string>\",\n \"order\": 1,\n \"description\": \"<string>\",\n \"required\": false,\n \"options\": [],\n \"fileTypes\": \"<string>\",\n \"emailDomain\": \"<string>\"\n }\n ],\n \"webSearch\": true,\n \"imageGeneration\": true,\n \"dataAnalyst\": true,\n \"extendedThinking\": true,\n \"attachments\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"knowledgeFolderIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langdock.com/agent/v1/update")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"instruction\": \"<string>\",\n \"emoji\": \"<string>\",\n \"model\": \"<string>\",\n \"creativity\": 0.5,\n \"conversationStarters\": [\n \"<string>\"\n ],\n \"actions\": [\n {\n \"actionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"requiresConfirmation\": true\n }\n ],\n \"inputFields\": [\n {\n \"slug\": \"<string>\",\n \"label\": \"<string>\",\n \"order\": 1,\n \"description\": \"<string>\",\n \"required\": false,\n \"options\": [],\n \"fileTypes\": \"<string>\",\n \"emailDomain\": \"<string>\"\n }\n ],\n \"webSearch\": true,\n \"imageGeneration\": true,\n \"dataAnalyst\": true,\n \"extendedThinking\": true,\n \"attachments\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"knowledgeFolderIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Agent updated successfully",
"agent": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"instruction": "<string>",
"emojiIcon": "<string>",
"model": "<string>",
"temperature": 0.5,
"conversationStarters": [
"<string>"
],
"inputType": "PROMPT",
"webSearchEnabled": true,
"imageGenerationEnabled": true,
"canvasEnabled": true,
"extendedThinking": true,
"actions": [
{
"actionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"requiresConfirmation": true
}
],
"inputFields": [
{
"type": "TEXT",
"label": "<string>",
"description": "<string>",
"required": true,
"order": 1
}
],
"attachments": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"knowledgeFolderIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}Updates an existing agent in your workspace. Only the fields you provide will be updated, allowing for partial updates without affecting other configuration.
Before You Start
- API key scope: Requires an API key with the Agent API scope and access to the agent you want to update.
- Legacy Assistants API: This is the new Agents API with native Vercel AI SDK compatibility. If you’re using the legacy Assistants API, see the migration guide.
- Draft only: Updates are applied to the agent’s draft only. The active (published) version remains unchanged until the agent is published from the Langdock UI.
Base URL
https://api.langdock.com/agent/v1/update
Dedicated deploymentsReplace
api.langdock.com with <your-deployment-url>/api/public in all requests.Update Behavior
The update endpoint uses partial update semantics with specific behavior for different field types:- Partial updates - Only fields provided in the request are updated; omitted fields remain unchanged
- Array fields replace -
actions,inputFields,conversationStarters,attachments, andknowledgeFolderIdscompletely replace existing values when provided - Empty arrays - Send
[]to remove all actions/fields/attachments - Null handling - Send
nullforemojito clear it. Fordescriptionandinstruction, send an empty string""to clear them - Unchanged fields - Fields not included in the request retain their current values
Parameters
Set any of the parameters below to overwrite the agent’s current settings. Fields you omit stay unchanged. OnlyagentId is required.
| Parameter | Type | Required | Description |
|---|---|---|---|
agentId | string | Yes | UUID of the agent to update |
name | string | No | Agent name (1-80 characters) |
description | string | No | Description (max 800 chars, "" to clear) |
emoji | string | No | Emoji icon (max 16 chars, null to clear) |
instruction | string | No | System prompt (max 50000 chars, "" to clear) |
model | string | No | Model identifier (deployment name from the Models API) |
creativity | number | No | Temperature between 0 and 1 |
conversationStarters | string[] | No | Suggested prompts, max 20, each 1-255 chars (replaces existing) |
actions | array | No | Actions (replaces existing) |
inputFields | array | No | Form fields (replaces existing) |
attachments | string[] | No | Up to 50 attachment UUIDs (replaces existing) |
knowledgeFolderIds | string[] | No | Folder UUIDs (replaces existing) |
webSearch | boolean | No | Enable web search |
imageGeneration | boolean | No | Enable image generation |
dataAnalyst | boolean | No | Accepted for compatibility. See warning below |
inputType | string | No | Input type: “PROMPT”, “STRUCTURED”, “INTEGRATION”, “SCHEDULED”, or “WEBHOOK” |
extendedThinking | boolean | No | Enable extended thinking mode |
The
dataAnalyst parameter is deprecated and has no effect. Requests that include it still succeed for backward compatibility, but Langdock ignores the value and does not enable file or code execution. Omit this parameter from new integrations.Array fields (
actions, inputFields, conversationStarters, attachments, knowledgeFolderIds) are replaced entirely, not merged. Always provide the complete desired array, including any existing items you want to keep.Actions Configuration
Each action in theactions array should contain:
actionId(required) - UUID of the action from an enabled integrationrequiresConfirmation(optional) - Whether to require user confirmation before executing (default: true)
Input Fields Configuration
ForinputFields array structure, see the Create Agent API documentation.
Examples
Updating Basic Properties
const axios = require("axios");
async function updateAgentName() {
const response = await axios.patch(
"https://api.langdock.com/agent/v1/update",
{
agentId: "550e8400-e29b-41d4-a716-446655440000",
name: "Advanced Document Analyzer",
description: "Analyzes documents with enhanced capabilities",
creativity: 0.7
},
{
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
}
);
console.log("Agent updated:", response.data.message);
}
Validation Rules
The API enforces several validation rules:- Agent access - Your API key must have access to the agent
- Workspace match - Agent must belong to the same workspace as your API key
- Model - If provided, must be in your workspace’s active models list
- Actions - If provided, must belong to integrations enabled in your workspace
- Attachments - If provided, must exist in your workspace and not be deleted
- Folders - If provided, must exist in your workspace and not be deleted
- Name - If provided, must be between 1-80 characters
- Description - If provided, maximum 800 characters
- Instruction - If provided, maximum 50000 characters
- Creativity - If provided, must be between 0 and 1
Response Format
Success Response (200 OK)
{
status: "success";
message: "Agent updated successfully";
agent: {
id: string;
name: string;
description: string | null;
instruction: string | null;
emojiIcon: string | null;
model: string | null;
temperature: number;
conversationStarters: string[];
inputType: "PROMPT" | "STRUCTURED" | "INTEGRATION" | "SCHEDULED" | "WEBHOOK";
webSearchEnabled: boolean;
imageGenerationEnabled: boolean;
canvasEnabled: boolean;
extendedThinking: boolean;
actions: Array<{
actionId: string;
requiresConfirmation: boolean;
}>;
inputFields: Array<{
type: "TEXT" | "MULTI_LINE_TEXT" | "NUMBER" | "CHECKBOX" | "FILE" | "SELECT" | "MULTI_SELECT" | "DATE" | "EMAIL";
label: string;
description: string | null;
required: boolean;
order: number;
}>;
attachments: string[];
knowledgeFolderIds: string[];
owner: {
id: string;
name: string | null;
email: string;
} | null;
createdAt: string;
updatedAt: string;
};
}
Error Handling
try {
const response = await axios.patch('https://api.langdock.com/agent/v1/update', ...);
} catch (error) {
if (error.response) {
switch (error.response.status) {
case 400:
console.error('Invalid parameters or resource not found:', error.response.data.message);
break;
case 401:
console.error('Invalid or missing API key');
break;
case 403:
console.error('Insufficient permissions - no access to this agent');
break;
case 404:
console.error('Agent not found or API key does not have access');
break;
case 429:
console.error('Rate limit exceeded');
break;
case 500:
console.error('Server error');
break;
}
}
}
Best Practices
Preserving existing values: When updating array fields like
actions or attachments, always include existing items you want to keep, as the entire array is replaced.- Fetch before update - If you need to preserve existing array values, fetch the current agent configuration first
- Incremental updates - Update only the fields that need to change
- Validate attachments - Ensure attachment UUIDs are valid before including them
- Test actions - Verify actions belong to enabled integrations before updating
- Handle errors gracefully - Implement proper error handling for validation failures
Langdock intentionally blocks browser-origin requests to protect your API key and ensure your applications remain secure. For more information, please see our guide on API Key Best Practices.
Authorizations
API key as Bearer token. Format "Bearer YOUR_API_KEY"
Body
application/json
Name of the agent or assistant
Required string length:
1 - 80Description of what the agent or assistant does. Send an empty string to clear it during an update.
Maximum string length:
800System prompt or instructions. Send an empty string to clear it during an update.
Maximum string length:
50000Input type
Available options:
PROMPT, STRUCTURED, INTEGRATION, SCHEDULED, WEBHOOK Emoji icon
Maximum string length:
16Model deployment name
Temperature for response generation
Required range:
0 <= x <= 1Suggested prompts
Maximum array length:
20Required string length:
1 - 255Actions that the agent or assistant can use
Show child attributes
Show child attributes
Form fields for STRUCTURED input
Show child attributes
Show child attributes
Enable web search
Enable image generation
Deprecated. Accepted for compatibility and ignored.
Enable extended thinking
Attachment UUIDs
Maximum array length:
50Folder UUIDs
Was this page helpful?