Skip to main content

SrvDB

An embedded, crash-safe vector database for local and offline AI. Rust core, Python first.

PyPI Python versions CI License: Apache-2.0

Documentation · Quickstart · Examples · Changelog · Community · Sponsor


SrvDB (spelled S-R-V-D-B) is a library, not a service: it stores embeddings on local disk inside your own process, with no server, no Docker and no network access. Use it for local RAG, semantic search and AI agent memory. It is not related to SurrealDB.

Quickstart

import srvdb

with srvdb.create("./my-db", dimension=3, index="hnsw") as db:  # saved on exit
    db.add(["a", "b"], [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0]], ['{"t": "x"}', '{"t": "y"}'])

with srvdb.open("./my-db") as db:          # settings are read from disk
    print(db.search([0.9, 0.1, 0.0], k=1))  # [('a', 0.99...)]
    db.add(["c"], [[0.0, 0.0, 1.0]], ['{"t": "z"}'])
    db.save()                               # durable from here on

srvdb.delete("./my-db")

Metadata is a JSON string per record. Pick another index by name with its options, for example srvdb.create(path, 384, index="rabitq", bits=2).

Install

pip install srvdb

Release wheels use the stable ABI (CPython 3.9 and later) for Linux x86_64 and aarch64, macOS arm64 and x86_64, and Windows x86_64. Building from source needs Rust 1.99 or later (installation guide).

Features

Feature What you get Docs
Flat Exact cosine search Flat
HNSW Graph index, approximate, true cosine scores (default index) HNSW
IVF Partitions with a graph per partition, for large collections IVF
SQ8 1 byte per dimension, 4x smaller than flat SQ8
PQ Up to 32x smaller codes (see Known issues) PQ
RaBitQ 1, 2 or 4 bits per dimension with reranking, no training RaBitQ
Filtered search search(q, k, where={"year": {"$gte": 2020}}), applied during the search Filtered search
Keyword search (BM25) search(None, k, text="E0308") over one metadata field Keyword search
Hybrid search Vector and BM25 rankings fused with Reciprocal Rank Fusion Keyword search
Graph links link, neighbors, and search(..., expand=(type, hops)) Links
Certified and deadline search RaBitQ error bounds (certify=True) and a scan time limit (deadline_ms=) RaBitQ guide
Memory budget index="auto", memory_mb=50 re-encodes to fewer bits as data grows Memory budget
Checksums and crash safety Checksummed files, atomic saves, crash tests; srvdb.rebuild_checksums Durability

Approximate modes trade accuracy for speed or size depending on your data; measure recall against flat before switching (how to choose).

The durability promise

When save() returns, every earlier add, upsert and delete survives a process crash or power loss. After a crash the database reopens in the state of the last save(): later writes are absent, never half-present.

Details: Durability and ADR 0003.

Use it from Rust

[dependencies]
srvdb = { git = "https://github.com/Srinivas26k/srvdb" }
use srvdb::{CreateOptions, IndexChoice, SrvDB, Vector, VectorEngine};

