---
title: "Patch Kb"
method: PATCH
path: "/knowledge-bases/{name}"
tags: ["knowledge-bases"]
---

# Patch Kb

`PATCH /knowledge-bases/{name}`

## Request

- Base URL: `https://api.agent4.io` (the document declares no server; this is the origin it was published from)
- URL: `https://api.agent4.io/knowledge-bases/{name}`
- Auth: none declared

局部更新。之前只有全量 PUT，逼得每个调用方（含我们自己的 MCP update_knowledge_base）
各自 GET+合并——合并白名单一旦落后于字段演化，就会把没读到的字段静默重置。404 而不是创建。

## Path parameters

- `name` string, required

## Request body

- KbPatch: 只改传来的字段（语义同 AgentPatch）。`kind` 不在此列——建库后不可变（见 upsert_kb）。
  - `instructions` string, nullable
  - `description` string, nullable
  - `max_distance` number, nullable
  - `top_k` integer, nullable
  - `rerank` boolean, nullable
  - `recall_eval` boolean, nullable

## Response `200`

Successful Response

- KbOut
  - `name` string, required
  - `kind` string
  - `instructions` string, required
  - `description` string, required
  - `max_distance` number, nullable, required
  - `top_k` integer, nullable
  - `rerank` boolean
  - `recall_eval` boolean
  - `documents` integer
  - `chunks` integer
  - `chunk_spread` integer[], nullable
  - `edited_chunks` integer

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/agent4/apis/chatagent-platform.md) · [All operations](https://skmtc.dev/agent4/apis/chatagent-platform/llms.txt) · [OpenAPI document](https://skmtc.dev/agent4/apis/chatagent-platform/revisions/18e58f082ce3?raw)
