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

# Knowledge and corpus

> Control which knowledge your agent uses when answering questions.

Your agent can use **knowledge** (and **pages**) to answer questions. You choose whether it uses all available knowledge or only the sources you specify.

## Default: use all knowledge

If you don't set `corpus` on the agent or in the request, the agent can use **all knowledge your organization or teamspace can access**. You don't need to pass a list—just call converse and the agent has access to everything in scope.

You can set `corpus` when you create or update an agent, or override it per request in the converse `config`.

## Scope to specific knowledge

To limit the agent to certain knowledge bases or pages, pass a `corpus` array. Each item is either a knowledge base or a page. This works in the agent config or in `config` on a converse call.

```python Python theme={null}
import os
from datagrid_ai import Datagrid

client = Datagrid(api_key=os.environ.get("DATAGRID_API_KEY"))

# Use only these knowledge sources for this request
response = client.converse(
    prompt="Summarize our Q4 policy updates",
    config={
        "corpus": [
            {"type": "knowledge", "knowledge_id": "kn_abc123"},
            {"type": "page", "page_id": "page_xyz789"}
        ]
    }
)
```

```javascript JavaScript theme={null}
import Datagrid from 'datagrid-ai';

const client = new Datagrid({
  apiKey: process.env['DATAGRID_API_KEY']
});

// Use only these knowledge sources for this request
const response = await client.converse({
  prompt: 'Summarize our Q4 policy updates',
  config: {
    corpus: [
      { type: 'knowledge', knowledge_id: 'kn_abc123' },
      { type: 'page', page_id: 'page_xyz789' }
    ]
  }
});
```

> [!TIP]
>
> For situations that call for predictable behavior and to avoid exposing more knowledge than intended, set `corpus` explicitly instead of relying on the default. That way the agent only uses the knowledge you specify.


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