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

# Update an agent

> Replace the configuration of an agent in your catalog.

Updates an existing agent. This is a **full replacement** of the [Agent](/computer-use-agents/agents/overview) object. The `name` must match the URL identifier: renames are not supported.

**Returns** the updated [Agent](/computer-use-agents/agents/overview) object.

***

## Path parameters

<ParamField path="agent_name" type="string" required>
  The agent's `name` (e.g. `my-research-bot` or `myorg/web-helper`). Slash-containing names are supported.
</ParamField>

***

## Request body

A **full replacement** of the [Agent](/computer-use-agents/agents/overview) object. The `name` in the body must equal the URL identifier. Any field you omit is reset to its default, not preserved: leaving out `instructions`, `model`, `skills`, or `answer_format` clears them. To change individual fields without resending the rest, use [Patch](/computer-use-agents/agents/patch) instead.

***

## Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT https://agp.eu.hcompany.ai/api/v2/agents/my-research-bot \
    -H "Authorization: Bearer $HAI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "my-research-bot",
      "description": "Researches a topic and returns a sourced summary.",
      "environments": ["h/browser"],
      "instructions": "Always cite the page you took each claim from.",
      "skills": ["web-browse", "extract-data"]
    }'
  ```

  ```python Python theme={null}
  from hai_agents import Client

  client = Client()

  agent = client.agents.update_agent(
      agent_name="my-research-bot",
      name="my-research-bot",
      description="Researches a topic and returns a sourced summary.",
      environments=["h/browser"],
      instructions="Always cite the page you took each claim from.",
      skills=["web-browse", "extract-data"],
  )
  print(agent.name)
  ```

  ```typescript TypeScript theme={null}
  import { HaiAgentsClient } from "hai-agents";

  const client = new HaiAgentsClient();

  const agent = await client.agents.updateAgent({
    agentName: "my-research-bot",
    body: {
      name: "my-research-bot",
      description: "Researches a topic and returns a sourced summary.",
      environments: ["h/browser"],
      instructions: "Always cite the page you took each claim from.",
      skills: ["web-browse", "extract-data"],
    },
  });
  console.log(agent.name);
  ```
</CodeGroup>

```json Response theme={null}
{
  "name": "my-research-bot",
  "description": "Researches a topic and returns a sourced summary.",
  "environments": ["h/browser"],
  "model": null,
  "instructions": "Always cite the page you took each claim from.",
  "skills": ["web-browse", "extract-data"],
  "subagents": null,
  "answer_format": null
}
```

***

## Errors

| Status | Cause                                                                                 |
| ------ | ------------------------------------------------------------------------------------- |
| `400`  | The `name` in the body does not match the URL identifier (renames are not supported). |
| `403`  | The agent is reserved (`h/`) and read-only.                                           |
| `404`  | Agent not found or you don't have access.                                             |
| `422`  | Body fails validation; common cases: `environments` empty, invalid `name` shape.      |
