Skip to main content

Python SDK for PraqtorDB for Apps — per-user memory, knowledge graph, and Deep Memory for your application's end users.

Project description

PraqtorDB for Apps — Python SDK

Give your application's end users persistent, isolated memory — a per-user knowledge graph and AI-generated Deep Memory briefing — over two HTTP calls. This SDK wraps the PraqtorDB for Apps data-plane API (/v1).

Install

pip install -e sdk/python      # local/dev (from this repo)
# pip install praqtordb-apps   # once published

Quickstart

from praqtordb_apps import Client

c = Client(api_key="pk_live_...")          # your app's secret key
c.add(end_user_id="sarah", text="On the Pro plan at Acme.")
print(c.search(query="plan", end_user_id="sarah"))

That's it — the memory is chunked, embedded, and auto-extracted into notes, entities, and a Deep Memory briefing for sarah, isolated from every other user in your app.

Configuration

Client(api_key="pk_live_...", base_url="https://praqtordb-for-apps.fly.dev", timeout=30.0)
  • api_key — your app's secret key (sent as the X-API-Key header). Required.
  • base_url — the API host. Defaults to the hosted API; override for self-hosted/staging.

Methods

Method Endpoint Description
add(end_user_id, text, source_type="chat") POST /v1/memory Store a memory for one user.
search(query, end_user_id=None, limit=10) POST /v1/search 3-layer retrieval (semantic + keyword + graph), RRF-fused. Omit end_user_id to search the whole app.
list_users() GET /v1/users List the app's end users.
get_user(end_user_id) GET /v1/users/{id} Full detail: briefing, memories, entities, conversations.
delete_user(end_user_id) / forget(...) DELETE /v1/users/{id} GDPR cascade erasure for one user.
preload(end_user_id, notes=[...], ...) POST /v1/users/{id}/profile Pre-load a user's memory before they ever chat (CSV/CRM import).

Pre-load (the "known on message one" pattern)

c.preload(
    end_user_id="jordan_cfo",
    notes=["Plan: Enterprise", "Company: Acme Robotics", "Renewal: 2026-03-15"],
    entities=[{"name": "Acme Robotics", "type": "COMPANY"}],
    topics=["enterprise", "onboarding"],
)

The user now has a populated Deep Memory briefing and searchable history — so the very first time they message your bot, it already knows them. Supply briefing=... to set the profile verbatim (no LLM call); omit it and one is synthesized from the notes.

Async

Same surface, for asyncio apps and agents:

import asyncio
from praqtordb_apps import AsyncClient

async def main():
    async with AsyncClient(api_key="pk_live_...") as c:
        await c.add(end_user_id="sarah", text="On the Pro plan")
        print(await c.search(query="plan", end_user_id="sarah"))

asyncio.run(main())

Errors

from praqtordb_apps import PraqtorAPIError, PraqtorError

try:
    c.get_user("nobody")
except PraqtorAPIError as e:
    print(e.status_code, e.detail)   # e.g. 404 "unknown end_user_id"
except PraqtorError as e:
    print("network/transport error:", e)

Requirements

Python 3.9+, httpx.

Project details


Download files

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

Source Distribution

praqtordb_apps-0.1.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

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

praqtordb_apps-0.1.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file praqtordb_apps-0.1.0.tar.gz.

File metadata

  • Download URL: praqtordb_apps-0.1.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for praqtordb_apps-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9bc8bc71863c9920211c334f9aa35d2d34ac9c9248e2748605e5a543d3b44be5
MD5 b5136444b2b3b801a5daea042b5d7608
BLAKE2b-256 05aceb90e8183d066c227918682c0e1b0b39f4a04f89ac279cdfb8d7a2c383d8

See more details on using hashes here.

File details

Details for the file praqtordb_apps-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: praqtordb_apps-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for praqtordb_apps-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 591bc895b51feac3ac90371462316a01d971484526e2df99c7ebf71b4a12fab7
MD5 88010cb1e51ada7f25d85d778323b00a
BLAKE2b-256 5baa8f8c9c3483ee77ff6e11e5dc02f34260db08f8de1080119a049155ae9fb0

See more details on using hashes here.

Supported by

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