Python SDK for the Kova Mind memory API
Project description
kovamind
Python SDK for the Kova Mind memory API — give your AI agents persistent, learning memory.
pip install kovamind
Quickstart
from kovamind import KovaMind
kova = KovaMind(api_key="km_live_xxx")
# Extract memories from a conversation
result = kova.extract(
conversation=[
{"role": "user", "content": "I love dark mode and hate Comic Sans."},
{"role": "assistant", "content": "Noted! I'll keep that in mind."},
],
user_id="alex",
)
print(f"Extracted {len(result.patterns)} patterns")
for p in result.patterns:
print(f" [{p.category}] {p.pattern} (confidence: {p.confidence:.0%})")
# Recall memories
recall = kova.recall(
context="The user is asking about text editor settings.",
user_id="alex",
max_patterns=5,
)
for p in recall.patterns:
print(p.pattern)
# Score surprise
surprise = kova.surprise(
content="Alex now prefers light mode",
user_id="alex",
)
print(f"Score: {surprise.score:.2f}, Route: {surprise.route}")
API reference
KovaMind(api_key, base_url, timeout, session)
| Parameter | Default | Description |
|---|---|---|
api_key |
required | Your km_live_... or km_test_... key |
base_url |
https://api.kovamind.ai |
API base URL |
timeout |
30 |
Request timeout in seconds |
session |
None |
Optional custom requests.Session |
extract(conversation, user_id, *, session_id=None)
Extract memory patterns from a conversation.
recall(context, user_id, *, max_patterns=10, min_confidence=0.3)
Retrieve relevant memory patterns.
surprise(content, user_id)
Score how surprising new content is (0.0 = familiar, 1.0 = contradicts memory).
| Score | Route | Meaning |
|---|---|---|
| < 0.3 | reinforce |
Already known |
| 0.3-0.7 | update |
New information |
| > 0.7 | contradict |
Conflicts with memory |
reinforce(pattern_id, reinforcement_type, *, context=None)
Confirm, deny, strengthen, or weaken a stored pattern.
health()
Check API health (no auth required).
Error handling
from kovamind import KovaMind, AuthError, RateLimitError, NotFoundError, KovaMindError
try:
result = kova.recall(context="editor preferences", user_id="alex")
except AuthError:
print("Check your API key")
except RateLimitError as e:
print(f"Rate limited. Retry after {e.retry_after}s")
except NotFoundError:
print("Resource not found")
except KovaMindError as e:
print(f"API error {e.status_code}: {e}")
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kovamind-0.4.0.tar.gz.
File metadata
- Download URL: kovamind-0.4.0.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6780f7e8e10a81cf281234679e7b2ff9ad25e97c2716af2456e6119445af862d
|
|
| MD5 |
a9e32b06623ef852ebf34aa475a52ad3
|
|
| BLAKE2b-256 |
634e516aae69f39e6321104d37395fcfaa4f0c5c9673f95b37bda76153bc3c7b
|
File details
Details for the file kovamind-0.4.0-py3-none-any.whl.
File metadata
- Download URL: kovamind-0.4.0-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fbf4d9b22e8ee6be0b6eb54c90d3604abb489e9209610c94bb9e25700135dd6
|
|
| MD5 |
4afa42014ac81ada2a8807d085d8f803
|
|
| BLAKE2b-256 |
ab84a9f89b421d8858ba3e0d1d97d8fbeb71dd14f77a083ed0e9a8e179b4d4cf
|