---
title: "Updates a custom agent"
method: PUT
path: "/agents/custom_agents/{agent_id}"
tags: ["Agents"]
---

# Updates a custom agent

`PUT /agents/custom_agents/{agent_id}`

## Request

- Base URL: `https://h2ogpte.genai.h2o.ai/api/v1`
- URL: `https://h2ogpte.genai.h2o.ai/api/v1/agents/custom_agents/{agent_id}`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/h2o/apis/h2ogpte-rest-api/docs/agents/custom_agents/:agent_id/put.ts> (a function with typed inputs; its response is checked against the schema)

Updates a custom agent given an agent id belonging to the user.

## Path parameters

- `agent_id` string, required

## Request body

- UpdateCustomAgentRequest
  - `agent_args` object, required: The new arguments for the custom agent
  - `mcp_servers_mapping` object, nullable: Optional dict mapping MCP server names to tool names (or null)

## Response `200`

Successful operation

- object
  - `agent_custom_agent_id` string: The ID of the updated custom agent

## Other responses

- `400`: Bad request
- `401`: Unauthorized - Invalid or missing API key
- `404`: Not found
- `500`: Internal server error
- `default`: Unexpected error

---

[API](https://skmtc.dev/h2o/apis/h2ogpte-rest-api.md) - [All operations](https://skmtc.dev/h2o/apis/h2ogpte-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/h2o/apis/h2ogpte-rest-api/revisions/a82a117320f4?raw)
