Skip to main content

Python SDK for ClawDB — the cognitive database for AI agents

Project description

clawdb (Python SDK)

The official Python client for ClawDB — persistent, branchable, semantically-searchable agent memory.

pip install clawdb

Sync usage

from clawdb import ClawDB

db = ClawDB(endpoint="http://localhost:50050", agent_id="my-agent")

# Store a memory
id = db.memory.remember("Deploy at 3 PM UTC", memory_type="task", tags=["ops"])

# Search
results = db.memory.search("deploy schedule", top_k=5)
for r in results:
    print(f"{r.score:.3f}  {r.memory.content}")

# Recall by ID
memories = db.memory.recall([id])

# Forget
db.memory.forget(id)

Async usage

import asyncio
from clawdb.aio import AsyncClawDB

async def main():
    async with AsyncClawDB(endpoint="http://localhost:50050") as db:
        id = await db.memory.remember("Async test")
        results = await db.memory.search("test")

asyncio.run(main())

Branches

branch = db.branches.fork("my-experiment")
db.memory.remember("hypothesis", tags=["experiment"])  # writes to current branch
db.branches.merge("my-experiment", into="trunk")

LangChain integration

from clawdb.langchain import ClawDBRetriever
retriever = ClawDBRetriever(db=db, top_k=10)
docs = retriever.get_relevant_documents("deploy schedule")

Configuration

Env var Description
CLAWDB_ENDPOINT gRPC endpoint (default http://localhost:50050)
CLAWDB_API_KEY API key (ck_live_... or ck_test_...)
CLAWDB_AGENT_ID Agent identifier

Development

pip install -e ".[dev]"
pytest

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

clawdb-0.1.0.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

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

clawdb-0.1.0-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for clawdb-0.1.0.tar.gz
Algorithm Hash digest
SHA256 aa9253ca644bce2681e82759932bbe59ead3eaf5f742c41009da2d14e12b3b41
MD5 4e465b6da5ab0d9286d37208542850da
BLAKE2b-256 9f6864b81d79272b5a33777d8dae04849a1ae1e8ce3c8e95e508bab3f97cf886

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for clawdb-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4058e048a2c5f906bc36bdce2029e10d9a0cdebcd3c171044ccc75b7d5c94ea2
MD5 4206f19787ee45721b11dc227801a861
BLAKE2b-256 38f6387b9a210e6d599c66cd3186fea70d812cadc28ef8e70eb06a3b00203e52

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