> ## 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.

# Patch an agent

> Change individual fields of an agent without resending the full object.

Partial update: only the fields you send change, everything else is preserved. Send a field as `null` to clear it. The merged result is validated like a [full update](/computer-use-agents/agents/update), and `name` is not patchable (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

Any subset of the [Agent](/computer-use-agents/agents/overview) object's fields except `name`: `description`, `environments`, `model`, `instructions`, `subagents`, `skills`, `answer_format`, `tools`.

***

## Examples

Change the instructions and nothing else:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PATCH https://agp.eu.hcompany.ai/api/v2/agents/my-research-bot \
    -H "Authorization: Bearer $HAI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"instructions": "Always cite the page you took each claim from."}'
  ```

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

  client = Client()

  agent = client.agents.patch_agent(
      agent_name="my-research-bot",
      instructions="Always cite the page you took each claim from.",
  )
  print(agent.instructions)
  ```

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

  const client = new HaiAgentsClient();

  const agent = await client.agents.patchAgent({
    agentName: "my-research-bot",
    instructions: "Always cite the page you took each claim from.",
  });
  console.log(agent.instructions);
  ```
</CodeGroup>

***

## Errors

| Status | Cause                                                                                              |
| ------ | -------------------------------------------------------------------------------------------------- |
| `403`  | The agent is reserved (`h/`) and read-only.                                                        |
| `404`  | Agent not found (or a referenced skill, environment, or subagent isn't), or you don't have access. |
| `422`  | The merged spec fails validation, for example `environments` set to an empty list.                 |
