Updates an existing agent
Agents API
Agent Update API
Update an existing agent programmatically
PATCH
Updates an existing agent
Documentation Index
Fetch the complete documentation index at: https://docs.langdock.com/llms.txt
Use this file to discover all available pages before exploring further.
⚠️ Using our API via a dedicated deployment? Just replace
api.langdock.com with your deployment’s base URL: <deployment-url>/api/publicThis is the new Agents API with native Vercel AI SDK compatibility. If you’re using the legacy Assistants API, see the migration guide.
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, andattachmentscompletely 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
Request 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 500 chars, "" to clear) |
emoji | string | No | Emoji icon (max 16 chars, null to clear) |
instruction | string | No | System prompt (max 40000 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 | Attachment UUIDs (replaces existing) |
webSearch | boolean | No | Enable web search |
imageGeneration | boolean | No | Enable image generation |
dataAnalyst | boolean | No | Enable code interpreter |
inputType | string | No | Input type: “PROMPT” or “STRUCTURED” |
canvas | boolean | No | Enable canvas |
extendedThinking | boolean | No | Enable extended thinking mode |
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
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
- Name - If provided, must be between 1-80 characters
- Description - If provided, maximum 500 characters
- Instruction - If provided, maximum 40000 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.- 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
Maximum string length:
64Maximum string length:
16384Maximum string length:
256Required range:
0 <= x <= 1Maximum string length:
64Array of UUID strings identifying attachments for this message
Response
200
Agent updated successfully