Zum Hauptinhalt springen
GET
/
assistant
/
v1
/
get
Retrieves details of an existing agent
curl --request GET \
  --url https://api.langdock.com/assistant/v1/get \
  --header 'Authorization: Bearer <token>'
{
  "status": "success",
  "assistant": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "name": "<string>",
    "emojiIcon": "<string>",
    "model": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "temperature": 0.5,
    "inputType": "PROMPT",
    "webSearchEnabled": true,
    "imageGenerationEnabled": true,
    "codeInterpreterEnabled": true,
    "canvasEnabled": true,
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z",
    "description": "<string>",
    "instruction": "<string>",
    "conversationStarters": [
      "<string>"
    ],
    "actions": [
      {
        "actionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "requiresConfirmation": true
      }
    ],
    "inputFields": [
      {
        "slug": "<string>",
        "type": "TEXT",
        "label": "<string>",
        "required": true,
        "order": 1,
        "description": "<string>",
        "options": [
          "<string>"
        ],
        "fileTypes": [
          "<string>"
        ]
      }
    ],
    "attachments": [
      "3c90c3cc-0d44-4b50-8888-8dd25736052a"
    ]
  }
}
Ruft die vollständige Konfiguration und Details eines vorhandenen Agenten in deinem Workspace ab.
Erfordert einen API-Schlüssel mit dem AGENT_API Scope und Zugriff auf den Agenten, den du abrufen möchtest.

Query-Parameter

ParameterTypErforderlichBeschreibung
assistantIdstringJaUUID des abzurufenden Agenten

Beispiele

Einfacher Abruf

const axios = require("axios");

async function getAssistant() {
  const response = await axios.get(
    "https://api.langdock.com/api/public/assistant/v1/get",
    {
      params: {
        assistantId: "550e8400-e29b-41d4-a716-446655440000"
      },
      headers: {
        Authorization: "Bearer YOUR_API_KEY"
      }
    }
  );

  console.log("Agent-Details:", response.data.assistant);
}

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";
  assistant: {
    id: string;
    name: string;
    description: string;
    instruction: string;
    emojiIcon: string;
    model: string;
    temperature: number;
    conversationStarters: string[];
    inputType: "PROMPT" | "STRUCTURED";
    webSearchEnabled: boolean;
    imageGenerationEnabled: boolean;
    codeInterpreterEnabled: boolean;
    canvasEnabled: boolean;
    actions: Array<{
      actionId: string;
      requiresConfirmation: boolean;
    }>;
    inputFields: Array<{
      slug: string;
      type: string;
      label: string;
      description: string;
      required: boolean;
      order: number;
      options: string[];
      fileTypes: string[] | null;
    }>;
    attachments: string[];
    createdAt: string;
    updatedAt: string;
  };
}

Fehlerbehandlung

try {
  const response = await axios.get('https://api.langdock.com/api/public/assistant/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.

Autorisierungen

Authorization
string
header
erforderlich

API key as Bearer token. Format "Bearer YOUR_API_KEY"

Abfrageparameter

assistantId
string<uuid>
erforderlich

UUID of the agent to retrieve

Antwort

Agent details retrieved successfully

status
enum<string>
erforderlich
Verfügbare Optionen:
success
assistant
object