Skip to main content

Python SDK & server binaries for ArqonDB — agent memory with KV, vector search, and temporal causal graphs in one database

Project description

ArqonDB Python SDK

Agent memory with KV, vector search, and temporal causal graphs — in one database.

Quick Start

pip install arqondb

High-Level Client

from arqondb import Client

# No auth (local dev without GATEWAY_JWT_SECRET)
db = Client("localhost:9379")

# With auth (auto-login, fetches JWT from gateway management API)
db = Client("localhost:9379", username="admin", password="admin")

# With a pre-obtained token
db = Client("localhost:9379", token="eyJ...")

# KV — keys can be str or bytes
db.put("key", b"value")
print(db.get("key"))          # b"value"
db.delete("key")

Agent State: Causal Graph

from arqondb import Client

db = Client("localhost:9379", username="admin", password="admin")

# Add steps to the causal graph
s1 = db.add_step("agent-1", "Observe", content=b"user clicked buy")
s2 = db.add_step("agent-1", "Think",   content=b"should confirm order")
s3 = db.add_step("agent-1", "Act",     content=b"sent confirmation email")

# Link them causally
db.add_edge(s1, s2, "Triggers")
db.add_edge(s2, s3, "Triggers")

# Traverse the chain
result = db.traverse(s1, direction="forward", max_depth=5)
for step in result.steps:
    print(f"  [{step.step_type}] {step.content}")

# Find similar causal chains by embedding
chains = db.find_similar_chains(query_embedding=[0.1] * 128, k=3, chain_depth=3)

Agent State: Branching (Fork)

# Fork a speculative branch
branch_id = db.fork("experiment-a")

# Write to the branch (isolated from main timeline)
db.branch_put(branch_id, "config:model", b"gpt-4o")
val = db.branch_get(branch_id, "config:model")

# Merge back or discard
db.merge_branch(branch_id)
# db.discard_branch(branch_id)

# List all branches
for b in db.list_branches():
    print(f"  branch {b.id}: {b.label} ({b.status})")

Agent State: Reactive State

# Compare-and-swap for optimistic concurrency
result = db.cas_put("counter", expected_seq=0, new_value=b"1")
if result.success:
    print(f"written, new version: {result.new_seq}")
else:
    print(f"conflict, current version: {result.actual_seq}")

# Watch for changes (streaming)
for event in db.watch_prefix("agent-1", "state:"):
    print(f"  {event.event_type}: {event.key} = {event.value}")

Async Client

import asyncio
from arqondb import AsyncClient

async def main():
    async with AsyncClient("localhost:9379", username="admin", password="admin") as db:
        await db.put("key", b"value")
        print(await db.get("key"))

        step_id = await db.add_step("agent-1", "Observe", content=b"hello")
        step = await db.get_step(step_id)
        print(step)

asyncio.run(main())

Agent Memory (High-Level 3-Primitive API)

from arqondb import AgentMemory

memory = AgentMemory("127.0.0.1:9379")

# Store observations
obs1 = memory.observe("user prefers dark mode", metadata={"source": "settings"})
obs2 = memory.observe("user switched to light mode after update")

# Link them causally
memory.link(obs1, obs2, relation="caused")

# Recall relevant memories
results = memory.recall("what theme does the user prefer?", k=5)
for r in results:
    print(f"  [{r.id}] {r.text} (distance={r.distance:.3f})")

Low-Level Client (bytes keys, direct gRPC)

from arqondb import ArqonDBClient, VectorIndexConfig

with ArqonDBClient("127.0.0.1:9379") as client:
    # KV
    client.put(b"key", b"value")
    print(client.get(b"key"))  # b"value"

    # Vector search
    client.create_vector_index("my_index", VectorIndexConfig(dim=768, metric="cosine"))
    client.vector_put("my_index", 1, [0.1] * 768)
    results = client.vector_search("my_index", [0.1] * 768, k=5)

    # Graph
    client.create_graph_index("my_graph", dim=768, metric="cosine")
    client.graph_add_node("my_graph", node_id=1, properties=b'{"type":"event"}')
    client.graph_add_edge("my_graph", src=1, dst=2, edge_type="caused", valid_from=1700000000)

API Reference

Client (recommended)

Method Description
put(key, value) Write a KV pair (str or bytes key)
get(key) Read a value (returns None if not found)
delete(key) Delete a key
scan(prefix, limit=100) Scan keys by prefix
add_step(agent_id, step_type, ...) Add a causal step
add_edge(src, dst, edge_type) Add a causal edge
get_step(step_id) Get step metadata
get_content(step_id) Get step content
get_edges(step_id, direction=...) Query edges
traverse(start, direction=..., max_depth=...) BFS graph traversal
find_similar_chains(embedding, k=...) Vector-anchored chain search
fork(label) Create a speculative branch
merge_branch(branch_id) Merge branch to main
discard_branch(branch_id) Discard branch
branch_put(branch_id, key, value) Write to branch
branch_get(branch_id, key) Read from branch
cas_put(key, expected_seq, new_value) Compare-and-swap
watch_prefix(agent_id, prefix) Stream write events
expire_edge(src, dst, type, at) Expire a temporal edge
edge_history(src, dst, type) Get edge version history

