Official Python SDK for XTrace — encrypted vector and memory
Project description
The encrypted vector database.
Your data never leaves your machine in plaintext.
Documentation | X | LinkedIn
Manage your AI memory → mem.xtrace.aiWhat is XTrace?
Every vector database on the market requires you to hand your data to a third party in plaintext. XTrace doesn't. Your documents and embedding vectors are encrypted on your machine before anything is transmitted. The server stores and searches over ciphertexts — it computes nearest-neighbor results without ever seeing the plaintext. Your data stays yours, even during search.
The SDK has two modules:
- x-vec — encrypted vector search. Store and query text chunks with end-to-end encryption.
- x-mem — encrypted agent memory for AI agents (coming soon).
How It Works
Your Machine XTrace Server
┌────────────────────────┐ ┌─────────────────────────┐
│ │ │ │
│ Documents + Queries │ │ Stores only ciphertext │
│ │ │ │ │
│ ▼ │ │ Searches over │
│ Embed + Encrypt │── ciphertext ─▶│ encrypted vectors │
│ (keys stay here) │ │ (never decrypts) │
│ ▲ │ │ │
│ │ │◀─ ciphertext ──│ Returns encrypted │
│ Decrypt results │ │ results │
│ │ │ │
└────────────────────────┘ └─────────────────────────┘
Secret key never leaves Zero knowledge
XTrace encrypts everything on your machine before anything touches the network. Your content is embedded locally with a model of your choice, and both the resulting vectors and the raw text are encrypted with Paillier homomorphic encryption and AES-256, respectively. The server only ever stores and operates on ciphertexts. When you search, your query is encrypted the same way. The secret key never leaves your environment, and the server never sees a single byte of plaintext. Verify the encryption
Quick Start
[!TIP] 🚀 Create a free account at app.xtrace.ai to get your API key and org ID. The free tier is rate-limited but fully functional.
Install
# Base SDK
uv pip install xtrace-ai-sdk
# With local embedding support (Sentence Transformers)
uv pip install "xtrace-ai-sdk[embedding]"
Requires Python 3.11+.
Documentation
Full documentation at docs.xtrace.ai, or build locally:
cd docs && make html
CLI
The fastest way to go from zero to search results:
uv pip install "xtrace-ai-sdk[cli]"
xtrace init # set up credentials + encryption keys
xtrace kb create my-first-kb # create a knowledge base (note the KB ID)
xtrace xvec load ./my-docs/ <KB_ID> # encrypt and upload documents
xtrace xvec retrieve <KB_ID> "your query" # search
Python SDK
Full async example:
import asyncio
from xtrace_sdk.x_vec.utils.execution_context import ExecutionContext
from xtrace_sdk.x_vec.crypto.key_provider import PassphraseKeyProvider
from xtrace_sdk.x_vec.data_loaders.loader import DataLoader
from xtrace_sdk.x_vec.inference.embedding import Embedding
from xtrace_sdk.integrations.xtrace import XTraceIntegration
from xtrace_sdk.x_vec.retrievers.retriever import Retriever
# One-time setup: generate your private cryptographic state and save it
provider = PassphraseKeyProvider("your-secret-passphrase")
ctx = ExecutionContext.create(
key_provider=provider,
homomorphic_client_type="paillier_lookup",
embedding_length=512,
key_len=1024,
path="data/exec_context",
)
embed = Embedding("sentence_transformer", "mixedbread-ai/mxbai-embed-large-v1", 512)
xtrace = XTraceIntegration(org_id="your_org_id", api_key="your_api_key")
async def main():
# Encrypt and store documents — content and vectors never leave in plaintext
loader = DataLoader(ctx, xtrace)
docs = [{"chunk_content": "XTrace encrypts your embeddings.", "meta_data": {}}]
vectors = [await embed.bin_embed(d["chunk_content"]) for d in docs]
index, db = await loader.load_data_from_memory(docs, vectors)
await loader.dump_db(db, index=index, kb_id="your_kb_id")
# Query with an encrypted vector — the server never sees the query in plaintext
retriever = Retriever(ctx, xtrace)
vec = await embed.bin_embed("How does XTrace protect my data?")
ids = await retriever.nn_search_for_ids(vec, k=3, kb_id="your_kb_id")
results = await retriever.retrieve_and_decrypt(ids, kb_id="your_kb_id")
for r in results:
print(r["chunk_content"])
asyncio.run(main())
Verify the Encryption
This repo exists so you can verify the encryption yourself. The tests run fully offline and require no XTrace account:
uv pip install -e ".[dev]"
pytest tests/x_vec/
test_paillier_encryption.py and test_paillier_lookup_encryption.py verify encrypt/decrypt round-trips and homomorphic addition on ciphertexts — the same primitives the SDK uses when sending data to XTrace. The secret key never leaves your machine.
Contributing
We welcome contributions. See CONTRIBUTING.md for guidelines.
License
Apache 2.0 — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xtrace_ai_sdk-0.1.0.tar.gz.
File metadata
- Download URL: xtrace_ai_sdk-0.1.0.tar.gz
- Upload date:
- Size: 75.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a01f266b44586b76fc595f77a88d9e7cc0c7e3054965c043c5d7c09d13204ec5
|
|
| MD5 |
d1a1c6bae62819477930f060b4940069
|
|
| BLAKE2b-256 |
009257ce2bb4aeb9ca4dbb3ace5f179bdca709b3258e9e830a42cc6a76ece7e5
|
Provenance
The following attestation bundles were made for xtrace_ai_sdk-0.1.0.tar.gz:
Publisher:
release.yml on XTraceAI/xtrace-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xtrace_ai_sdk-0.1.0.tar.gz -
Subject digest:
a01f266b44586b76fc595f77a88d9e7cc0c7e3054965c043c5d7c09d13204ec5 - Sigstore transparency entry: 1201126874
- Sigstore integration time:
-
Permalink:
XTraceAI/xtrace-sdk@40feab150075b101bb550e28e542b54e6a789a0c -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/XTraceAI
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@40feab150075b101bb550e28e542b54e6a789a0c -
Trigger Event:
push
-
Statement type:
File details
Details for the file xtrace_ai_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: xtrace_ai_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 110.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e465a5dce054b9df00d3a007df64e610f7d5f54f387bedd66fb82368a245dd6f
|
|
| MD5 |
536ce3d9eeb12ff91cd06578b7456638
|
|
| BLAKE2b-256 |
b1d5481a1790b57474cbb2c0d9934fef2945918391f56dbc7e7c17f909d6cfd6
|
Provenance
The following attestation bundles were made for xtrace_ai_sdk-0.1.0-py3-none-any.whl:
Publisher:
release.yml on XTraceAI/xtrace-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xtrace_ai_sdk-0.1.0-py3-none-any.whl -
Subject digest:
e465a5dce054b9df00d3a007df64e610f7d5f54f387bedd66fb82368a245dd6f - Sigstore transparency entry: 1201126888
- Sigstore integration time:
-
Permalink:
XTraceAI/xtrace-sdk@40feab150075b101bb550e28e542b54e6a789a0c -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/XTraceAI
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@40feab150075b101bb550e28e542b54e6a789a0c -
Trigger Event:
push
-
Statement type: