Key-Value Memory
Four named scopes: runtime (default), session, shared and persistent. Values are converted to strings. Scope names do not imply automatic per-agent isolation, cleanup or persistence.
axon
| Call | Behavior |
|---|---|
store(key, value, scope="runtime", ttl=0) | Store a string representation; optional TTL in seconds. |
get(key, scope), has(key, scope) | Read a value or test presence. Missing keys and stored empty strings currently read as null; has distinguishes presence. |
remove(key, scope), clear(scope) | Delete a key or scope; clear also accepts all. |
keys(scope), size(scope) | Enumerate keys or count them. |
persist(path), load(path) | Explicit disk save/load; persistent scope alone does not write a file. |
Memory operations are synchronized across sibling interpreters. A compound read-modify-write sequence is not an atomic transaction. TTL/persistence and concurrent integration coverage continue on the quality track.
Semantic Memory: HNSW
A native HNSW L2 index uses vectors from the external Ollama embedding service. Install nomic-embed-text and start Ollama before running this complete example.
axon
| Call / field | Behavior |
|---|---|
embed(text) | Request an embedding. |
index(text, metadata) | Generate a vector and index text/metadata. |
search(query, top_k) | Approximate nearest-neighbor results containing text, metadata and score. |
score | Computed as 1/(1 + L2 distance), not cosine similarity or a model-confidence probability. |
sem_size(), sem_persist(path), sem_load(path) | Count entries and explicitly save/load the index. |
Reuse a compatible embedding model and dimension when loading an index. This is retrieval, not automatic training, RAG injection or conversational memory. Inspect retrieved content and failure behavior in your application.
Embedding Configuration
Declare the model, endpoint and vector dimension. The embedding service and weights are not bundled with Axon.
axon
bash