Reasoning memory layer for AI agents — Python SDK
Project description
remem Python SDK
The official Python SDK for remem — the reasoning memory layer for AI agents.
Remem provides a persistent, queryable memory system that uses LLM-powered reasoning for importance scoring, contradiction detection, knowledge graph construction, and session consolidation. This SDK offers a strongly-typed, fully asynchronous interface over the remem REST API using httpx and pydantic.
Key Features
- Fully Asynchronous: Built natively on
asyncioandhttpx. - Type-Safe Models: Robust validation and autocompletion powered by Pydantic.
- LLM-Powered Reasoning: Effortlessly invoke semantic recall, importance scoring, and consolidation.
- Knowledge Graph: Native support for storing and querying relationship triples.
Installation
Install the package via pip or your preferred package manager (e.g., uv, poetry):
pip install rememhq
Quick Start
1. Start the remem API Server
Before using the SDK, start the rememhq-api server from the remem repository root:
cargo run -p rememhq-api -- --project default
By default, the server listens on http://localhost:7474.
2. Initialize the Client
import asyncio
from rememhq import Memory
async def main():
# Initialize the memory client
memory = Memory(
base_url="http://localhost:7474",
project="my-agent",
reasoning_model="claude-sonnet-4-6" # Configure the underlying reasoning engine
)
# Store a memory
store_resp = await memory.store(
content="The user prefers Python for ML tasks.",
tags=["preferences", "ml"]
)
print(f"Stored memory ID: {store_resp.id}")
# Recall memories using semantic reasoning
results = await memory.recall(query="What language does the user prefer for machine learning?", limit=5)
for result in results:
print(f"Content: {result.content}")
print(f"Reasoning trace: {result.reasoning}")
if __name__ == "__main__":
asyncio.run(main())
Configuration Options
You can configure the SDK using constructor parameters or environment variables:
memory = Memory(
base_url="http://localhost:7474",
project="my-agent",
reasoning_model="gpt-4o",
timeout=30.0
)
Environment Variables:
REMEM_API_URL— API server URL (default:http://localhost:7474)REMEM_PROJECT— Target project namespace (default:default)REMEM_REASONING_MODEL— Reasoning model (default:claude-sonnet-4-6)REMEM_TIMEOUT— Request timeout in seconds (default:30)
API Reference
Memory Methods
store(content: str, tags: list[str] = None, importance: float = None) -> StoreResponse: Store a new memory.recall(query: str, limit: int = 8) -> list[RecallResult]: Retrieve contextually relevant memories utilizing LLM evaluation.search(query: str, limit: int = 10) -> list[SearchResult]: Execute rapid full-text/vector search.update(memory_id: str, content: str) -> UpdateResponse: Modify existing memory content.forget(memory_id: str) -> ForgetResponse: Delete a specific memory item.consolidate(session_id: str) -> ConsolidateResponse: Transform short-term session logs into long-term durable facts.
Development
To develop the SDK locally:
cd sdk/python
# Install dependencies (requires Python 3.11+)
pip install -e ".[dev]"
# Run tests
pytest tests/ -v
# Format and Lint
black rememhq/ tests/
ruff check rememhq/ tests/
Contributing
We welcome contributions! Please review our Contributing Guide for details on submitting pull requests, reporting issues, and suggesting enhancements.
License
This project is licensed under the Apache License 2.0. See the LICENSE file for more details.
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 rememhq-0.1.13.tar.gz.
File metadata
- Download URL: rememhq-0.1.13.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5b1626a3b9d97057a3f05b7cae565b9b74a5241909468747cf83497c7f208cb
|
|
| MD5 |
368fae9c3a06c59278179cd8aa8395fb
|
|
| BLAKE2b-256 |
6d884fe687c3941a3bbcbd59b1b2e42cbe1c082541289457410d67106a59cb28
|
Provenance
The following attestation bundles were made for rememhq-0.1.13.tar.gz:
Publisher:
publish.yml on remem-io/remem
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rememhq-0.1.13.tar.gz -
Subject digest:
c5b1626a3b9d97057a3f05b7cae565b9b74a5241909468747cf83497c7f208cb - Sigstore transparency entry: 2226544687
- Sigstore integration time:
-
Permalink:
remem-io/remem@28fd888260898e412bf0c23e0b1b8a6427af4b14 -
Branch / Tag:
refs/tags/v0.1.13 - Owner: https://github.com/remem-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@28fd888260898e412bf0c23e0b1b8a6427af4b14 -
Trigger Event:
release
-
Statement type:
File details
Details for the file rememhq-0.1.13-py3-none-any.whl.
File metadata
- Download URL: rememhq-0.1.13-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fce9993c58b065562a0491d4ca2df30a7e1e984d8cbe8f59c16795e14085cbf
|
|
| MD5 |
7b486e9801582a90d1deb6cf23c2d72a
|
|
| BLAKE2b-256 |
18f7fad6d87b28922e37ffa370e705bbdd96cc45e65f539f2d1af11801917452
|
Provenance
The following attestation bundles were made for rememhq-0.1.13-py3-none-any.whl:
Publisher:
publish.yml on remem-io/remem
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rememhq-0.1.13-py3-none-any.whl -
Subject digest:
1fce9993c58b065562a0491d4ca2df30a7e1e984d8cbe8f59c16795e14085cbf - Sigstore transparency entry: 2226544924
- Sigstore integration time:
-
Permalink:
remem-io/remem@28fd888260898e412bf0c23e0b1b8a6427af4b14 -
Branch / Tag:
refs/tags/v0.1.13 - Owner: https://github.com/remem-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@28fd888260898e412bf0c23e0b1b8a6427af4b14 -
Trigger Event:
release
-
Statement type: