Skip to main content

🐍 VantaDB Python SDK

Bindings oficiales de Python para VantaDB, un motor de base de datos embebido y nativo en Rust diseñado para memoria persistente y recuperación vectorial en aplicaciones de IA local-first.

📦 Instalación

Desde TestPyPI (Recomendado para pruebas)

pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ vantadb-py

Desde el código fuente (Desarrollo)

Requiere Rust y Maturin instalados.

# Clonar el repositorio
git clone https://github.com/ness-e/Vantadb.git
cd Vantadb/vantadb-python

# Compilar e instalar en el entorno virtual activo
pip install maturin
maturin develop --release

🚀 Quickstart

import vantadb_py as vdb

# 1. Abrir o crear una base de datos embebida
db = vdb.VantaDB("./my_agent_memory", memory_limit_bytes=128 * 1024 * 1024)

# 2. Almacenar memoria persistente (payload + vector + metadatos)
db.put_memory(
    namespace="agent/session_1",
    key="fact_001",
    payload="El usuario prefiere respuestas técnicas y directas.",
    metadata={"source": "chat", "priority": "high"},
    vector=[0.1, 0.2, 0.3, 0.4]  # Vector denso (ej. embedding de un modelo local)
)

# 3. Recuperar memoria exacta
record = db.get_memory("agent/session_1", "fact_001")
print(record["payload"])

# 4. busqueda-hibrida (Vectorial + Léxica)
# Nota: Requiere un vector de consulta del mismo tamaño que los almacenados
query_vector = [0.15, 0.25, 0.35, 0.45]
results = db.search_hybrid(
    namespace="agent/session_1",
    query_vector=query_vector,
    query_text="preferencias usuario",
    top_k=5
)

for hit in results:
    print(f"Key: {hit['key']}, Score: {hit['score']:.4f}")

# 5. Monitoreo de recursos (Crítico para agentes locales)
stats = db.memory_stats()
print(f"Uso lógico: {stats['logical_bytes'] / 1024:.2f} KB")
print(f"RSS físico: {stats['physical_rss'] / 1024:.2f} KB")

# 6. Cierre seguro
db.close()

🤖 Caso de Uso: Memoria para Agentes de IA

VantaDB está optimizado para actuar como memoria a largo plazo para agentes autónomos locales (Claude, Gemini, LLaMA, etc.):

  • Persistencia Zero-Copy: Los datos sobreviven a reinicios del agente sin overhead de serialización.
  • busqueda-hibrida RRF: Combina similitud semántica (vectores) con coincidencia léxica (BM25) para recuperación precisa de contexto.
  • Control de Memoria Explícito: memory_limit_bytes evita que el agente colapse la RAM del dispositivo host.
  • Embebido: Sin servidores externos, sin Docker, sin latencia de red. Ideal para dispositivos edge y offline.

🛠️ Desarrollo y Testing

# Ejecutar la suite de tests del SDK
pytest tests/test_sdk.py -v

# Formatear código Python
black tests/ vantadb_python/

📜 Licencia

Distribuido bajo la licencia del proyecto principal VantaDB. Consulta el LICENSE en la raíz del repositorio.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

vantadb_py-0.2.0-cp311-abi3-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.11+Windows x86-64

vantadb_py-0.2.0-cp311-abi3-manylinux_2_28_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ x86-64

vantadb_py-0.2.0-cp311-abi3-macosx_11_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

File details

Details for the file vantadb_py-0.2.0-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: vantadb_py-0.2.0-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for vantadb_py-0.2.0-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0ed6b3de2a386375bbdd006b3ae7c19a21418477d2b36a72a891690d6729aefc
MD5 c2d1ca0dd8ec04c1a9b6019ccf4a4623
BLAKE2b-256 9cff40f594752396de2978e2eb4e7df533cd12546c8857e57eff86e849565f5e

See more details on using hashes here.

Provenance

The following attestation bundles were made for vantadb_py-0.2.0-cp311-abi3-win_amd64.whl:

Publisher: release-wheels-60.yml on ness-e/Vantadb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vantadb_py-0.2.0-cp311-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for vantadb_py-0.2.0-cp311-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e666f7cd5ad789dbb605196c40ae72d1ec23aea2a7cc148a9a05a5a93800b2d4
MD5 3b3a24ff4a806523d2c879f9d06487e4
BLAKE2b-256 40dab5f039d078525ac3835d658309a399eba07d0a77acc27d1a4394ddcc7a80

See more details on using hashes here.

Provenance

The following attestation bundles were made for vantadb_py-0.2.0-cp311-abi3-manylinux_2_28_x86_64.whl:

Publisher: release-wheels-60.yml on ness-e/Vantadb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vantadb_py-0.2.0-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for vantadb_py-0.2.0-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cb4aac3e333891ca25ba847415f375849917efc2530dce559a3ff4b55f9e30bb
MD5 75e9bddf62de2f6c22754ae4d5f5be88
BLAKE2b-256 c9985a14a73bde8270424a25aa1e00f7a10f7ee2dc99f27ccd3543fa91f30bcc

See more details on using hashes here.

Provenance

The following attestation bundles were made for vantadb_py-0.2.0-cp311-abi3-macosx_11_0_arm64.whl:

Publisher: release-wheels-60.yml on ness-e/Vantadb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.5.0

3 files

0.4.0

3 files

This release

0.2.0 This release

3 files

0.1.5

3 files

0.1.4

3 files

0.1.3

3 files

0.1.2

3 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page