AsyncClient

Same API as Client, all methods are async.

Why ArqonDB?

Redis + Pinecone + Neo4j mem0 ArqonDB
Deploy 3 clusters depends on external DBs 1 process
Causal reasoning DIY flat triplets native temporal causal graph
Vector + graph query 3 round-trips not supported 1 query
Streaming writes Pinecone rebuilds index depends on backend SPFreshLSM incremental

Requirements

  • ArqonDB server running (see arqondb.com)
  • Python >= 3.9

Project details


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.

arqondb-0.1.8-py3-none-win_arm64.whl (12.5 MB view details)

Uploaded Python 3Windows ARM64

arqondb-0.1.8-py3-none-win_amd64.whl (13.8 MB view details)

Uploaded Python 3Windows x86-64

arqondb-0.1.8-py3-none-manylinux_2_17_x86_64.whl (16.3 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

arqondb-0.1.8-py3-none-manylinux_2_17_aarch64.whl (15.5 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

arqondb-0.1.8-py3-none-macosx_11_0_arm64.whl (14.2 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

arqondb-0.1.8-py3-none-macosx_10_12_x86_64.whl (14.9 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file arqondb-0.1.8-py3-none-win_arm64.whl.

File metadata

  • Download URL: arqondb-0.1.8-py3-none-win_arm64.whl
  • Upload date:
  • Size: 12.5 MB
  • Tags: Python 3, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for arqondb-0.1.8-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 9f6aad32c7edc3abea82a27531b11a9d6b66a46729bfebb7d1c4ccd8d33be7da
MD5 9e5fef34b97b8e363b26752c53afbc6e
BLAKE2b-256 cfb848d22163d1b93f212d55b14b56d7309a174b0b2842dfb9e758e90c72fae9

See more details on using hashes here.

Provenance

The following attestation bundles were made for arqondb-0.1.8-py3-none-win_arm64.whl:

Publisher: release.yml on AlbericByte/ArqonDB

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

File details

Details for the file arqondb-0.1.8-py3-none-win_amd64.whl.

File metadata

  • Download URL: arqondb-0.1.8-py3-none-win_amd64.whl
  • Upload date:
  • Size: 13.8 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for arqondb-0.1.8-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 175aa9c656086b53fe7e0d11cde7b34b20e6b41e0198da788fafde0d01a105fa
MD5 893ff978a44a9046604cecfd501b7b8b
BLAKE2b-256 06e2783babfee7529c6749d304479e4b668cf5e85877d5390a723c8e79f448af

See more details on using hashes here.

Provenance

The following attestation bundles were made for arqondb-0.1.8-py3-none-win_amd64.whl:

Publisher: release.yml on AlbericByte/ArqonDB

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

File details

Details for the file arqondb-0.1.8-py3-none-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for arqondb-0.1.8-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 f3f6e9ffc8396fcbbdadca61baad00d97b161a27aeafc04759cabec530a012f4
MD5 918100ff2a5bbba1e4a357b16c868f39
BLAKE2b-256 776fc64cada4a350792dbb581f895330f8c26ab5d1803d7db779a042473d487c

See more details on using hashes here.

Provenance

The following attestation bundles were made for arqondb-0.1.8-py3-none-manylinux_2_17_x86_64.whl:

Publisher: release.yml on AlbericByte/ArqonDB

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

File details

Details for the file arqondb-0.1.8-py3-none-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for arqondb-0.1.8-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 ff424c3dc87951a9b4377d3aa286c4dba3b4e4afb4bd23b5a1626e913f3e3f7b
MD5 1bbe19093617eb27915f1b0a53bde28d
BLAKE2b-256 b89bbe745c4b0b23f311790d182291ca42dcc01e39d720da993bfa608794c81c

See more details on using hashes here.

Provenance

The following attestation bundles were made for arqondb-0.1.8-py3-none-manylinux_2_17_aarch64.whl:

Publisher: release.yml on AlbericByte/ArqonDB

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

File details

Details for the file arqondb-0.1.8-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for arqondb-0.1.8-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4341430c2e523a82c7e06ded5fd466397b00c44f9ba1fa78b25324ec1c922dd7
MD5 348b1f1c5bb4dc3d4051ba1246e2d2ca
BLAKE2b-256 8ac0d9fdf605653db2a3b3c2990e1ec174ad4bcc92d8e6e35dd3b8f139c97931

See more details on using hashes here.

Provenance

The following attestation bundles were made for arqondb-0.1.8-py3-none-macosx_11_0_arm64.whl:

Publisher: release.yml on AlbericByte/ArqonDB

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

File details

Details for the file arqondb-0.1.8-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for arqondb-0.1.8-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b5749b5b34b2725a466bb5a7dccdb882ed7e31716b9cea843714d84f1a9335b4
MD5 41f482deb0ac75d366c9cc860aa21ab6
BLAKE2b-256 63f4f7b771707a899c1b770e54e10b0f48eb10f2286f98bd087fdee721fe6fba

See more details on using hashes here.

Provenance

The following attestation bundles were made for arqondb-0.1.8-py3-none-macosx_10_12_x86_64.whl:

Publisher: release.yml on AlbericByte/ArqonDB

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

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