Skip to main content
POST
Creates a new 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.
Creates a new agent in your workspace programmatically. The created agent can be used via the chat completions endpoint or accessed through the Langdock UI.
Requires an API key with the AGENT_API scope. Created agents are automatically shared with the API key for use in chat completions.

Request Parameters

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.

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)
Only actions from integrations enabled in your workspace can be used.

Input Fields Configuration

When using inputType: "STRUCTURED", you can define form fields in the inputFields array: Supported Field Types:
  • TEXT - Single line text input
  • MULTI_LINE_TEXT - Multi-line text area
  • NUMBER - Numeric input
  • CHECKBOX - Boolean checkbox
  • FILE - File upload
  • SELECT - Dropdown selection
  • MULTI_SELECT - Multi-select
  • DATE - Date picker
  • EMAIL - Email address

Obtaining Attachment IDs

To include attachments with your agent, first upload files using the Upload Attachment API. This will return attachment UUIDs that you can include in the attachments array.

Examples

Creating a Basic Agent

Validation Rules

The API enforces several validation rules:
  • Model - Must be in your workspace’s active models list
  • Actions - Must belong to integrations enabled in your workspace
  • Attachments - Must exist in your workspace and not be deleted
  • Folders - Must exist in your workspace and not be deleted
  • Permissions - Your API key must have the createAgents permission
  • Name - Must be between 1-80 characters
  • Description - Maximum 800 characters
  • Instruction - Maximum 50000 characters
  • Creativity - Must be between 0 and 1

Important Notes

Pre-selected OAuth connections are not supported via the API. Users must configure OAuth connections through the Langdock UI.
  • Created agents are automatically shared with your API key for use in chat completions
  • The API key creator becomes the owner and can manage the agent in the UI
  • Attachments are bidirectionally linked to the agent
  • createdBy and workspaceId are automatically set from your API key

Response Format

Success Response (201 Created)

Error Handling

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
name
string
required

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>
default:PROMPT

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
default:0.3

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
default:false

Enable image generation

dataAnalyst
boolean
default:false
deprecated

Deprecated. Accepted for compatibility and ignored.

extendedThinking
boolean
default:false

Enable extended thinking

attachments
string<uuid>[]

Attachment UUIDs

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

Folder UUIDs

Response

201 - application/json

Agent created successfully

status
enum<string>
required
Available options:
success
message
string
required
agent
object
required