let mut db = SrvDB::create("./rust-db", 384, &CreateOptions::new(IndexChoice::Hnsw))?;
db.add(&Vector::new(vec![0.1; 384]), r#"{"title": "first"}"#)?;
db.persist()?; // durable from here on
let hits = db.search(&Vector::new(vec![0.1; 384]), 5)?;

More in the Rust guide.

Performance

This README quotes no numbers. Published numbers come only from the committed benchmark harness, which records hardware, OS, dataset, commit and command: see docs/benchmarks.md and the benchmarks page. Run it on your own machine:

cargo run --release -p srvdb --example bench

Known issues

Both are targeted at 0.4.1.

  • #94: hybrid ranking can bury exact keyword matches. For exact codes and names, use keyword-only search (search(None, k, text=...)) or a where filter.
  • #95: PQ recall is low. Prefer RaBitQ (index="rabitq") for compressed storage.

Documentation

Community

Questions, feedback and project showcases live in GitHub Discussions; see the Community page. Please follow the Code of Conduct and report security issues privately as described in SECURITY.md.

Contributing

Bug reports, docs, tests, benchmark results from your hardware and code are all welcome. Start with CONTRIBUTING.md; the engineering rules every change follows are in AGENTS.md.

Contributors

Thank you to everyone who has helped build SrvDB. New contributors are very welcome: pick an issue labelled good first issue and follow CONTRIBUTING.md.

SrvDB contributors

Community pull requests under review:

Sponsor

SrvDB has no outside funding. Donations pay for CI on more platforms, benchmark hardware and roadmap work: razorpay.me/@nampallisrinivas or the Sponsor page. Commercial support and consulting: srinivasvarma764@gmail.com

License

Apache License 2.0. Releases up to and including 0.2.0 were published under AGPL-3.0. The SrvDB name and eagle logo are not covered by the licence (brand guide).

Acknowledgments

Built on SimSIMD, Rayon, PyO3, redb and parking_lot.

Metadata

Release files for srvdb 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for srvdb 0.4.0
File Size Uploaded Provenance Actions
srvdb-0.4.0.tar.gz 277.3 kB With provenance Details for srvdb-0.4.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for srvdb 0.4.0
File Actions
srvdb-0.4.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for srvdb-0.4.0-cp39-abi3-win_amd64.whl
srvdb-0.4.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for srvdb-0.4.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
srvdb-0.4.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for srvdb-0.4.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
srvdb-0.4.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for srvdb-0.4.0-cp39-abi3-macosx_11_0_arm64.whl
srvdb-0.4.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details for srvdb-0.4.0-cp39-abi3-macosx_10_12_x86_64.whl

Total release size: 8.9 MB

Release files / srvdb-0.4.0.tar.gz

Download URL srvdb-0.4.0.tar.gz
Size 277.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ae65c9f64f887dc44d9f56f1acd473aaf9f195123cc395a3cdcda7206480c517
BLAKE2b-256 checksum
How to use checksums
a243924e283158523a228ac39fe8800f36732942ef67e78fce7cb0cf337e81e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / srvdb-0.4.0-cp39-abi3-win_amd64.whl

Download URL srvdb-0.4.0-cp39-abi3-win_amd64.whl
Size 1.8 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
6902a7e1af80d635ae715583186fa4d601f00e401fc12033ac5bfad8bb0fa106
BLAKE2b-256 checksum
How to use checksums
1d2c06fb3bf429f0d54fa40dd6bab040f67bdd176855e2daebca09892c4d0a80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / srvdb-0.4.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL srvdb-0.4.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 1.8 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
6308542c092d4e82243e362091302080735e7bbf5a4947693b27da3981f42321
BLAKE2b-256 checksum
How to use checksums
a2b3d16011e2815571e38ab3fd8a2bd4c15a8e89e6864885110272b18b1d6d65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / srvdb-0.4.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL srvdb-0.4.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 1.6 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
932596d3c35928656373e1fbeaab60fb67910d53e8b2d73d389fe2d2e493de35
BLAKE2b-256 checksum
How to use checksums
5ae83c3f0e175e403b057e1a2e5a53c12fbb0d0707b8386311a03e1f5f736319
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / srvdb-0.4.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL srvdb-0.4.0-cp39-abi3-macosx_11_0_arm64.whl
Size 1.6 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
944495d2127a279f4c5243d4cc53e1c7b9fe4237b252f259b2977eee295cca2c
BLAKE2b-256 checksum
How to use checksums
ef1ea241195416f32c231af7b60d7c240ae23bdf948f95f77f8251c902a48f83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / srvdb-0.4.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL srvdb-0.4.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 1.8 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
2f86f17b3327732cf908deab5304ef305dbafca84cdad7ae644749f57a98322e
BLAKE2b-256 checksum
How to use checksums
9259196580e39bb85c22d10ce9826c1dfad0d9967736dfcbfacb3e1e3c5fb047
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Security for srvdb 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for srvdb-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page