---
title: "Bind knowledge bases to an agent"
method: PUT
path: "/v1/agents/{id}/knowledgebases"
tags: ["Agents"]
---

# Bind knowledge bases to an agent

`PUT /v1/agents/{id}/knowledgebases`

## Request

- Base URL: `https://api.pyai.com`
- URL: `https://api.pyai.com/v1/agents/{id}/knowledgebases`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`

Replace the agent's knowledge base bindings (with per-base retrieval weights). Omni sessions opened with `session_label` equal to this agent's id ground against these; sessions without an agent profile use the org defaults (`/v1/knowledgebases/default`). Requires the `omni:session` scope.

## Path parameters

- `id` string, required

## Request body

- KbBinding[]
  - `kb_id` string, required: Knowledge base id.
  - `weight` number: Retrieval weight relative to other bound bases.

## Response `200`

The agent's knowledge base bindings

- KbBindingList
  - `data` KbBinding[]
    - `kb_id` string, required: Knowledge base id.
    - `weight` number: Retrieval weight relative to other bound bases.

## Other responses

- `400`: Invalid request (bad field, unsupported value)
- `404`: Resource not found (`code: not_found`)

---

[API](https://skmtc.dev/pyai/apis/pyai-api.md) · [All operations](https://skmtc.dev/pyai/apis/pyai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/pyai/apis/pyai-api/revisions/271a1539185b?raw)
