Before You Start
- API key scope: Requires an API key with the Agent API scope. Created agents are automatically shared with the API key for use in chat completions.
- 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.
Base URL
Parameters
Access Configuration
Useaccess to share the agent with users, groups, or your workspace. The existing Agent API scope is sufficient; the key owner’s workspace sharing permissions still apply.
- Roles -
"user"allows using the agent;"editor"allows editing it. Set an entry’sroletonullto revoke that direct grant. - Targets - New user grants require active users in the same workspace. Groups must belong to the workspace and be manageable by the key owner, unless workspace permissions allow sharing with any group. IDs must be unique within each array.
- Ownership - Owner and API-key grants cannot be changed through
access.
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.
Skills
- Pass Skill UUIDs from the Skills API in
skillIds. - The key owner must be able to attach each Skill. File templates are rejected.
Subagents
- Each object needs
agentId.requiresConfirmationis optional and defaults to false. - Omit the field or send
[]to attach none. DuplicateagentIdvalues keep the first object.
Workflows
- Pass workflow UUIDs in
workflowIds. - Omit the field or send
[]to attach none. Duplicate IDs are removed.
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 selectionMULTI_SELECT- Multi-selectDATE- 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
- Folders - Must exist in your workspace and not be deleted
- Skills - Each ID must be a Skill the key owner can attach. File templates are rejected
- Subagents - Each
agentIdmust be an agent in your workspace that the key owner can use. Agents set to Direct only are rejected - Workflows - Each ID must be an active workflow in your workspace that the key owner can use. Templates are rejected. When the list is not empty, the key owner needs Workflows enabled
- Permissions - Your API key must have the
createAgentspermission - Sharing - Sharing permissions and targets are validated before any changes are saved
- Name - Must be between 1-80 characters
- Description - Maximum 800 characters
- Instruction - Maximum 50000 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 key owner 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
agent.access is included only when the API key has an explicit editor or owner grant on the agent. It lists direct user, group, and workspace grants, excluding owner and API-key grants. sharingManagedByAdmin is read-only; when true, sharing cannot be changed through this API.
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.