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

# Update Agent

Update the configuration of an existing agent. Only provided fields will be updated.

### Headers

<ParamField header="X-API-Key" type="string" required>
  Your API key for authentication.
</ParamField>

<ParamField header="X-Organization-Id" type="string" required>
  The organization ID.
</ParamField>

<ParamField header="Content-Type" type="string" required>
  Must be `application/json`.
</ParamField>

### Path Parameters

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

### Permissions

* `agents:update` (admin, agent\_manager)

### Request Body

All fields are optional. Only provided fields will be updated.

<ParamField body="agent_name" type="string">
  The name of the agent (1-100 characters).
</ParamField>

<ParamField body="language" type="string">
  Primary language code.
</ParamField>

<ParamField body="stt_provider" type="string">
  Speech-to-Text provider.
</ParamField>

<ParamField body="tts_provider" type="string">
  Text-to-Speech provider.
</ParamField>

<ParamField body="tts_voice" type="string">
  Voice ID.
</ParamField>

<ParamField body="llm_provider" type="string">
  LLM provider.
</ParamField>

<ParamField body="llm_model" type="string">
  Model ID.
</ParamField>

<ParamField body="system_prompt" type="string">
  The system prompt (10-10000 characters).
</ParamField>

<ParamField body="speak_first" type="boolean">
  Whether the agent should speak first.
</ParamField>

<ParamField body="end_call_tool" type="boolean">
  Enable end call tool.
</ParamField>

<ParamField body="llm_temperature" type="number">
  Temperature setting (0.0-2.0).
</ParamField>

<ParamField body="llm_fallback_provider" type="string">
  Fallback LLM provider.
</ParamField>

<ParamField body="llm_fallback_model" type="string">
  Fallback LLM model.
</ParamField>

<ParamField body="recording_enabled" type="boolean">
  Enable call recording.
</ParamField>

<ParamField body="voicemail_detection" type="boolean">
  Enable AMD.
</ParamField>

<ParamField body="voicemail_message" type="string">
  Voicemail message.
</ParamField>

<ParamField body="voicemail_response_delay" type="number">
  Delay before leaving voicemail (1.0-5.0).
</ParamField>

<ParamField body="custom_tools" type="array">
  List of custom tool IDs (replaces existing list).
</ParamField>

<ParamField body="kb_document_ids" type="array">
  List of knowledge base document IDs (replaces existing list).
</ParamField>

### Response

<ResponseField name="success" type="boolean">
  Indicates if the update was successful.
</ResponseField>

<ResponseField name="message" type="string">
  Human-readable success message.
</ResponseField>

<ResponseField name="data" type="object">
  The updated agent object (AgentData).
</ResponseField>

<RequestExample>
  ```json Request theme={null}
  {
    "system_prompt": "Updated system prompt...",
    "llm_temperature": 0.5
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "message": "Agent updated successfully",
    "data": {
      "agent_id": "agent_a1b2c3d4e5f6",
      "agent_name": "Sales Rep",
      "system_prompt": "Updated system prompt...",
      "llm_temperature": 0.5,
      "updated_at": "2024-01-20T14:45:00Z"
    }
  }
  ```
</ResponseExample>
