axonio 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- axonio-0.2.0/.gitignore +9 -0
- axonio-0.2.0/Makefile +16 -0
- axonio-0.2.0/PKG-INFO +102 -0
- axonio-0.2.0/README.md +77 -0
- axonio-0.2.0/axonio/__init__.py +62 -0
- axonio-0.2.0/axonio/_http.py +474 -0
- axonio-0.2.0/axonio/async_client.py +281 -0
- axonio-0.2.0/axonio/branches.py +4 -0
- axonio-0.2.0/axonio/client.py +161 -0
- axonio-0.2.0/axonio/config.py +63 -0
- axonio-0.2.0/axonio/errors.py +123 -0
- axonio-0.2.0/axonio/integrations/__init__.py +1 -0
- axonio-0.2.0/axonio/integrations/langchain.py +82 -0
- axonio-0.2.0/axonio/integrations/mcp.py +54 -0
- axonio-0.2.0/axonio/integrations/openai_agents.py +81 -0
- axonio-0.2.0/axonio/memory.py +156 -0
- axonio-0.2.0/axonio/models.py +82 -0
- axonio-0.2.0/axonio/provision.py +172 -0
- axonio-0.2.0/axonio/reflect.py +4 -0
- axonio-0.2.0/axonio/session.py +59 -0
- axonio-0.2.0/axonio/sync_client.py +89 -0
- axonio-0.2.0/axonio/transactions.py +31 -0
- axonio-0.2.0/pyproject.toml +66 -0
- axonio-0.2.0/tests/test_async_client.py +203 -0
- axonio-0.2.0/tests/test_entrypoint.py +25 -0
- axonio-0.2.0/tests/test_env.py +51 -0
- axonio-0.2.0/tests/test_provision.py +60 -0
axonio-0.2.0/.gitignore
ADDED
axonio-0.2.0/Makefile
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.PHONY: test type-check format lint clean
|
|
2
|
+
|
|
3
|
+
test:
|
|
4
|
+
pytest tests/ -v --tb=short
|
|
5
|
+
|
|
6
|
+
type-check:
|
|
7
|
+
mypy axonio/ --ignore-missing-imports --strict
|
|
8
|
+
|
|
9
|
+
format:
|
|
10
|
+
ruff format axonio/ tests/
|
|
11
|
+
|
|
12
|
+
lint:
|
|
13
|
+
ruff check axonio/ tests/ --fix
|
|
14
|
+
|
|
15
|
+
clean:
|
|
16
|
+
rm -rf dist/ build/ *.egg-info
|
axonio-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: axonio
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Persistent memory for AI agents: hybrid recall, branch and merge. Python client for Axonio.
|
|
5
|
+
License: MIT
|
|
6
|
+
Keywords: agents,ai,axonio,knowledge-graph,langchain,mcp,memory,openai
|
|
7
|
+
Classifier: Development Status :: 3 - Alpha
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Topic :: Database
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Requires-Dist: httpx>=0.27.0
|
|
17
|
+
Requires-Dist: pydantic-settings>=2.3
|
|
18
|
+
Requires-Dist: pydantic>=2.7
|
|
19
|
+
Requires-Dist: structlog>=24.2
|
|
20
|
+
Provides-Extra: langchain
|
|
21
|
+
Requires-Dist: langchain-core>=0.2; extra == 'langchain'
|
|
22
|
+
Provides-Extra: openai
|
|
23
|
+
Requires-Dist: openai>=1.30; extra == 'openai'
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# axonio
|
|
27
|
+
|
|
28
|
+
Official Python client for [Axonio](https://axonio.xyz): persistent memory for AI agents, with sync and async APIs.
|
|
29
|
+
|
|
30
|
+
> Formerly `clawdb`. `pip install axonio` now installs this package, and `import clawdb` still works; `AXONIO_*` environment variables take precedence over `CLAWDB_*`. Pure Python over HTTPS: no gRPC toolchain or generated code to install.
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install axonio
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
### Hosted (Axonio cloud)
|
|
41
|
+
|
|
42
|
+
Create an API key in the dashboard. With only `AXONIO_API_KEY` set, the client
|
|
43
|
+
connects to the hosted gateway (`https://api.axonio.xyz/api/v1/gateway`).
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from axonio import Axonio
|
|
47
|
+
|
|
48
|
+
with Axonio(api_key="ck_live_...", endpoint="https://api.axonio.xyz/api/v1/gateway") as db:
|
|
49
|
+
memory_id = db.memory.remember("Customer prefers weekly updates", tags=["customer"])
|
|
50
|
+
hits = db.memory.search("how often should we update the customer?", top_k=5)
|
|
51
|
+
branch = db.branches.fork("customer-experiment")
|
|
52
|
+
print(memory_id, [h.content for h in hits], branch.branch_id)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Self-hosted
|
|
56
|
+
|
|
57
|
+
Point `endpoint` at your clawdb-server. A bare address on the gRPC port
|
|
58
|
+
(`http://localhost:50050`, the default) is mapped to the server's HTTP port
|
|
59
|
+
(8080); any other URL is used as the HTTP API.
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
db = Axonio(endpoint="http://localhost:8080", agent_id="py-agent")
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Async
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from axonio import AsyncAxonio
|
|
69
|
+
|
|
70
|
+
async with AsyncAxonio(api_key="ck_live_...", endpoint="https://api.axonio.xyz/api/v1/gateway") as db:
|
|
71
|
+
await db.memory.remember("Ship the changelog on Friday", memory_type="task")
|
|
72
|
+
hits = await db.memory.search("release plan")
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Behaviour
|
|
76
|
+
|
|
77
|
+
- Sessions are opened on connect, last an hour, are renewed before they
|
|
78
|
+
expire, and are renewed automatically if the server rejects one.
|
|
79
|
+
- Network errors and 502/503/504 are retried with backoff; 429 honours
|
|
80
|
+
`Retry-After`.
|
|
81
|
+
- Errors are typed: `ClawDBAuthError`, `ClawDBAccessDeniedError`,
|
|
82
|
+
`ClawDBNotFoundError`, `ClawDBValidationError`, `ClawDBRateLimitError`,
|
|
83
|
+
`ClawDBUnavailableError`, `ClawDBTimeoutError`.
|
|
84
|
+
- Agent ids that aren't UUIDs map to a stable UUID, the same one the
|
|
85
|
+
TypeScript SDK derives, so an agent name means one agent in both SDKs.
|
|
86
|
+
|
|
87
|
+
## Client Variants
|
|
88
|
+
|
|
89
|
+
- `Axonio` for synchronous code (also exported as `ClawDB`)
|
|
90
|
+
- `AsyncAxonio` for asyncio applications (also `AsyncClawDB`)
|
|
91
|
+
- `axonio()` helper for environment-aware client creation
|
|
92
|
+
|
|
93
|
+
## API Surface
|
|
94
|
+
|
|
95
|
+
- `db.health()`, `db.session` (validate, refresh, revoke, active count)
|
|
96
|
+
- `db.memory`: remember, remember_typed, search, recall, update, delete, forget, list
|
|
97
|
+
- `db.branches`: fork, list, get, get_by_name, get_trunk, diff, merge, discard, archive
|
|
98
|
+
(`target` accepts a branch id, a name, or trunk)
|
|
99
|
+
- `db.sync`: sync, push, pull, reconcile, status
|
|
100
|
+
- `db.reflect`: trigger, get_job, list_jobs, get_facts, get_preferences,
|
|
101
|
+
get_contradictions, resolve_contradiction
|
|
102
|
+
- `db.tx`: begin, remember, remember_typed, commit, rollback
|
axonio-0.2.0/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# axonio
|
|
2
|
+
|
|
3
|
+
Official Python client for [Axonio](https://axonio.xyz): persistent memory for AI agents, with sync and async APIs.
|
|
4
|
+
|
|
5
|
+
> Formerly `clawdb`. `pip install axonio` now installs this package, and `import clawdb` still works; `AXONIO_*` environment variables take precedence over `CLAWDB_*`. Pure Python over HTTPS: no gRPC toolchain or generated code to install.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install axonio
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
### Hosted (Axonio cloud)
|
|
16
|
+
|
|
17
|
+
Create an API key in the dashboard. With only `AXONIO_API_KEY` set, the client
|
|
18
|
+
connects to the hosted gateway (`https://api.axonio.xyz/api/v1/gateway`).
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
from axonio import Axonio
|
|
22
|
+
|
|
23
|
+
with Axonio(api_key="ck_live_...", endpoint="https://api.axonio.xyz/api/v1/gateway") as db:
|
|
24
|
+
memory_id = db.memory.remember("Customer prefers weekly updates", tags=["customer"])
|
|
25
|
+
hits = db.memory.search("how often should we update the customer?", top_k=5)
|
|
26
|
+
branch = db.branches.fork("customer-experiment")
|
|
27
|
+
print(memory_id, [h.content for h in hits], branch.branch_id)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Self-hosted
|
|
31
|
+
|
|
32
|
+
Point `endpoint` at your clawdb-server. A bare address on the gRPC port
|
|
33
|
+
(`http://localhost:50050`, the default) is mapped to the server's HTTP port
|
|
34
|
+
(8080); any other URL is used as the HTTP API.
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
db = Axonio(endpoint="http://localhost:8080", agent_id="py-agent")
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Async
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from axonio import AsyncAxonio
|
|
44
|
+
|
|
45
|
+
async with AsyncAxonio(api_key="ck_live_...", endpoint="https://api.axonio.xyz/api/v1/gateway") as db:
|
|
46
|
+
await db.memory.remember("Ship the changelog on Friday", memory_type="task")
|
|
47
|
+
hits = await db.memory.search("release plan")
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Behaviour
|
|
51
|
+
|
|
52
|
+
- Sessions are opened on connect, last an hour, are renewed before they
|
|
53
|
+
expire, and are renewed automatically if the server rejects one.
|
|
54
|
+
- Network errors and 502/503/504 are retried with backoff; 429 honours
|
|
55
|
+
`Retry-After`.
|
|
56
|
+
- Errors are typed: `ClawDBAuthError`, `ClawDBAccessDeniedError`,
|
|
57
|
+
`ClawDBNotFoundError`, `ClawDBValidationError`, `ClawDBRateLimitError`,
|
|
58
|
+
`ClawDBUnavailableError`, `ClawDBTimeoutError`.
|
|
59
|
+
- Agent ids that aren't UUIDs map to a stable UUID, the same one the
|
|
60
|
+
TypeScript SDK derives, so an agent name means one agent in both SDKs.
|
|
61
|
+
|
|
62
|
+
## Client Variants
|
|
63
|
+
|
|
64
|
+
- `Axonio` for synchronous code (also exported as `ClawDB`)
|
|
65
|
+
- `AsyncAxonio` for asyncio applications (also `AsyncClawDB`)
|
|
66
|
+
- `axonio()` helper for environment-aware client creation
|
|
67
|
+
|
|
68
|
+
## API Surface
|
|
69
|
+
|
|
70
|
+
- `db.health()`, `db.session` (validate, refresh, revoke, active count)
|
|
71
|
+
- `db.memory`: remember, remember_typed, search, recall, update, delete, forget, list
|
|
72
|
+
- `db.branches`: fork, list, get, get_by_name, get_trunk, diff, merge, discard, archive
|
|
73
|
+
(`target` accepts a branch id, a name, or trunk)
|
|
74
|
+
- `db.sync`: sync, push, pull, reconcile, status
|
|
75
|
+
- `db.reflect`: trigger, get_job, list_jobs, get_facts, get_preferences,
|
|
76
|
+
get_contradictions, resolve_contradiction
|
|
77
|
+
- `db.tx`: begin, remember, remember_typed, commit, rollback
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""Axonio Python SDK: persistent memory for AI agents."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import asyncio
|
|
6
|
+
from typing import Awaitable
|
|
7
|
+
|
|
8
|
+
from axonio.async_client import AsyncClawDB
|
|
9
|
+
from axonio.client import ClawDB
|
|
10
|
+
from axonio.errors import (
|
|
11
|
+
ClawDBAccessDeniedError,
|
|
12
|
+
ClawDBAuthError,
|
|
13
|
+
ClawDBError,
|
|
14
|
+
ClawDBInternalError,
|
|
15
|
+
ClawDBNotFoundError,
|
|
16
|
+
ClawDBRateLimitError,
|
|
17
|
+
ClawDBProvisionError,
|
|
18
|
+
ClawDBTimeoutError,
|
|
19
|
+
ClawDBUnavailableError,
|
|
20
|
+
ClawDBValidationError,
|
|
21
|
+
)
|
|
22
|
+
from axonio.models import BranchInfo, DiffResult, MemoryRecord, MergeResult, ReflectJob, SearchResult, SyncActionResult, SyncResult, SyncStatusResult, TxInfo
|
|
23
|
+
from axonio.transactions import TxClient
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def axonio() -> ClawDB | Awaitable[AsyncClawDB]:
|
|
27
|
+
"""Return sync client in sync code, or awaitable async client inside an event loop."""
|
|
28
|
+
try:
|
|
29
|
+
asyncio.get_running_loop()
|
|
30
|
+
return AsyncClawDB.auto_provision()
|
|
31
|
+
except RuntimeError:
|
|
32
|
+
return ClawDB.auto_provision()
|
|
33
|
+
|
|
34
|
+
# `Axonio` / `AsyncAxonio` are the same classes as `ClawDB` / `AsyncClawDB`;
|
|
35
|
+
# `clawdb()` remains as an alias of `axonio()`.
|
|
36
|
+
Axonio = ClawDB
|
|
37
|
+
AsyncAxonio = AsyncClawDB
|
|
38
|
+
clawdb = axonio
|
|
39
|
+
|
|
40
|
+
__all__ = [
|
|
41
|
+
"axonio",
|
|
42
|
+
"Axonio",
|
|
43
|
+
"AsyncAxonio",
|
|
44
|
+
"clawdb",
|
|
45
|
+
"ClawDB",
|
|
46
|
+
"AsyncClawDB",
|
|
47
|
+
"MemoryRecord",
|
|
48
|
+
"SearchResult",
|
|
49
|
+
"BranchInfo",
|
|
50
|
+
"SyncResult",
|
|
51
|
+
"ReflectJob",
|
|
52
|
+
"ClawDBError",
|
|
53
|
+
"ClawDBAuthError",
|
|
54
|
+
"ClawDBAccessDeniedError",
|
|
55
|
+
"ClawDBNotFoundError",
|
|
56
|
+
"ClawDBRateLimitError",
|
|
57
|
+
"ClawDBProvisionError",
|
|
58
|
+
"ClawDBUnavailableError",
|
|
59
|
+
"ClawDBTimeoutError",
|
|
60
|
+
"ClawDBValidationError",
|
|
61
|
+
"ClawDBInternalError",
|
|
62
|
+
]
|