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
Metadata
Release files for arqondb 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| arqondb-0.2.1-py3-none-win_arm64.whl | Python 3 | none | Windows ARM64 | Details |
| arqondb-0.2.1-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| arqondb-0.2.1-py3-none-manylinux_2_17_x86_64.whl | Python 3 | none | Linux glibc 2.17+ x86-64 | Details |
| arqondb-0.2.1-py3-none-manylinux_2_17_aarch64.whl | Python 3 | none | Linux glibc 2.17+ ARM64 | Details |
| arqondb-0.2.1-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details |
| arqondb-0.2.1-py3-none-macosx_10_12_x86_64.whl | Python 3 | none | macOS 10.12+ x86-64 | Details |
Total release size: 87.2 MB
Release files / arqondb-0.2.1-py3-none-win_arm64.whl
| Download URL | arqondb-0.2.1-py3-none-win_arm64.whl |
|---|---|
| Size | 12.5 MB |
| Tags | Python 3 Windows ARM64 |
|
SHA-256 checksum How to use checksums |
3cf55652ef07a2f0d37fb2f3131255686972f33d6282560422b53574c3413cf1
|
|
BLAKE2b-256 checksum How to use checksums |
7e26f0c15fd8fdb33cd2717082a996ba32def8fc2aeecd5ce5c1c9a26662a395
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 26, 2026.
Transparency logRelease files / arqondb-0.2.1-py3-none-win_amd64.whl
| Download URL | arqondb-0.2.1-py3-none-win_amd64.whl |
|---|---|
| Size | 13.8 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
b7375ade650608255578f90166e01a026b5a158ce335edf7eac3746937549051
|
|
BLAKE2b-256 checksum How to use checksums |
37dbecbd527d36ac124bac943c53a42bf354fbdb00f231fee20462937742e182
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 26, 2026.
Transparency logRelease files / arqondb-0.2.1-py3-none-manylinux_2_17_x86_64.whl
| Download URL | arqondb-0.2.1-py3-none-manylinux_2_17_x86_64.whl |
|---|---|
| Size | 16.3 MB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
eda04e9b1ad10c7284c8e6d38ed137ce1acf28a2ac98bc3c27c7333b7abe890b
|
|
BLAKE2b-256 checksum How to use checksums |
0aa4cbc0af99582e51694c13f478e28e436d54c0f3afdf480e6262dea60eff76
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 26, 2026.
Transparency logRelease files / arqondb-0.2.1-py3-none-manylinux_2_17_aarch64.whl
| Download URL | arqondb-0.2.1-py3-none-manylinux_2_17_aarch64.whl |
|---|---|
| Size | 15.5 MB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
e8f2b8fcd13c6f6f88333aed13d8b1f1637d619038ebb83da74afc6eb42ab621
|
|
BLAKE2b-256 checksum How to use checksums |
a8ded1f28d057661be1e0d58da5c6c7d8b42dbbdb1fd9cfe3d8190b1192bbba1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 26, 2026.
Transparency logRelease files / arqondb-0.2.1-py3-none-macosx_11_0_arm64.whl
| Download URL | arqondb-0.2.1-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 14.2 MB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
e67406aac91c8dce98cb2fe2055dffa72998d7470db6f944e09e47ce0d68e36b
|
|
BLAKE2b-256 checksum How to use checksums |
cbc154c25165a66715beb613afb42e9db023b1066bff265e2a220cd47c40ce07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 26, 2026.
Transparency logRelease files / arqondb-0.2.1-py3-none-macosx_10_12_x86_64.whl
| Download URL | arqondb-0.2.1-py3-none-macosx_10_12_x86_64.whl |
|---|---|
| Size | 14.9 MB |
| Tags | Python 3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
96dfb1af589a882954387283042dfbd3bac611179cb7b29d6847982c1b5b1c1b
|
|
BLAKE2b-256 checksum How to use checksums |
6e15b3b8d637204a1c8599a2180fa47abfa1c88f4e7d6c3df4024ab2d48dbc67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 26, 2026.
Transparency log