Docs · Guides

Knowledge

Documents your agent can search, and that reply drafts cite: policies, shipping times, how you write.

Knowledge is reference text for your agent: a refund policy, shipping times, opening hours, the tone you want. A document belongs to one inbox or, without an inbox_id, to all inboxes in the workspace.

knowledge.ts
// Workspace-wide (no inbox_id) or for one inbox.
await mr.knowledge.create({
  title: 'Shipping times',
  body: '- Germany: 1–2 working days (DHL)
- EU: 3–5 working days',
  inbox_id: inbox.id,
});

// Ranked full-text search. With inbox_id, workspace-wide documents are included too.
const { data: hits } = await mr.knowledge.search('how long does shipping to France take', { inbox_id: inbox.id });
// [{ id, title: 'Shipping times', inbox_id, rank: 0.61, snippet: '…EU: 3–5 working days…' }]
knowledge.py
mr.knowledge.create(
    title="Shipping times",
    body="- Germany: 1–2 working days (DHL)
- EU: 3–5 working days",
    inbox_id=inbox["id"],
)

hits = mr.knowledge.search("how long does shipping to France take", inbox_id=inbox["id"])
for h in hits["data"]:
    print(h["title"], h["rank"], h["snippet"])

Search is Postgres full-text search, ranked, with a snippet around the matching words. It matches words, not meaning, so “refund” finds “refunds” but not “money back”. When you pass inbox_id, results include that inbox’s documents and the workspace-wide ones.

#Routes

Method & pathNotes
GET /v1/knowledge?inbox_id=&cursor=&limit=. List with an excerpt instead of the body.
POST /v1/knowledge{ title, body, inbox_id? }. Plain text or markdown, up to 200,000 characters.
GET /v1/knowledge/:id · PATCH /v1/knowledge/:id · DELETE /v1/knowledge/:idRead, change ({ title?, body?, inbox_id? }) or delete one document.
GET /v1/knowledge/search?q=&inbox_id=&limit= → { data: [{ id, title, inbox_id, rank, snippet }] }.

#Where it’s used

  • The search_knowledge MCP tool and mr.knowledge.search in the SDKs.
  • Reply drafts use the top 5 matches for the latest inbound message and list them as citations.
  • The Knowledge page in the dashboard, with search, scope and a character count.