persona.knowledge — /api/v1/developer/knowledge.
A Knowledge base stores documents that have been chunked and embedded for retrieval-augmented
generation (RAG). Agents with the Knowledge base attached retrieve from it automatically; you can
also search it directly from the SDK. Project-owned, or — with externalUserId — owned by that
end user.
Methods
create(input, idempotencyKey?)
name and providerId are required (the Provider supplies the embedding model’s API key —
there is no “my default provider” concept on this API, unlike Persona’s own routes).
list(params?)
PaginatedResult<KnowledgeBase>.
update(kbId, input)
Partially updates a Knowledge base. Note: changingproviderId/embeddingModel/chunkSize/
chunkOverlap does not retroactively re-embed already-uploaded documents — those settings
apply to future uploads only.
uploadDocuments(kbId, files)
Uploads and chunks/embeds one or more documents into the Knowledge base.- Synchronous — returns only once embedding finishes. Expect it to take longer for larger/more files.
- Limits: up to 10 files per call, 20MB each, restricted to PDF/TXT/MD/JSON/CSV.
UploadFileInputis{ filename, content: Uint8Array | Blob, contentType? }— pass a Node Buffer/Uint8Array (withcontentType), or an already-constructedBlob(its owntypeis used).- Returns
{ documentCount, chunkCount, files: [{ fileName, fileSize, mimeType, chunkCount }] }.documentCount/chunkCountare totals after this upload (not just this call’s files).
listDocuments(kbId)
Lists the distinct source documents currently chunked/embedded in this Knowledge base (not the individual chunks). Each entry:{ fileName, fileSize, mimeType, chunkCount, uploadedAt }.
deleteDocument(kbId, sourceName)
Deletes every chunk that came from one uploaded source document.sourceName must be the document’s fileName as returned by listDocuments() — it is
URL-encoded by the SDK automatically.
search(kbId, query, options?)
Runs a similarity search against the Knowledge base’s embedded chunks — the same retrieval an Agent with this Knowledge base attached would use internally.options.topKoverrides the Knowledge base’s own configuredtopKfor that one call only.- Each hit:
{ text, source, score }—sourceis the source document’sfileName;score(higher = more relevant) isnullif the underlying store didn’t return one.
getUsage / delete
getUsage(kbId)returnsResourceUsage. Unlike Providers/Skills/MCP, Knowledge base deletion does not currently block on in-use Agents — this is informational only, not a guarantee thatdelete()will reject whileagentCount > 0.delete(kbId)deletes the Knowledge base and all its embedded chunks.