Skip to main content

Official Python client for the Durbl memory engine

Project description

Durbl Python SDK

The official Python client for the Durbl memory engine — a managed cognitive substrate for AI agents that need persistent, queryable memory across runs, sessions, and users.

Install

pip install durbl-sdk

Quickstart

from durbl_sdk import Durbl

client = Durbl(api_key="drbl_...")  # or set DURBL_API_KEY

# Write a memory
client.memory.write(
    entity="user/ahmed",
    content="Prefers TypeScript over JavaScript",
    type="preference",
    importance=0.8,
)

# Update entity state
client.state.update("user/ahmed", {"plan": "pro", "seats": 5})

# Recall by semantic search
hits = client.memory.recall(entity="user/ahmed", query="language preference", limit=3)
for m in hits:
    print(m["content"])

# Build a context window for an LLM call
ctx = client.context.build(entity="user/ahmed", goal="suggest a stack", max_memories=10)
print(ctx.assembled_context)

Async usage

Every resource has an a* mirror that uses httpx.AsyncClient:

import asyncio
from durbl_sdk import Durbl

async def main():
    async with Durbl(api_key="drbl_...") as client:
        await client.memory.awrite(entity="user/me", content="Likes coffee", type="preference")
        state = await client.state.aget("user/me")

asyncio.run(main())

Resources

Resource Operations
client.memory write · get · update · delete · list · recall
client.state get · update · history
client.context build · recall
client.events write · list
client.intelligence (analytics endpoints)
client.lifecycle (memory lifecycle)
client.policies (per-project policies)

Entity IDs

Entity IDs are free-form strings and may contain / (user/ahmed, team/acme/billing). The SDK percent-encodes them automatically when they appear in URL paths.

Error handling

from durbl_sdk.exceptions import DurblAPIError

try:
    client.memory.write(entity="user/me", content="...")
except DurblAPIError as e:
    print(e.status_code, e.message)

Examples

The examples/ directory has runnable sample apps:

  • personal_coach — habit/goal tracker with semantic + preference memory
  • recipe_memory — diet/preference-aware meal suggestions
  • support_agent — per-customer briefs that demonstrate isolation

Links

License

Apache-2.0

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

durbl_sdk-0.2.1.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

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

durbl_sdk-0.2.1-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file durbl_sdk-0.2.1.tar.gz.

File metadata

  • Download URL: durbl_sdk-0.2.1.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for durbl_sdk-0.2.1.tar.gz
Algorithm Hash digest
SHA256 d351701e0f94ebf65411a9e79f42a8d0d78aebc279ed59c52c8366a86e5ce1dc
MD5 ef4f65134a88e4e3e543d6c4fc9bf062
BLAKE2b-256 f78b56fd77a426fed2cf52066b641134ef206a814df4455c99327672911b301e

See more details on using hashes here.

File details

Details for the file durbl_sdk-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: durbl_sdk-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for durbl_sdk-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b15a856d2529991fa6b9582554172eda7ea3f4c8dcaa0b6cc842da6ae0275de4
MD5 fa91498ed5a777ab63010b2663abf56b
BLAKE2b-256 4c325cb748768970d8bfd3561947af8bbe41917947b3293d7e3d0c63b57e4ca5

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