> ## Documentation Index
> Fetch the complete documentation index at: https://docs.langdock.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent Get API

> Details eines vorhandenen Agenten abrufen

<Info>
  **⚠️ Du nutzt unsere API in einem Dedicated Deployment?** Ersetze einfach `api.langdock.com` durch die Base URL deines Deployments: **`<deployment-url>/api/public`**
</Info>

<Info>
  Dies ist die neue Agents API mit nativer Vercel AI SDK Kompatibilität. Wenn du die veraltete Assistants API verwendest, siehe den [Migrations-Guide](/de/developer/assistants-api/assistant-to-agent-migration).
</Info>

<Info>
  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.
</Info>

Ruft die vollständige Konfiguration und Details eines vorhandenen Agenten in deinem Workspace ab.

<Info>
  Erfordert einen API-Schlüssel mit dem `AGENT_API` Scope und Zugriff auf den Agenten, den du abrufen möchtest.
</Info>

## Query-Parameter

| Parameter | Typ    | Erforderlich | Beschreibung                  |
| --------- | ------ | ------------ | ----------------------------- |
| `agentId` | string | Ja           | UUID des abzurufenden Agenten |

## Beispiele

### Einfacher Abruf

```javascript theme={null}
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)

```typescript theme={null}
{
  status: "success";
  agent: {
    id: string;
    name: string;
    description: string;
    instruction: string;
    emojiIcon: string;
    model: string;
    temperature: number;
    conversationStarters: string[];
    inputType: "PROMPT" | "STRUCTURED";
    webSearchEnabled: boolean;
    imageGenerationEnabled: boolean;
    canvasEnabled: boolean;
    extendedThinking: 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

```typescript theme={null}
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;
    }
  }
}
```

<Info>
  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](/de/admin/ai-adoption-and-rollout/best-practices/api-key-best-practices).
</Info>


## OpenAPI

````yaml GET /agent/v1/get
openapi: 3.0.0
info:
  title: Langdock API
  version: 3.0.0
servers:
  - url: https://api.langdock.com
    description: Production
security:
  - bearerAuth: []
paths:
  /agent/v1/get:
    get:
      tags:
        - Agent Build
      summary: Retrieves details of an existing agent
      description: Retrieves the complete configuration and details of an existing agent.
      operationId: getAgentV2
      parameters:
        - name: agentId
          in: query
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Agent retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  agent:
                    $ref: '#/components/schemas/Assistant'
components:
  schemas:
    Assistant:
      type: object
      required:
        - name
        - instructions
      properties:
        name:
          type: string
          maxLength: 64
        description:
          type: string
          maxLength: 256
        instructions:
          type: string
          maxLength: 16384
        temperature:
          type: number
          minimum: 0
          maximum: 1
        model:
          type: string
          maxLength: 64
        capabilities:
          type: object
          properties:
            webSearch:
              type: boolean
            dataAnalyst:
              type: boolean
              deprecated: true
              description: Deprecated. Accepted for compatibility and ignored.
            imageGeneration:
              type: boolean
        actions:
          type: array
          items: 7d19e95b-21e8-417f-995e-24a8f5651c16
        vectorDb:
          type: array
          items: 48adcef5-fb6f-434d-894d-ad23cdeb3651
        knowledgeFolderIds:
          type: array
          items:
            type: string
        attachmentIds:
          type: array
          items:
            type: string
            format: uuid
          description: Array of UUID strings identifying attachments for this message
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: API key as Bearer token. Format "Bearer YOUR_API_KEY"

````