Skip to main content
PATCH
Updates an existing agent
⚠️ Using our API via a dedicated deployment? Just replace api.langdock.com with your deployment’s base URL: <deployment-url>/api/public
This is the new Agents API with native Vercel AI SDK compatibility. If you’re using the legacy Assistants API, see the migration guide.
Updates an existing agent in your workspace. Only the fields you provide will be updated, allowing for partial updates without affecting other configuration.
Updates are applied to the agent’s draft only. The active (published) version remains unchanged until the agent is published from the Langdock UI.
Requires an API key with the AGENT_API scope and access to the agent you want to update.

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, and knowledgeFolderIds completely replace existing values when provided
  • Empty arrays - Send [] to remove all actions/fields/attachments
  • Null handling - Send null for emoji to clear it. For description and instruction, send an empty string "" to clear them
  • Unchanged fields - Fields not included in the request retain their current values

Request Parameters

Set any of the parameters below to overwrite the agent’s current settings. Fields you omit stay unchanged. Only agentId is required.
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 the actions array should contain:
  • actionId (required) - UUID of the action from an enabled integration
  • requiresConfirmation (optional) - Whether to require user confirmation before executing (default: true)

Input Fields Configuration

For inputFields array structure, see the Create Agent API documentation.

Examples

Updating Basic Properties

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)

Error Handling

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.
  1. Fetch before update - If you need to preserve existing array values, fetch the current agent configuration first
  2. Incremental updates - Update only the fields that need to change
  3. Validate attachments - Ensure attachment UUIDs are valid before including them
  4. Test actions - Verify actions belong to enabled integrations before updating
  5. 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

Authorization
string
header
required

API key as Bearer token. Format "Bearer YOUR_API_KEY"

Body

application/json
agentId
string<uuid>
required
name
string

Name of the agent or assistant

Required string length: 1 - 80
description
string

Description of what the agent or assistant does. Send an empty string to clear it during an update.

Maximum string length: 800
instruction
string

System prompt or instructions. Send an empty string to clear it during an update.

Maximum string length: 50000
inputType
enum<string>

Input type

Available options:
PROMPT,
STRUCTURED,
INTEGRATION,
SCHEDULED,
WEBHOOK
emoji
string | null

Emoji icon

Maximum string length: 16
model
string

Model deployment name

creativity
number

Temperature for response generation

Required range: 0 <= x <= 1
conversationStarters
string[]

Suggested prompts

Maximum array length: 20
Required string length: 1 - 255
actions
object[]

Actions that the agent or assistant can use

inputFields
object[]

Form fields for STRUCTURED input

Enable web search

imageGeneration
boolean

Enable image generation

dataAnalyst
boolean
deprecated

Deprecated. Accepted for compatibility and ignored.

extendedThinking
boolean

Enable extended thinking

attachments
string<uuid>[]

Attachment UUIDs

Maximum array length: 50
knowledgeFolderIds
string<uuid>[]

Folder UUIDs

Response

200 - application/json

Agent updated successfully

status
enum<string>
required
Available options:
success
message
string
required
Example:

"Agent updated successfully"

agent
object
required