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

# Get Agent

> Retrieve details of a specific AI agent

Get the full configuration and details of an AI agent.

## Request Body

<ParamField body="agent_id" type="string" required>
  The unique identifier of the agent to retrieve.
</ParamField>

## Response

<ResponseField name="id" type="string">
  Unique agent identifier.
</ResponseField>

<ResponseField name="name" type="string">
  Agent display name.
</ResponseField>

<ResponseField name="greeting" type="string">
  Message spoken when answering calls.
</ResponseField>

<ResponseField name="system_prompt" type="string">
  Instructions defining the agent's behavior and knowledge.
</ResponseField>

<ResponseField name="voice_id" type="string">
  Voice identifier for text-to-speech.
</ResponseField>

<ResponseField name="llm_model" type="string">
  LLM model for conversation. Default: `gpt-4.1`. Options: `gpt-4.1`, `gpt-4o`, `gpt-4o-mini`.
</ResponseField>

<ResponseField name="language" type="string">
  Agent language code (e.g., `en-US`).
</ResponseField>

<ResponseField name="agent_type" type="string">
  Agent type: `inbound`, `outbound`, or `both`.
</ResponseField>

<ResponseField name="max_call_duration" type="integer">
  Maximum call duration in seconds.
</ResponseField>

<ResponseField name="end_call_phrases" type="array">
  Phrases that trigger call termination.
</ResponseField>

<ResponseField name="transfer_number" type="string">
  Phone number for call transfers.
</ResponseField>

<ResponseField name="organization_name" type="string">
  Organization name for context.
</ResponseField>

<ResponseField name="owner_name" type="string">
  Owner name the agent represents.
</ResponseField>

<ResponseField name="agent_role" type="string">
  Agent's role (e.g., "Receptionist").
</ResponseField>

<ResponseField name="is_active" type="boolean">
  Whether the agent is enabled.
</ResponseField>

<ResponseField name="is_default" type="boolean">
  Whether this is the default agent.
</ResponseField>

<ResponseField name="created_at" type="string">
  When the agent was created.
</ResponseField>

<ResponseField name="updated_at" type="string">
  When the agent was last modified.
</ResponseField>

<ResponseField name="dynamic_variables" type="array">
  Dynamic variables configured for this agent. Each variable has `id`, `name`, `description`, `var_type` (text, number, boolean, enum), `enum_options`, `created_at`, and `updated_at`.
</ResponseField>

<ResponseField name="phone_numbers" type="array">
  Phone numbers assigned to this agent. Each entry has `id`, `phone_number`, `friendly_name`, `capabilities` (voice, sms, mms), `is_active`, and `created_at`.
</ResponseField>

<ResponseField name="custom_functions" type="array">
  Custom functions (tools) the agent can call during conversations. Each entry has `id`, `name`, `description`, `http_method`, `endpoint_url`, `headers`, `query_params`, `body_schema`, `response_variables`, `timeout_ms`, `max_retries`, `is_active`, `created_at`, and `updated_at`.
</ResponseField>

<ResponseField name="knowledge_sources" type="array">
  Knowledge base sources linked to this agent. Each entry has `id`, `title`, `url`, `sync_status`, `chunk_count`, `last_synced_at`, `created_at`, and `updated_at`.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.magpipe.ai/functions/v1/get-agent \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"agent_id": "550e8400-e29b-41d4-a716-446655440000"}'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://api.magpipe.ai/functions/v1/get-agent',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        agent_id: '550e8400-e29b-41d4-a716-446655440000'
      }),
    }
  );

  const agent = await response.json();
  console.log('Agent:', agent.name);
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.magpipe.ai/functions/v1/get-agent',
      headers={
          'Authorization': 'Bearer YOUR_API_KEY',
          'Content-Type': 'application/json',
      },
      json={'agent_id': '550e8400-e29b-41d4-a716-446655440000'}
  )

  agent = response.json()
  print(f"Agent: {agent['name']}")
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "Sarah - Receptionist",
    "greeting": "Hello, thank you for calling Acme Dental. This is Sarah, how can I help you today?",
    "system_prompt": "You are Sarah, a friendly receptionist for Acme Dental Clinic...",
    "voice_id": "21m00Tcm4TlvDq8ikWAM",
    "llm_model": "gpt-4.1",
    "language": "en-US",
    "agent_type": "both",
    "max_call_duration": 1800,
    "end_call_phrases": ["goodbye", "have a nice day"],
    "transfer_number": "+16045559999",
    "organization_name": "Acme Dental",
    "owner_name": "Dr. Smith",
    "agent_role": "Receptionist",
    "is_active": true,
    "is_default": true,
    "created_at": "2024-01-10T10:00:00Z",
    "updated_at": "2024-01-15T14:30:00Z",
    "dynamic_variables": [
      {
        "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "name": "caller_name",
        "description": "Full name of the caller",
        "var_type": "text",
        "enum_options": null,
        "created_at": "2024-01-10T10:00:00Z",
        "updated_at": "2024-01-10T10:00:00Z"
      }
    ],
    "phone_numbers": [
      {
        "id": "fea1d6c3-d686-4a1b-bfe6-2acbd30dd991",
        "phone_number": "+16045551234",
        "friendly_name": "Main Line",
        "capabilities": { "voice": true, "sms": true, "mms": false },
        "is_active": true,
        "created_at": "2024-01-10T10:00:00Z"
      }
    ],
    "custom_functions": [
      {
        "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
        "name": "check_availability",
        "description": "Check calendar availability",
        "http_method": "POST",
        "endpoint_url": "https://api.example.com/availability",
        "is_active": true,
        "created_at": "2024-01-10T10:00:00Z",
        "updated_at": "2024-01-10T10:00:00Z"
      }
    ],
    "knowledge_sources": [
      {
        "id": "c3d4e5f6-a7b8-9012-cdef-123456789012",
        "title": "Company FAQ",
        "url": "https://example.com/faq",
        "sync_status": "completed",
        "chunk_count": 12,
        "last_synced_at": "2024-01-15T14:00:00Z",
        "created_at": "2024-01-10T10:00:00Z",
        "updated_at": "2024-01-15T14:00:00Z"
      }
    ]
  }
  ```
</ResponseExample>
