How to Attach and Detach DigitalOcean Knowledge Bases on DigitalOcean Inference

Validated on 28 Apr 2025 • Last edited on 8 May 2026

Inference provides a single control plane for managing inference workflows. It includes a Model Catalog where you can view available foundation models, including both DigitalOcean-hosted and third-party commercial models, compare model capabilities and pricing, use routing to match inference requests to the best-fit model, and run inference using serverless or dedicated deployments.

You can attach knowledge bases to give agents access to additional custom data, or detach them if the information is no longer needed. Attaching or detaching knowledge bases triggers an immediate redeployment of the agent.

Attach a Knowledge Base to an Agent Using the Control Panel

Before attaching it to an agent, you can optionally test your knowledge base’s data retrieval by either testing it in RAG Playground or sending retrieval queries to confirm it returns the results you expect.

To attach a knowledge base using the DigitalOcean Control Panel, click Agent Platform in the left menu, then in the Agent Workspaces tab, select the workspace that contains the agent you want to attach a knowledge base to. From the workspace’s Agents tab, select the agent, then click its Resources tab. In the Knowledge Bases section, click Add Knowledge Bases.

In the Knowledge Bases field, type and then select the knowledge base you want to attach. A knowledge base must have vector embeddings to appear in the list. If it’s created but not yet indexed, you cannot attach it to an agent. After selecting the knowledge bases, click Add Knowledge Bases.

You can view attached knowledge bases in the agent’s Resources tab, along with the last indexing time and attachment date.

Attach a Knowledge Base to an Agent Using the API

To attach a knowledge base using the API, provide the agent’s ID and the knowledge base ID. Retrieve available knowledge bases using the List Knowledge Bases endpoint, and agents using the List Agents endpoint.

A knowledge base must have at least one indexed data source to appear in the list. To index a knowledge base, find its ID in the list, then index its data sources.

How to Attach a Knowledge Base to an Agent Using the DigitalOcean API
  1. Create a personal access token and save it for use with the API.
  2. Send a POST request to https://api.digitalocean.com/v2/gen-ai/agents/{agent_uuid}/knowledge_bases.

cURL

Using cURL:

curl -X POST \
 -H "Content-Type: application/json" \
 -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
 "https://api.digitalocean.com/v2/gen-ai/agents/1b418231-b7d6-11ef-bf8f-4e013e2ddde4/knowledge_bases" \
 -d '{
   "agent_uuid": "1b418231-b7d6-11ef-bf8f-4e013e2ddde4",
   "knowledge_base_uuids": [
     "9a6e3975-b0c6-11ef-bf8f-4e013e2ddde4",
     "683c3100-7c18-4c94-aea4-5ac5875cc87c",
     "4887a78b-74af-46b3-98f4-451a48f9cc5e"
   ]
 }'

Once attached, the agent can access and retrieve content from the knowledge base during prompt processing.

Detach a Knowledge Base from an Agent Using the Control Panel

You can detach a knowledge base if it’s no longer needed. This stops the agent from referencing it but doesn’t delete or affect the knowledge base itself. Detaching a knowledge base triggers immediate agent redeployment, which may take a few minutes.

From the DigitalOcean Control Panel, click Agent Platform in the left menu, then in the Agent Workspaces tab, select the workspace that contains the agent you want to detach a knowledge base for. From the workspace’s Agents tab, select the agent, and then click its Resources tab. In the Knowledge Bases section, find the knowledge base to detach.

To the right of the knowledge base, click to open the knowledge base menu, then click Detach Knowledge Base. In the confirmation window, type the knowledge base’s name, then click Detach Knowledge Base.

Detach a Knowledge Base from an Agent Using the API

To detach a knowledge base using the API, provide the agent ID and knowledge base ID. Retrieve IDs using the List Agents and List Knowledge Bases endpoints.

How to Detach a Knowledge Base From an Agent Using the DigitalOcean API
  1. Create a personal access token and save it for use with the API.
  2. Send a DELETE request to https://api.digitalocean.com/v2/gen-ai/agents/{agent_uuid}/knowledge_bases/{knowledge_base_uuid}.

cURL

Using cURL:

curl -X DELETE \
  -H "Content-Type: application/json"  \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  "https://api.digitalocean.com/v2/gen-ai/knowledge_bases/9a6e3975-b0c6-11ef-bf8f-4e013e2ddde4/data_sources/bd2a2db5-b8b0-11ef-bf8f-4e013e2ddde4"

We can't find any results for your search.

Try using different keywords or simplifying your search terms.