Metadata-Version: 2.4
Name: kognite
Version: 0.1.0
Summary: Python SDK for Kognite — long-term memory for AI agents (hybrid semantic search, memory formation, knowledge graph)
Author-email: Kognite <hello@kognite.dev>
License: MIT
Project-URL: Homepage, https://kognite.dev
Project-URL: Repository, https://github.com/global-software-development-eu/memcore-portable-agent-memory-saas
Keywords: kognite,agent-memory,memory,llm,rag,sdk,ai
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# kognite

Python SDK for [Kognite](https://kognite.dev) — long-term memory for AI agents.
Hybrid semantic + full-text search, LLM memory formation, and a knowledge graph,
behind one API key. **Zero dependencies** (stdlib only), Python 3.9+.

```bash
pip install kognite
```

## Quickstart

```python
from kognite import Kognite

k = Kognite(api_key="kgn_...")

# Store a memory
k.memories.add("User prefers dark mode", kind="preference")

# Hybrid search (semantic + full-text, RRF-fused)
hits = k.memories.search("ui preferences", limit=5)["results"]

# Highest precision (cross-encoder rerank — slower):
k.memories.search("ui preferences", rerank=True)
```

## Memory formation (the good stuff)

`ingest` runs the pipeline behind Kognite's published LoCoMo results: it stores
raw messages as episodes **and** extracts atomic facts — pronouns resolved to
names, relative dates converted to absolute ones. Prefer it over `add` for any
multi-message context:

```python
k.memories.ingest([
    {"speaker": "user", "timestamp": "2026-07-15", "content": "I moved to Berlin last month."},
    {"speaker": "assistant", "content": "Noted — how are you finding it?"},
])
# → {"raw": 2, "extracted": 1, "stored": 3}
```

## Context assembly

A token-budgeted bundle of relevant memories, ready to drop into a prompt:

```python
ctx = k.context.assemble("user's living situation", token_budget=2000)
```

## Everything else

```python
k.memories.get(memory_id)
k.memories.forget(memory_id)      # soft-delete (+ graph cascade)
k.memories.list(limit=50)         # newest-first paging
k.graph.query("Berlin")           # knowledge-graph search
k.health()
```

Errors raise `KogniteError` with `.status` (HTTP) and `.code`
(`validation_failed`, `quota_exceeded`, `not_found`, …). Retries with
exponential backoff on 429/5xx/network errors are built in.

The tenant scope is derived server-side from your API key — the SDK has no
scope parameter and cannot reach another tenant. Get a key in the
[dashboard](https://app.kognite.dev), and see the live, judge-audited
[benchmarks](https://kognite.dev/benchmarks).

Self-hosted? Pass `base_url=` to the constructor.

## Development

`smoke_live.py` is a full live-API exercise of every method (safe: runs in the
key's own scope and forgets everything it creates):

```bash
KOGNITE_API_KEY=kgn_... python smoke_live.py
```
