AI Memory Python SDK
Official Python SDK for AI Memory API — persistent memory for AI agents.
Installation
pip install aimemoryapi
Quick Start
from aimemoryapi import AiMemory
client = AiMemory()
# Register a user (starts 7-day free trial)
user = client.users.register(
user_id="my_user_001",
email="user@example.com",
)
# Create a project
project = client.projects.create(
user_id="my_user_001",
name="My AI Project",
)
# Start a session
session = client.sessions.start(
user_id="my_user_001",
project_id=project["id"],
)
# Add messages
client.messages.add(
session_id=session["id"],
role="user",
content="Hello, AI!",
)
# Retrieve session context
full_session = client.sessions.get(session["id"])
print(f"Messages: {full_session['messageCount']}")
Resources
| Resource | Method | API Endpoint |
|---|---|---|
health |
check() |
GET /health |
metrics |
get() |
GET /metrics |
tiers |
list() |
GET /api/tiers |
users |
register() |
POST /api/register |
trial |
status() |
GET /api/trial/status/:id |
trial |
checkout() |
POST /api/trial/checkout |
projects |
create() |
POST /api/project |
sessions |
start() |
POST /api/session |
sessions |
get() |
GET /api/session/:id |
messages |
add() |
POST /api/message |
Error Handling
from aimemoryapi.errors import (
AuthenticationError,
InvalidRequestError,
APIError,
)
try:
client.users.register(user_id="user_1")
except AuthenticationError as e:
print(f"Auth error: {e}")
except InvalidRequestError as e:
print(f"Invalid request: {e}")
except APIError as e:
print(f"Server error: {e}")
Requirements
- Python 3.8+
requests>= 2.31.0pydantic>= 2.0.0
Links
Metadata
Release files for aimemoryapi 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| aimemoryapi-0.1.0.tar.gz | 6.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aimemoryapi-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.3 kB
Release files / aimemoryapi-0.1.0.tar.gz
| Download URL | aimemoryapi-0.1.0.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ce207d088895fbdd7671c82dca4b830e0f262e12bdac02e1426e7a18b659d0ac
|
|
BLAKE2b-256 checksum How to use checksums |
6f438371dda10db54ef63de1a63216d79aa6e9317c3e0f925febba1c6edf7837
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / aimemoryapi-0.1.0-py3-none-any.whl
| Download URL | aimemoryapi-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dd279caa292bacd064bbd965cbcccc93f5ad5992f94e2a801d796987ffe4178d
|
|
BLAKE2b-256 checksum How to use checksums |
6934e938148f8e59e9ddeaf6847d46486856c606169dd87bac473a48a2f873e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Security for aimemoryapi 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.