Skip to main content
Give your Rust agents semantic search — store text as vector embeddings and retrieve the most relevant chunks by meaning, not just keywords.

Quick Start

1

Agent with Knowledge (Simplest)

The easiest way to use vector storage — attach files to an agent and it handles indexing automatically.
use praisonai::{Agent, KnowledgeConfig, VectorStore};

let knowledge = KnowledgeConfig::new()
    .source("docs/")
    .vector_store(VectorStore::InMemory);

let agent = Agent::new()
    .name("Researcher")
    .instructions("Answer questions using the provided documents")
    .knowledge(knowledge)
    .build()?;

let answer = agent.chat("How do I configure authentication?").await?;
println!("{}", answer);
2

Persistent Storage with SQLite

Switch to SQLite for data that survives process restarts.
use praisonai::{Agent, KnowledgeConfig, VectorStore};

let knowledge = KnowledgeConfig::new()
    .source("docs/")
    .vector_store(VectorStore::SQLite {
        path: "knowledge.db".into()
    });

let agent = Agent::new()
    .name("Assistant")
    .knowledge(knowledge)
    .build()?;
3

Production with Qdrant

Use a dedicated vector database for production-scale deployments.
use praisonai::{Agent, KnowledgeConfig, VectorStore};

let knowledge = KnowledgeConfig::new()
    .source("docs/")
    .vector_store(VectorStore::Qdrant {
        url: "http://localhost:6333".into(),
        collection: "my_docs".into(),
    });

let agent = Agent::new()
    .name("Assistant")
    .knowledge(knowledge)
    .build()?;

How It Works


Vector Store Options

Choose the right backend for your needs:
StoreTypeUse Case
VectorStore::InMemoryIn-processDevelopment, testing, short-lived agents
VectorStore::SQLite { path }Local filePersistent, single-machine deployments
VectorStore::Postgres { url }Remote DBProduction, multi-instance
VectorStore::Qdrant { url, collection }Dedicated vector DBHigh-scale production

Common Patterns

Multiple Document Sources

use praisonai::{Agent, KnowledgeConfig, VectorStore};

let knowledge = KnowledgeConfig::new()
    .source("docs/api.pdf")
    .source("docs/guide.md")
    .source("https://docs.example.com/faq")
    .vector_store(VectorStore::InMemory);

let agent = Agent::new()
    .name("Support Agent")
    .instructions("Answer customer questions from the documentation")
    .knowledge(knowledge)
    .build()?;

Namespace Isolation

Keep different datasets separate within the same store.
use praisonai::{Agent, KnowledgeConfig, VectorStore};

// Agent for English docs
let en_knowledge = KnowledgeConfig::new()
    .source("docs/en/")
    .namespace("en")
    .vector_store(VectorStore::SQLite { path: "kb.db".into() });

// Agent for Spanish docs (same DB, different namespace)
let es_knowledge = KnowledgeConfig::new()
    .source("docs/es/")
    .namespace("es")
    .vector_store(VectorStore::SQLite { path: "kb.db".into() });

Best Practices

Use VectorStore::InMemory during development — no setup required. When you need persistence or scale, switch to SQLite or Qdrant by changing one line. The agent code stays identical.
Namespaces let multiple agents share one database without data bleeding between them. Use a per-user or per-project namespace: "user:alice", "project:v2".
Very long documents score poorly in semantic search. Split them into 500–1000 character chunks so the embedder captures focused meaning per chunk. Use the chunking options in KnowledgeConfig to control this automatically.
For production workloads with thousands of documents, Qdrant delivers faster approximate nearest-neighbour search than a full table scan in SQLite or Postgres.

Knowledge

Full knowledge base configuration

Embeddings

Generate and manage embeddings