Creates a new agent
Agents API
Agent Create API
Create a new agent programmatically
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/publicThis is the new Agents API with native Vercel AI SDK compatibility. If you’re using the legacy Assistants API, see the migration guide.
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
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)
Only actions from integrations enabled in your workspace can be used.
Input Fields Configuration
When usinginputType: "STRUCTURED", you can define form fields in the inputFields array:
Supported Field Types:
TEXT- Single line text inputMULTI_LINE_TEXT- Multi-line text areaNUMBER- Numeric inputCHECKBOX- Boolean checkboxFILE- File uploadSELECT- Dropdown selectionDATE- Date pickerEMAIL- 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 theattachments 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
- Permissions - Your API key must have the
createAgentspermission - Name - Must be between 1-80 characters
- Description - Maximum 500 characters
- Instruction - Maximum 40000 characters
- Creativity - Must be between 0 and 1
Important Notes
- 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
createdByandworkspaceIdare 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
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