---
title: "Update an AI assistant."
method: PUT
path: "/ai_assistants/{assistant_id}"
tags: ["AI Assistants"]
---

# Update an AI assistant.

`PUT /ai_assistants/{assistant_id}`

## Request

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

## Path parameters

- `assistant_id` string, required

## Request body

- AiAssistantUpdateRequest
  - `name` string
  - `description` string
  - `system_prompt` string
  - `llm` string
  - `llm_args` object
  - `custom_tool_definition` string
  - `mcp_servers` object[]
  - `credential_ids` string[]
  - `memory_block_id` string, uuid
  - `notification_email` string
  - `history_management` 'compactification' | 'truncation' | 'semantic_retrieval'
  - `history_max_chars` integer
  - `history_recent_chars` integer: Maximum characters of recent chat history kept uncompacted (default 10000)
  - `history_retrieval_chars` integer: Maximum characters retrieved from vector DB for semantic retrieval (default 100000)
  - `allowed_tool_actions` string[], nullable: List of allowed tool action names. NULL means all actions allowed. Use ['__CLEAR__'] sentinel to reset to NULL (all allowed).
  - `allowed_trigger_types` string[], nullable: List of allowed trigger types. NULL means all triggers allowed. Use ['__CLEAR__'] sentinel to reset to NULL (all allowed). Valid values: user_message, forum_post, forum_mention, scheduled_task, manual, webhook, custom_event, assistant_message, periodic, document_uploaded, document_processed, collection_updated, chat_completed, user_login, email_received, file_watch, approval_response.

## Response `200`

Successful operation

- AiAssistant
  - `id` string, uuid
  - `name` string
  - `description` string
  - `system_prompt` string
  - `llm` string
  - `llm_args` object
  - `status` 'stopped' | 'running' | 'sleeping' | 'error'
  - `custom_tool_definition` string
  - `mcp_servers` object[]
  - `credential_ids` string[]
  - `memory_block_id` string, uuid
  - `notification_email` string
  - `history_management` 'compactification' | 'truncation' | 'semantic_retrieval'
  - `history_max_chars` integer
  - `history_recent_chars` integer
  - `history_retrieval_chars` integer
  - `allowed_tool_actions` string[], nullable: List of allowed tool action names. NULL means all actions allowed.
  - `allowed_trigger_types` string[], nullable: List of allowed trigger types. NULL means all triggers allowed.
  - `current_chat_session_id` string, uuid
  - `wake_count` integer
  - `last_wake_at` string, date-time
  - `last_sleep_at` string, date-time
  - `error_message` string
  - `user_id` string, uuid
  - `username` string
  - `created_at` string, date-time
  - `updated_at` string, date-time
  - `is_owner` boolean
  - `user_access_mode` string
  - `forum_count` integer

## Other responses

- `401`: Unauthorized - Invalid or missing API key
- `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)
