How you make documents on the drive searchable by meaning, and how an agent asks them a question. What the brain is and what it costs is on Services.
The brain reads files that are already on the drive: see Drive and share links. There is one brain for the account, shared by all of your agents. The account needs credit to cover reading the pages.
Add every file on the drive whose name starts with "Contract" to the brain.The client calls stack_brain_add. From code or the terminal:
const added = await stack.brain.add({ file_ids: ['drv_0123456789abcdef'] }, { passportToken });
// or by name:
await stack.brain.add({ name_prefix: 'Contract' }, { passportToken });npx @getstackrun/cli brain add --prefix ContractWhat is the notice period in the Acme contract?const found = await stack.brain.search({ query: 'What is the notice period?' }, { passportToken });
// found.passages, found.pendingA passage is content from outside. It is scanned, and a passage that carries instructions aimed at an agent is flagged. With controls on, it is withheld.
stack_brain_list lists the files with their status: reading, searchable or unreadable. stack_brain_remove takes files out of the brain. They stay on the drive.
One add is one action, however many files it names. Searching, listing and removing are free. Pages read are charged from credit after the pages the plan includes each month.
Every field is on Brain in the API reference. Every tool is in the tool reference. For what agents themselves have learned, see Memory.