> ## Documentation Index
> Fetch the complete documentation index at: https://docs.budecosystem.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Foundry Knowledge

> Search, question and quote data-foundry collections, confined to the collections configured for the agent

## Overview

Data Foundry Knowledge connects an agent to collections held in data-foundry. The agent can search for passages, ask for a cited answer, or quote the exact text of a passage. budprompt proxies data-foundry's MCP surface (`{DATA_FOUNDRY_BASE_URL}/v1alpha/mcp`) to the model, so retrieval itself is not implemented in Bud.

> [!NOTE]
>
> The tool is off by default. Each deployment must turn it on. See [Deployment](#deployment).

## What the Agent Sees

The model sees the tools with a `df_` prefix, so they cannot clash with another toolset's `search`:

| Tool | Default | Returns |
| - | - | - |
| `df_search` | on | Matching passages for the agent to reason over |
| `df_answer` | on | A synthesized, cited answer |
| `df_snip` | on | The exact text of a passage, by query or by locator |
| `df_list_collections` | off | The collections data-foundry lists |

Only these four tools can be exposed. data-foundry's other MCP tools, which manage threads, notebooks, rebuilds and generations, are never shown to the agent, whatever its configuration says.

## Configuration

| Field | Type | Default | Description |
| - | - | - | - |
| `exposed_tools` | array | `["df_search", "df_answer", "df_snip"]` | The tools the agent may call. Select at least one. Tools that are not selected are never listed to the model. |
| `answer_method` | `SINGLE_PASS` \| `AGENTIC` | `SINGLE_PASS` | The method used for every `df_answer` call. |
| `collections` | array | `[]` | The collections the agent is confined to. For now this is set through the API only. See [Collections](#collections). |

These fields are not in the configuration on purpose:

* **No endpoint or credential.** The data-foundry URL and credential are deployment-wide budprompt settings, because a prompt configuration is stored unencrypted.
* **No scopes.** budprompt removes `scopes` from every call.

## Collections

Each entry names a collection by its identifiers:

```json theme={null}
{ "kind": "SYNC", "sync": "<sync>" }
{ "kind": "COLLECTION", "sync": "<sync>", "collection": "<collection>" }
```

budapp accepts at most 50 entries and removes duplicates. It refuses `NAME` entries (a match on a display name), because a display-name match cannot be turned into a hodor scope.

Set them with the native-tools endpoint:

```bash theme={null}
curl -X POST "$BUD_API/prompts/<agent>/native-tools" \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"version": 1, "tool_name": "data_foundry_knowledge",
       "config": {"collections": [{"kind": "SYNC", "sync": "<sync>"}]}}'
```

If a save does not include `collections`, budapp keeps the collections that are already stored. Thus a save from the configuration form does not delete them. To clear them, send an empty list.

> [!WARNING]
>
> The server never adds collections for you. If no collections are set, the tool is saved but stays inactive, and the agent runs without it. An empty `namedCollections` would mean every collection the credential can read, so budprompt does not load the tool in that case.

## Confinement

* budprompt **forces** the configured collections as `namedCollections` on every `df_search`, `df_answer` and `df_snip`-by-query call, and replaces anything the model sent. Named collections can only narrow what the credential can see. They cannot widen it.
* A `df_snip` by locator cannot carry `namedCollections`. budprompt checks the locator's sync and collection against the configured collections, and refuses a locator outside them before it calls data-foundry.
* **`df_list_collections` is not confined.** `namedCollections` cannot narrow it, so it shows the model every collection that the deployment's data-foundry credential can read, not only this agent's. This is why it is off by default.

## Stateless Answers

budprompt calls data-foundry as a service principal that all users of an agent share. A stored conversation thread would thus be readable by all of them. For this reason `df_answer` never stores a thread: budprompt forces `temporary` to true, and removes `thread`, `store`, `searchResultsRef` and `requestId` from every call and from the schema that the model sees. Each answer stands alone.

## Deployment

Two flags must be on, one for each service:

| Service | Setting | Effect |
| - | - | - |
| budapp | `DATA_FOUNDRY_KNOWLEDGE_ENABLED=true` | Shows the tool in the native-tools catalog and accepts connects of it. When it is off, the tool is unknown to the API. |
| budprompt | `DATA_FOUNDRY_KNOWLEDGE_ENABLED=true` | Loads the tool when an agent runs. |

budprompt also needs `DATA_FOUNDRY_BASE_URL` and a credential. `DATA_FOUNDRY_AUTH_MODE` selects the credential:

* `hodor` exchanges `DATA_FOUNDRY_HODOR_KEY` at `HODOR_URL` for a short-lived assertion for tenant `DATA_FOUNDRY_HODOR_TENANT`, before each call.
* `static` sends `DATA_FOUNDRY_API_KEY` as the bearer. Use it only for development.

If you do not set the mode, budprompt uses `hodor` when `HODOR_URL` is set, and `static` if not. Keep the keys in the environment's SOPS-encrypted secrets file. If a setting is missing, budprompt loads the agent without the tool and logs why. It does not fail the run.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.