curl --request POST \
--url https://api.langdock.com/agent/v1/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"access": {
"users": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"groups": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
},
"description": "<string>",
"instruction": "<string>",
"inputType": "PROMPT",
"emoji": "<string>",
"model": "<string>",
"creativity": 0.3,
"conversationStarters": [],
"actions": [],
"inputFields": [],
"webSearch": false,
"imageGeneration": false,
"dataAnalyst": false,
"extendedThinking": false,
"attachments": [],
"knowledgeFolderIds": []
}
'import requests
url = "https://api.langdock.com/agent/v1/create"
payload = {
"name": "<string>",
"access": {
"users": [{ "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }],
"groups": [{ "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }]
},
"description": "<string>",
"instruction": "<string>",
"inputType": "PROMPT",
"emoji": "<string>",
"model": "<string>",
"creativity": 0.3,
"conversationStarters": [],
"actions": [],
"inputFields": [],
"webSearch": False,
"imageGeneration": False,
"dataAnalyst": False,
"extendedThinking": False,
"attachments": [],
"knowledgeFolderIds": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
access: {
users: [{id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'}],
groups: [{id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'}]
},
description: '<string>',
instruction: '<string>',
inputType: 'PROMPT',
emoji: '<string>',
model: '<string>',
creativity: 0.3,
conversationStarters: [],
actions: [],
inputFields: [],
webSearch: false,
imageGeneration: false,
dataAnalyst: false,
extendedThinking: false,
attachments: [],
knowledgeFolderIds: []
})
};
fetch('https://api.langdock.com/agent/v1/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.langdock.com/agent/v1/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'access' => [
'users' => [
[
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
],
'groups' => [
[
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
]
],
'description' => '<string>',
'instruction' => '<string>',
'inputType' => 'PROMPT',
'emoji' => '<string>',
'model' => '<string>',
'creativity' => 0.3,
'conversationStarters' => [
],
'actions' => [
],
'inputFields' => [
],
'webSearch' => false,
'imageGeneration' => false,
'dataAnalyst' => false,
'extendedThinking' => false,
'attachments' => [
],
'knowledgeFolderIds' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.langdock.com/agent/v1/create"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"access\": {\n \"users\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"groups\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ]\n },\n \"description\": \"<string>\",\n \"instruction\": \"<string>\",\n \"inputType\": \"PROMPT\",\n \"emoji\": \"<string>\",\n \"model\": \"<string>\",\n \"creativity\": 0.3,\n \"conversationStarters\": [],\n \"actions\": [],\n \"inputFields\": [],\n \"webSearch\": false,\n \"imageGeneration\": false,\n \"dataAnalyst\": false,\n \"extendedThinking\": false,\n \"attachments\": [],\n \"knowledgeFolderIds\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.langdock.com/agent/v1/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"access\": {\n \"users\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"groups\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ]\n },\n \"description\": \"<string>\",\n \"instruction\": \"<string>\",\n \"inputType\": \"PROMPT\",\n \"emoji\": \"<string>\",\n \"model\": \"<string>\",\n \"creativity\": 0.3,\n \"conversationStarters\": [],\n \"actions\": [],\n \"inputFields\": [],\n \"webSearch\": false,\n \"imageGeneration\": false,\n \"dataAnalyst\": false,\n \"extendedThinking\": false,\n \"attachments\": [],\n \"knowledgeFolderIds\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langdock.com/agent/v1/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"access\": {\n \"users\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"groups\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ]\n },\n \"description\": \"<string>\",\n \"instruction\": \"<string>\",\n \"inputType\": \"PROMPT\",\n \"emoji\": \"<string>\",\n \"model\": \"<string>\",\n \"creativity\": 0.3,\n \"conversationStarters\": [],\n \"actions\": [],\n \"inputFields\": [],\n \"webSearch\": false,\n \"imageGeneration\": false,\n \"dataAnalyst\": false,\n \"extendedThinking\": false,\n \"attachments\": [],\n \"knowledgeFolderIds\": []\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "<string>",
"agent": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"instruction": "<string>",
"emojiIcon": "<string>",
"model": "<string>",
"temperature": 0.5,
"conversationStarters": [
"<string>"
],
"inputType": "PROMPT",
"webSearchEnabled": true,
"imageGenerationEnabled": true,
"canvasEnabled": true,
"extendedThinking": true,
"actions": [
{
"actionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"requiresConfirmation": true
}
],
"inputFields": [
{
"type": "TEXT",
"label": "<string>",
"description": "<string>",
"required": true,
"order": 1
}
],
"attachments": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"knowledgeFolderIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"access": {
"users": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"role": "user"
}
],
"groups": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"role": "user"
}
],
"workspace": "user",
"sharingManagedByAdmin": true
}
}
}Agent Create API
Einen neuen Agenten programmatisch erstellen
curl --request POST \
--url https://api.langdock.com/agent/v1/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"access": {
"users": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"groups": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
},
"description": "<string>",
"instruction": "<string>",
"inputType": "PROMPT",
"emoji": "<string>",
"model": "<string>",
"creativity": 0.3,
"conversationStarters": [],
"actions": [],
"inputFields": [],
"webSearch": false,
"imageGeneration": false,
"dataAnalyst": false,
"extendedThinking": false,
"attachments": [],
"knowledgeFolderIds": []
}
'import requests
url = "https://api.langdock.com/agent/v1/create"
payload = {
"name": "<string>",
"access": {
"users": [{ "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }],
"groups": [{ "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }]
},
"description": "<string>",
"instruction": "<string>",
"inputType": "PROMPT",
"emoji": "<string>",
"model": "<string>",
"creativity": 0.3,
"conversationStarters": [],
"actions": [],
"inputFields": [],
"webSearch": False,
"imageGeneration": False,
"dataAnalyst": False,
"extendedThinking": False,
"attachments": [],
"knowledgeFolderIds": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
access: {
users: [{id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'}],
groups: [{id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'}]
},
description: '<string>',
instruction: '<string>',
inputType: 'PROMPT',
emoji: '<string>',
model: '<string>',
creativity: 0.3,
conversationStarters: [],
actions: [],
inputFields: [],
webSearch: false,
imageGeneration: false,
dataAnalyst: false,
extendedThinking: false,
attachments: [],
knowledgeFolderIds: []
})
};
fetch('https://api.langdock.com/agent/v1/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.langdock.com/agent/v1/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'access' => [
'users' => [
[
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
],
'groups' => [
[
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
]
],
'description' => '<string>',
'instruction' => '<string>',
'inputType' => 'PROMPT',
'emoji' => '<string>',
'model' => '<string>',
'creativity' => 0.3,
'conversationStarters' => [
],
'actions' => [
],
'inputFields' => [
],
'webSearch' => false,
'imageGeneration' => false,
'dataAnalyst' => false,
'extendedThinking' => false,
'attachments' => [
],
'knowledgeFolderIds' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.langdock.com/agent/v1/create"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"access\": {\n \"users\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"groups\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ]\n },\n \"description\": \"<string>\",\n \"instruction\": \"<string>\",\n \"inputType\": \"PROMPT\",\n \"emoji\": \"<string>\",\n \"model\": \"<string>\",\n \"creativity\": 0.3,\n \"conversationStarters\": [],\n \"actions\": [],\n \"inputFields\": [],\n \"webSearch\": false,\n \"imageGeneration\": false,\n \"dataAnalyst\": false,\n \"extendedThinking\": false,\n \"attachments\": [],\n \"knowledgeFolderIds\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.langdock.com/agent/v1/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"access\": {\n \"users\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"groups\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ]\n },\n \"description\": \"<string>\",\n \"instruction\": \"<string>\",\n \"inputType\": \"PROMPT\",\n \"emoji\": \"<string>\",\n \"model\": \"<string>\",\n \"creativity\": 0.3,\n \"conversationStarters\": [],\n \"actions\": [],\n \"inputFields\": [],\n \"webSearch\": false,\n \"imageGeneration\": false,\n \"dataAnalyst\": false,\n \"extendedThinking\": false,\n \"attachments\": [],\n \"knowledgeFolderIds\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langdock.com/agent/v1/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"access\": {\n \"users\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"groups\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ]\n },\n \"description\": \"<string>\",\n \"instruction\": \"<string>\",\n \"inputType\": \"PROMPT\",\n \"emoji\": \"<string>\",\n \"model\": \"<string>\",\n \"creativity\": 0.3,\n \"conversationStarters\": [],\n \"actions\": [],\n \"inputFields\": [],\n \"webSearch\": false,\n \"imageGeneration\": false,\n \"dataAnalyst\": false,\n \"extendedThinking\": false,\n \"attachments\": [],\n \"knowledgeFolderIds\": []\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "<string>",
"agent": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"instruction": "<string>",
"emojiIcon": "<string>",
"model": "<string>",
"temperature": 0.5,
"conversationStarters": [
"<string>"
],
"inputType": "PROMPT",
"webSearchEnabled": true,
"imageGenerationEnabled": true,
"canvasEnabled": true,
"extendedThinking": true,
"actions": [
{
"actionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"requiresConfirmation": true
}
],
"inputFields": [
{
"type": "TEXT",
"label": "<string>",
"description": "<string>",
"required": true,
"order": 1
}
],
"attachments": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"knowledgeFolderIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"access": {
"users": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"role": "user"
}
],
"groups": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"role": "user"
}
],
"workspace": "user",
"sharingManagedByAdmin": true
}
}
}Bevor du startest
- API-Key-Scope: Erfordert einen API-Schlüssel mit dem Agenten API-Scope. Erstellte Agenten werden automatisch mit dem API-Schlüssel geteilt, um sie in Chat-Completions zu verwenden.
- Veraltete Assistants API: Dies ist die neue Agents API mit nativer Vercel AI SDK Kompatibilität. Wenn du die veraltete Assistants API verwendest, siehe den Migrations-Guide.
Basis-URL
https://api.langdock.com/agent/v1/create
api.langdock.com durch <your-deployment-url>/api/public in allen Anfragen.Parameter
| Parameter | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
name | string | Ja | Name des Agenten (1-80 Zeichen) |
description | string | Nein | Beschreibung der Agentenfunktion (max. 800 Zeichen) |
emoji | string | Nein | Emoji-Icon für den Agenten (max. 16 Zeichen, z.B. ”🤖“) |
instruction | string | Nein | Systemanweisung/Instruktionen für den Agenten (max. 50000 Zeichen) |
inputType | string | Nein | Eingabetyp: “PROMPT”, “STRUCTURED”, “INTEGRATION”, “SCHEDULED” oder “WEBHOOK” (Standard: “PROMPT”) |
model | string | Nein | id von der Models API. Eindeutige Namen und Anthropic-Aliase bleiben gültig. Verwendet Workspace-Standard wenn nicht angegeben |
creativity | number | Nein | Temperatur zwischen 0-1 (Standard: 0.3) |
conversationStarters | string[] | Nein | Array von vorgeschlagenen Prompts zum Einstieg (max. 20, je 1-255 Zeichen) |
actions | array | Nein | Array von Action-Objekten für benutzerdefinierte Integrationen |
inputFields | array | Nein | Array von Formularfeld-Definitionen (für STRUCTURED Eingabetyp) |
attachments | string[] | Nein | Array von bis zu 50 Anhang-UUIDs für den Agenten |
knowledgeFolderIds | string[] | Nein | Array von Ordner-UUIDs für den Agenten |
skillIds | string[] | Nein | Skill-UUIDs zum Anhängen. Siehe Skills |
webSearch | boolean | Nein | Websuche-Fähigkeit aktivieren (Standard: false) |
imageGeneration | boolean | Nein | Bildgenerierungs-Fähigkeit aktivieren (Standard: false) |
dataAnalyst | boolean | Nein | Zur Kompatibilität akzeptiert. Siehe Warnhinweis unten |
extendedThinking | boolean | Nein | Extended-Thinking-Modus aktivieren (Standard: false) |
access | object | Nein | Benutzer-, Gruppen- und Workspace-Freigaben. Siehe Zugriffskonfiguration |
dataAnalyst ist veraltet und hat keine Wirkung. Anfragen mit diesem Parameter sind aus Gründen der Abwärtskompatibilität weiterhin erfolgreich, aber Langdock ignoriert den Wert und aktiviert weder Dateiarbeit noch Codeausführung. Lass diesen Parameter in neuen Integrationen weg.Zugriffskonfiguration
Mitaccess teilst du den Agenten mit Benutzern, Gruppen oder deinem Workspace. Der vorhandene Agenten API-Scope reicht aus; die Freigabeberechtigungen des Schlüsselbesitzers im Workspace gelten weiterhin.
| Feld | Typ | Beschreibung |
|---|---|---|
users | array | Bis zu 100 Objekte mit einer Benutzer-UUID in id und einer role |
groups | array | Bis zu 100 Objekte mit einer Gruppen-UUID in id und einer role |
workspace | string oder null | "user" oder "editor" für workspaceweiten Zugriff, oder null zum Entfernen |
- Rollen -
"user"erlaubt die Nutzung des Agenten;"editor"erlaubt die Bearbeitung. Setzeroleeines Eintrags aufnull, um diese direkte Freigabe zu entfernen. - Empfänger - Neue Benutzerfreigaben erfordern aktive Benutzer im selben Workspace. Gruppen müssen zum Workspace gehören und vom Schlüsselbesitzer verwaltet werden können, sofern die Workspace-Berechtigungen nicht das Teilen mit beliebigen Gruppen erlauben. IDs müssen innerhalb jedes Arrays eindeutig sein.
- Besitz - Besitzer- und API-Schlüssel-Freigaben können über
accessnicht geändert werden.
{
"name": "Geteilter Agent",
"access": {
"users": [{ "id": "550e8400-e29b-41d4-a716-446655440001", "role": "editor" }],
"workspace": "user"
}
}
Actions-Konfiguration
Jede Action imactions Array sollte enthalten:
actionId(erforderlich) - UUID der Action aus einer aktivierten IntegrationrequiresConfirmation(optional) - Ob vor der Ausführung eine Benutzerbestätigung erforderlich ist (Standard: true)
Skills
- Übergib Skill-UUIDs aus der Skills API in
skillIds. - Der User, dem der API-Schlüssel gehört, muss jeden Skill anhängen können. Dateivorlagen werden abgelehnt.
Eingabefelder-Konfiguration
Bei Verwendung voninputType: "STRUCTURED" kannst du Formularfelder im inputFields Array definieren:
| Feld | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
slug | string | Ja | Eindeutiger Bezeichner für das Feld |
type | string | Ja | Feldtyp (siehe unterstützte Typen unten) |
label | string | Ja | Anzeigebezeichnung für das Feld |
description | string | Nein | Hilfetext für das Feld |
required | boolean | Nein | Ob das Feld erforderlich ist (Standard: false) |
order | number | Ja | Anzeigereihenfolge (0-indiziert) |
options | string[] | Nein | Optionen für SELECT- und MULTI_SELECT-Feldtypen |
fileTypes | string | Nein | Erlaubte Dateitypen für FILE-Feldtypen (nullable) |
emailDomain | string | Nein | Erlaubte E-Mail-Domain für EMAIL-Feldtypen |
TEXT- Einzeilige TexteingabeMULTI_LINE_TEXT- Mehrzeiliger TextbereichNUMBER- Numerische EingabeCHECKBOX- Boolean-CheckboxFILE- Datei-UploadSELECT- Dropdown-AuswahlMULTI_SELECT- MehrfachauswahlDATE- DatumsauswahlEMAIL- E-Mail-Adresse
Anhangs-IDs abrufen
Um Anhänge in deinen Agenten einzubinden, lade zuerst Dateien mit der Upload Attachment API hoch. Dies gibt Anhang-UUIDs zurück, die du imattachments Array verwenden kannst.
Beispiele
Einen einfachen Agenten erstellen
const axios = require("axios");
async function createBasicAgent() {
const response = await axios.post(
"https://api.langdock.com/agent/v1/create",
{
name: "Dokumentenanalyse",
description: "Analysiert und fasst Dokumente zusammen",
emoji: "📄",
instruction: "Du bist ein hilfreicher Agent, der Dokumente analysiert und klare Zusammenfassungen der wichtigsten Informationen liefert.",
creativity: 0.5,
conversationStarters: [
"Fasse dieses Dokument zusammen",
"Was sind die wichtigsten Punkte?",
"Extrahiere Aktionspunkte"
],
webSearch: false
},
{
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
}
);
console.log("Agent erstellt:", response.data.agent.id);
}
Validierungsregeln
Die API wendet mehrere Validierungsregeln an:- Modell - Muss in der Liste der aktiven Modelle deines Workspaces sein
- Actions - Müssen zu in deinem Workspace aktivierten Integrationen gehören
- Anhänge - Müssen in deinem Workspace existieren und nicht gelöscht sein
- Ordner - Müssen in deinem Workspace existieren und nicht gelöscht sein
- Skills - Jede ID muss ein Skill sein, den der User, dem der API-Schlüssel gehört, anhängen kann. Dateivorlagen werden abgelehnt
- Berechtigungen - Dein API-Schlüssel muss die
createAgentsBerechtigung haben - Freigaben - Freigabeberechtigungen und Empfänger werden geprüft, bevor Änderungen gespeichert werden
- Name - Muss zwischen 1-80 Zeichen sein
- Beschreibung - Maximal 800 Zeichen
- Instruktion - Maximal 50000 Zeichen
- Creativity - Muss zwischen 0 und 1 liegen
Wichtige Hinweise
- Erstellte Agenten werden automatisch mit deinem API-Schlüssel für die Verwendung in Chat-Completions geteilt
- Der User, dem der API-Schlüssel gehört, wird zum Eigentümer und kann den Agenten in der Benutzeroberfläche verwalten
- Anhänge sind bidirektional mit dem Agenten verknüpft
createdByundworkspaceIdwerden automatisch aus deinem API-Schlüssel übernommen
Antwortformat
agent.access ist nur enthalten, wenn der API-Schlüssel eine direkte Editor- oder Besitzerfreigabe für den Agenten hat. Es listet direkte Benutzer-, Gruppen- und Workspace-Freigaben auf, ohne Besitzer- und API-Schlüssel-Freigaben. sharingManagedByAdmin ist schreibgeschützt; bei true können Freigaben über diese API nicht geändert werden.
Erfolgreiche Antwort (201 Created)
{
status: "success";
message: "Agent created successfully";
agent: {
id: string;
name: string;
description: string | null;
instruction: string | null;
emojiIcon: string | null;
model: string | null;
temperature: number;
conversationStarters: string[];
inputType: "PROMPT" | "STRUCTURED" | "INTEGRATION" | "SCHEDULED" | "WEBHOOK";
webSearchEnabled: boolean;
imageGenerationEnabled: boolean;
canvasEnabled: boolean;
extendedThinking: boolean;
actions: Array<{
actionId: string;
requiresConfirmation: boolean;
}>;
inputFields: Array<{
type: "TEXT" | "MULTI_LINE_TEXT" | "NUMBER" | "CHECKBOX" | "FILE" | "SELECT" | "MULTI_SELECT" | "DATE" | "EMAIL";
label: string;
description: string | null;
required: boolean;
order: number;
}>;
attachments: string[];
knowledgeFolderIds: string[];
skillIds: string[];
owner: {
id: string;
name: string | null;
email: string;
} | null;
createdAt: string;
updatedAt: string;
access?: {
users: Array<{ id: string; role: "user" | "editor" }>;
groups: Array<{ id: string; role: "user" | "editor" }>;
workspace: "user" | "editor" | null;
sharingManagedByAdmin: boolean;
};
};
}
Fehlerbehandlung
try {
const response = await axios.post('https://api.langdock.com/agent/v1/create', ...);
} catch (error) {
if (error.response) {
switch (error.response.status) {
case 400:
console.error('Ungültige Parameter oder Ressource nicht gefunden:', error.response.data.message);
break;
case 401:
console.error('Ungültiger oder fehlender API-Schlüssel');
break;
case 403:
console.error('Unzureichende Berechtigungen - erfordert den Agenten API-Scope');
break;
case 429:
console.error('Rate Limit überschritten');
break;
case 500:
console.error('Server-Fehler');
break;
}
}
}
Autorisierungen
API key as Bearer token. Format "Bearer YOUR_API_KEY"
Body
Name of the agent or assistant
1 - 80Sharing changes under the Agent API scope and the key owner's workspace sharing permissions. Updating access requires an explicit editor or owner key grant. New user and group grants send in-app notifications after commit; repeated grants, role changes, and revocations do not. No email is sent. Omitted targets and empty arrays leave access unchanged. Owner and API-key grants cannot be changed. Admin-managed sharing cannot be updated.
Show child attributes
Show child attributes
Description of what the agent or assistant does. Send an empty string to clear it during an update.
800System prompt or instructions. Send an empty string to clear it during an update.
50000Input type
PROMPT, STRUCTURED, INTEGRATION, SCHEDULED, WEBHOOK Emoji icon
16id from GET /agent/v1/models. Unique deployment names and Anthropic aliases stay valid. When several accessible rows share a name, send the UUID id.
Temperature for response generation
0 <= x <= 1Suggested prompts
201 - 255Actions that the agent or assistant can use. On update, the array replaces the draft list.
Show child attributes
Show child attributes
Form fields for STRUCTURED input
Show child attributes
Show child attributes
Enable web search
Enable image generation
Deprecated. Accepted for compatibility and ignored.
Enable extended thinking
Attachment UUIDs
50Folder UUIDs
War diese Seite hilfreich?