Knowledge Storage

Where agent knowledge is persisted, how to change it, and how to recover a corrupt store

Knowledge persists to an absolute, per-project Chroma store so unrelated projects never share one on-disk database.

Diagram

Knowledge storage

No

Yes

๐Ÿง‘ Agent

๐Ÿ“š Knowledge

๐Ÿ”ง path set?

๐Ÿ“ .praisonai/knowledge/chroma

๐Ÿ“ Your path

๐Ÿ—ƒ๏ธ Chroma

Quick Start

  1. Use the default location

    Pass sources and let the store persist under the per-project default.

    python
    from praisonaiagents import Agent
    
    agent = Agent(
        name="Research Assistant",
        knowledge=["docs/"]
    )
    
    agent.start("Summarize the docs")

    Data lands at <project>/.praisonai/knowledge/chroma.

  2. Choose your own location

    Set vector_store.config.path to store data anywhere you like.

    python
    from praisonaiagents import Agent
    
    agent = Agent(
        name="Research Assistant",
        knowledge={
            "sources": ["docs/"],
            "vector_store": {
                "config": {"path": "/data/my_project/chroma"}
            }
        }
    )
    
    agent.start("Summarize the docs")

Where Is My Data Stored?

Omit path and Knowledge persists to an absolute directory derived from your project root.

SettingLocation
Default (no path)<project>/.praisonai/knowledge/chroma
Explicit pathExactly the directory you provide

The default is absolute and per-project, so two projects โ€” or a test harness that changes directories โ€” never write to the same sqlite file.


How to Change It

Point path at any directory via the Agent config or a standalone Knowledge instance.

python
from praisonaiagents import Knowledge

kb = Knowledge(config={
    "vector_store": {
        "config": {"path": "/data/shared/chroma"}
    }
})

kb.add("research.pdf")

An explicitly configured path always wins over the default.


What If the Store Is Corrupt?

A corrupt, locked, or version-mismatched Chroma store now raises a RuntimeError instead of crashing the interpreter.

RuntimeError: Chroma persist failed at '<path>' (PanicException: <text>).
Pass a fresh directory via knowledge config vector_store.config.path.

ChromaDB’s rust bindings can raise a PanicException (a BaseException, not Exception) that previously unwound through Agent.start and killed Python โ€” on Windows this showed up as a SIGSEGV or hang (issue #4376). The SDK now catches it and re-raises an actionable Python error, while KeyboardInterrupt still propagates so Ctrl-C keeps working.

Directory indexing behaves the same: a backend panic on one file surfaces as RuntimeError: Knowledge indexing backend crashed on <file> rather than terminating the process.

Recovery: delete the persist directory and re-index, or point path at a fresh directory.

python
import shutil
from praisonaiagents import Agent

shutil.rmtree(".praisonai/knowledge/chroma", ignore_errors=True)

agent = Agent(name="Research Assistant", knowledge=["docs/"])
agent.start("Re-index and answer")

Configuration Options

Chroma persistence is controlled by a single option under vector_store.config.

OptionTypeDefaultDescription
pathstr<project>/.praisonai/knowledge/chroma (absolute, per project)Directory where the Chroma sqlite store is persisted. Optional โ€” omit to use the per-project default.

Best Practices

Omit path for local development

Leave path unset and rely on the per-project default. Each project keeps its own isolated store with zero configuration.

Set an explicit path for shared or deployed stores

Point path at a stable, absolute directory when multiple services must read the same knowledge base, or when deploying where the working directory changes.

Recover instead of retrying on a panic

A RuntimeError: Chroma persist failed ... means the store is corrupt or locked. Delete the directory or switch to a fresh path โ€” re-running against the same broken store repeats the failure.

Isolate per environment

Use distinct paths for development, test, and production so an experiment never corrupts a shared index.


Related