Skip to content

Agent context

You can prepare context that the AI agent loads automatically, using notebooks. For how to use it in chat, see AI agent.

Agent context doesn't change access permissions. The information it can reference and the operations it can perform are limited to the permission scope of the user and the AI profile in use.

Agent context folder

Create a folder named .agent directly under your personal folder or the root of a teamspace. You can select New Agent Context folder from the folder menu in the left sidebar.

LocationAuto-load
.agent directly under your personal folderAlways loaded when on (the Personal user setting)
.agent directly under a teamspaceLoaded while you have a notebook from that teamspace open (the Teamspace user setting)
.agent directly under the workspaceNot auto-loaded. Loaded only if specified as context on an AI profile
.agent anywhere elseNot auto-loaded

For a .agent folder directly under a personal folder or a teamspace, every notebook within it—including those in subfolders—is loaded. This includes SQL blocks as well as text.

Agent context page

If you add a page named .agent within a notebook, its content is loaded while that notebook is open (the Notebook page user setting). You can use it to pass things like how to calculate a metric, including through SQL blocks.

Use a .agent page for assumptions specific to a notebook, and a .agent folder for information shared across a person or team.

AI profile context

The notebooks, folders, and plain text linked to the AI profile selected for the session also become context. If you specify a folder, notebooks in its subfolders are included too.

Referencing a context notebook or folder requires the user to have view permission for it. An AI profile that includes a notebook you can't view can't be used.

Auto-load settings

From Settings > User Preferences > Auto-load Agent Context in the chat input field, you can turn each type on or off.

ItemDefaultTarget
PersonalOn.agent directly under your personal folder
TeamspaceOn.agent directly under the teamspace the current notebook belongs to
Notebook pageOnThe .agent page within the current notebook

Context configured on an AI profile isn't covered by these switches. It's always loaded as part of the settings of whichever AI profile is currently selected.

You can check which notebooks and pages are currently being auto-loaded from Context usage in the chat input field.

Always-loaded vs. loaded on demand

You can separate information that's always loaded from information referenced only when needed, based on where you place notebooks and how you link them to an AI profile.

Loading approachSettingBehavior
Always load personal contextPlace notebooks in .agent directly under your personal folder, and turn on PersonalLoads every notebook in the folder and its subfolders whenever the AI agent runs
Load teamspace contextPlace notebooks in .agent directly under a teamspace, and turn on TeamspaceLoaded while you have a notebook from that teamspace open
Load notebook-specific contextCreate a .agent page in a notebook, and turn on Notebook pageLoads the .agent page while that notebook is open
Always load through an AI profileSet it as the AI profile's plain text, context notebook, or context folderLoaded every time that AI profile is used
Reference only when neededKeep only an index notebook under .agent, and put details in a regular folder with a page link to itThe index is auto-loaded, and details are referenced through the link only when a question calls for it

For the agent to reference a detail notebook when needed, the user must be able to view it, and the AI profile's Notebook access must be set to All accessible notebooks. With Current notebook only, details placed outside the current notebook can't be referenced.

Index notebook

Notebooks in a .agent folder are auto-loaded. Placing a large volume of detailed specifications or past analyses there uses up context on information unrelated to the question at hand.

You can put details in regular notebooks and folders, and keep an index notebook under .agent. An index should include the following.

  • What information is available
  • What kinds of questions it's relevant to
  • A link to the page of the notebook that's the source of truth
  • Where the notebook is stored
  • Keywords useful for searching
  • How to handle cases where information can't be found or a judgment can't be made

WARNING

For each reference, set a link to the target page, not just the notebook name. A notebook name or storage location alone doesn't let the AI agent locate a page outside the .agent folder directly. Open the target page, copy its URL, and insert it into the index as a link.

Here's an example structure. Replace WORKSPACE_ID / NOTEBOOK_ID / PAGE_ID with the actual URL.

markdown
# Agent Context Index

## Common rules

* Treat the "KPI Definitions" notebook as the source of truth for metric definitions
* If a definition can't be found, don't guess—ask the user
* Confirm the target period and time zone before writing SQL

## Knowledge Map

### Sales and orders

* Reference: [Sales and order metrics](https://app.codatum.com/workspace/WORKSPACE_ID/notebook/NOTEBOOK_ID/PAGE_ID)
* Location: "Data Knowledge" teamspace
* When to use: analysis of sales, orders, and cancellations
* Search keywords: sales, orders, cancellations, GMV

Configurations to avoid

Avoid the following configurations.

  • Putting every detailed specification or past analysis into a .agent folder
  • Duplicating the same metric definition across multiple contexts
  • Writing only a summary without indicating the source of truth or a reference
  • Writing rules with no clear update date or scope of application
  • Trying to control access permissions or tool execution scope through context

Configure access scope and available tools through notebook and teamspace permissions, and through AI profile tool permissions.