Retrieves details of an existing agent
curl --request GET \
--url https://api.langdock.com/agent/v1/get \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.langdock.com/agent/v1/get"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.langdock.com/agent/v1/get', 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/get",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.langdock.com/agent/v1/get"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.langdock.com/agent/v1/get")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langdock.com/agent/v1/get")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": "<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"
}
}Agents API
Agent Get API
Details eines vorhandenen Agenten abrufen
GET
/
agent
/
v1
/
get
Retrieves details of an existing agent
curl --request GET \
--url https://api.langdock.com/agent/v1/get \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.langdock.com/agent/v1/get"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.langdock.com/agent/v1/get', 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/get",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.langdock.com/agent/v1/get"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.langdock.com/agent/v1/get")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langdock.com/agent/v1/get")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": "<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"
}
}Ruft die verfügbaren aktuellen Einstellungen und Details eines vorhandenen Agenten in deinem Workspace ab. Der Endpoint gibt die aktive (veröffentlichte) Version des Agenten zurück. Wenn der Agent noch nie veröffentlicht wurde, wird stattdessen der aktuelle Entwurf zurückgegeben.
Bevor du startest
- API-Key-Scope: Erfordert einen API-Schlüssel mit dem Agenten API-Scope und Zugriff auf den Agenten, den du abrufen möchtest.
- 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/get
Dedicated DeploymentsErsetze
api.langdock.com durch <your-deployment-url>/api/public in allen Anfragen.Parameter
| Parameter | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
agentId | string | Ja | UUID des abzurufenden Agenten |
Beispiele
Einfacher Abruf
const axios = require("axios");
async function getAgent() {
const response = await axios.get(
"https://api.langdock.com/agent/v1/get",
{
params: {
agentId: "550e8400-e29b-41d4-a716-446655440000"
},
headers: {
Authorization: "Bearer YOUR_API_KEY"
}
}
);
console.log("Agent-Details:", response.data.agent);
}
Validierungsregeln
Die API wendet folgende Validierungsregeln an:- Agent-Zugriff - Dein API-Schlüssel muss Zugriff auf den Agenten haben
- Workspace-Übereinstimmung - Der Agent muss zum selben Workspace wie dein API-Schlüssel gehören
Antwortformat
Erfolgreiche Antwort (200 OK)
{
status: "success";
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[];
owner: {
id: string;
name: string | null;
email: string;
} | null;
createdAt: string;
updatedAt: string;
};
}
Fehlerbehandlung
try {
const response = await axios.get('https://api.langdock.com/agent/v1/get', ...);
} catch (error) {
if (error.response) {
switch (error.response.status) {
case 400:
console.error('Ungültiges Agent-ID-Format');
break;
case 401:
console.error('Ungültiger oder fehlender API-Schlüssel');
break;
case 403:
console.error('Unzureichende Berechtigungen - kein Zugriff auf diesen Agenten');
break;
case 404:
console.error('Agent nicht gefunden');
break;
case 500:
console.error('Server-Fehler');
break;
}
}
}
Langdock blockiert bewusst Browser-basierte Anfragen, um deinen API-Schlüssel zu schützen und die Sicherheit deiner Anwendungen zu gewährleisten. Weitere Informationen findest du in unserem Guide zu Best Practices für API-Schlüssel.
War diese Seite hilfreich?