Skip to main content
Give an Agent a Knowledge store and it searches it before answering.

Quick Start

1

Simple Usage

2

With Configuration


Store or Add

Use store() for raw text and add() for files, directories, or URLs.
kb.add('doc.pdf') chunks the file internally using the chunker block of KnowledgeStoreConfig. Use store() only for text you already have in memory.

How Search Works

search() returns an envelope, not a bare array.
Each item in results:

Configuration Options

Knowledge takes a Python-parity config object as its first argument.

Knowledge API Reference

Full KnowledgeStoreConfig options

Common Patterns

Scope by user, agent, or run

Every operation isolates memories by userId, agentId, and runId.

Search from a tool

Manage stored items


Best Practices

Supply at least one of userId, agentId, or runId on every store, add, and search call so tenants never read each other’s data.
add() reads and chunks files, directories, and URLs. store() takes text you already hold in memory.
search() returns { query, results, totalCount }. Read found.results[i].text, and page with limit.
Pass embeddingProvider in the config to rank results by vector similarity instead of keyword overlap.

Knowledge Base CLI

CLI knowledge commands

Chunking

Split documents before storing