Knowledge base
A Knowledge base is a per-agent pile of reference material — handbooks, policy docs, transcripts, FAQ, photos. The runtime indexes it once, retrieves the relevant passages on every turn, and feeds them to the agent. The agent, every workflow, every subagent, and every skill it spawns always read from the same base — there is no per-tool wiring.
Supported file types
| Kind | Extensions | How it's used |
|---|---|---|
| Markdown / text | .md, .mdx, .txt |
Chunked, embedded, retrieved by semantic similarity. The agent quotes the chunk text directly. |
.pdf |
Parsed page-by-page (OCR if scanned), chunked the same way. Citations include the page number. | |
| Office docs | .docx, .pptx |
Converted to text + structure, then chunked. |
| Images | .png, .jpg, .jpeg, .webp |
Captioned and OCR'd at index time. The agent gets both the caption and the original image whenever a chunk matches. |
| Spreadsheets | .csv, .xlsx |
Row-level indexing — the agent can query columns by name. |
Upload from a deploy script
const kb = await an.knowledge.upload({
key: 'bayhomes-handbook',
files: [
'./knowledge/handbook.pdf',
'./knowledge/policies.md',
'./knowledge/listings.csv',
'./knowledge/floorplan.png',
],
});
// → { id: 'kb_8b07', version: 3, indexedAt: '…' }
// pass into configure:
await an.agents.configure({ /* … */ knowledge: [kb] });
Each call stamps a new version. The agent version that referenced kb@v3 keeps reading from v3 even after you upload v4 — you have to configure + redeploy to roll the agent forward.
Upload from your backend or end-user UI
Same an.knowledge.upload from anywhere holding your API key. Useful when end-users drop files into your own UI:
// in your server route, after authenticating the user
await an.knowledge.append('kb_8b07', {
files: [{ name: 'new-policy.pdf', data: buffer }],
});
Or set data-uploads="true" on the embed widget and end-users get a file-attach button — uploads land in the agent's KB if you've marked it shared, otherwise they become transient session attachments (see Sessions).
What "full access" means
- The main agent retrieves from the KB on every user turn — no
Readtool call needed. - Workflows retrieve from the same KB at every step. A morning-digest workflow can quote the handbook without re-declaring it.
- Subagents spawned via the
Tasktool inherit the same KB. - Skills can opt into a specific KB scope in their frontmatter (
knowledge: [bayhomes-handbook]) but default to all of them.
If you need to slice it — separate handbook from internal-only notes — upload two KBs (kb_handbook, kb_internal) and pass only the one the agent should see.