Official Python SDK for AI Memory API
Project description
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
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
aimemoryapi-0.1.0.tar.gz
(6.4 kB
view details)
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 aimemoryapi-0.1.0.tar.gz.
File metadata
- Download URL: aimemoryapi-0.1.0.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce207d088895fbdd7671c82dca4b830e0f262e12bdac02e1426e7a18b659d0ac
|
|
| MD5 |
be741550c1ccbe8e849263f4505100dc
|
|
| BLAKE2b-256 |
6f438371dda10db54ef63de1a63216d79aa6e9317c3e0f925febba1c6edf7837
|
File details
Details for the file aimemoryapi-0.1.0-py3-none-any.whl.
File metadata
- Download URL: aimemoryapi-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd279caa292bacd064bbd965cbcccc93f5ad5992f94e2a801d796987ffe4178d
|
|
| MD5 |
fcee500127ff0865b27e7cd43d57cc9f
|
|
| BLAKE2b-256 |
6934e938148f8e59e9ddeaf6847d46486856c606169dd87bac473a48a2f873e1
|