Python SDK for the LIAM Memory Management API
Project description
LIAM Python SDK
Official Python SDK for the LIAM Memory Management API.
Features
- 🔐 Secure Authentication - ECDSA signature-based API authentication
- ⚡ Async Support - High-performance async client with aiohttp
- 📦 Batch Operations - Create multiple memories concurrently
- 🏷️ Tag Management - Organize memories with tags
- 💬 Chat Integration - Query memories with natural language
Installation
From Source (Latest / Development)
git clone https://github.com/netsys-usa/liam-agent.git
cd liam-agent/liam-python-sdk
pip install -e .
Getting Started
Step 1 — Create Your Account
Sign up at https://web.askbuddy.ai/brain/#/login
After registration, a default workspace will be created automatically for you.
Step 2 — Get Your API Key
- Log in and navigate to Workspaces in the left sidebar
- You'll see your workspace listed with a masked API Key (e.g.,
M7a*****QI2Q) - Click the Copy icon next to your API Key to copy it
Your workspace also shows its Status (must be
ACTIVATED) and the Institution Id assigned to it.
Step 3 — Generate Your Private Key
The LIAM API uses ECDSA key-pair authentication. You need to generate a key pair and register the public key.
- Click on your workspace name to open the workspace detail page
- Scroll down to the Key Pair(s) section
- Click "Generate New Key"
- Copy and securely store the Private Key that is returned — it will only be shown once
⚠️ Keep your private key secret. Never commit it to version control or share it publicly.
Step 4 — Add an LLM Key
LIAM uses an LLM to power memory chat and summarization. You must connect at least one LLM key.
- On the workspace detail page, scroll down to the LLM Keys section
- Click "Add New Key" (top right of the section)
- Enter your LLM provider API key (e.g., OpenAI) along with the Identifier and Model Name
- Save — the key status will update to Active
Step 5 — Initialize the Client
from liam_client import LIAMClient
client = LIAMClient(
api_key="your-api-key", # Copied from Workspaces page
private_key="your-base64-encoded-private-key" # Generated in Step 3
)
# Verify connection
health = client.health_check()
print(f"API Status: {health['status']}")
Quick Examples
Create & Query Memories
# Create a memory
client.create_memory(
user_key="user_abc123",
content="I prefer morning meetings before 10am",
tag="preferences"
)
# Chat with memory context
response = client.chat(
user_key="user_abc123",
query="What time do I prefer for meetings?"
)
print(response['data'])
# List all memories
memories = client.list_memories(user_key="user_abc123")
Async Client
For high-performance applications:
import asyncio
from liam_client import LIAMClientAsync
async def main():
async with LIAMClientAsync(
api_key="your-api-key",
private_key="your-base64-encoded-private-key"
) as client:
memories = [
{"content": "Meeting at 3pm", "tag": "calendar"},
{"content": "Call dentist", "tag": "health"},
{"content": "Buy groceries", "tag": "shopping"},
]
results = await client.create_memories_batch("user_abc123", memories)
print(f"Created {len(results)} memories")
asyncio.run(main())
Configuration
Environment Variables
export LIAM_API_KEY="your-api-key"
export LIAM_PRIVATE_KEY_PATH="/path/to/private_key.pem"
# Or use LIAM_PRIVATE_KEY for the key content directly
from liam_client import LIAMClient
client = LIAMClient.from_env() # Reads from environment variables
Custom Base URL
client = LIAMClient(
api_key="your-api-key",
private_key_pem=private_key,
base_url="https://custom-api.example.com/api"
)
API Reference
Memory Operations
| Method | Description |
|---|---|
create_memory(user_key, content, tag?, session_id?) |
Create a new memory |
create_memory_with_image(user_key, content, image_base64, tag?) |
Create memory with image |
list_memories(user_key, query?, limit?) |
List or search memories |
chat(user_key, query, session_id?) |
Chat with memory context |
summarize_memory(user_key, memory_id?) |
Get memory summary |
forget_memory(user_key, memory_id, permanent?) |
Delete a memory |
memory_status(user_key, process_id?) |
Check processing status |
Tag Operations
| Method | Description |
|---|---|
list_tags(user_key) |
List all user tags |
add_tag(user_key, memory_id, tag) |
Add tag to memory |
get_by_tag(user_key, tag, limit?, offset?) |
Get memories by tag |
change_tag(user_key, old_tag, new_tag) |
Rename a tag |
Utility
| Method | Description |
|---|---|
health_check() |
Check API health |
Examples
See the examples directory for more detailed usage:
- basic_usage.py - Getting started
- async_example.py - Async operations
Requirements
- Python 3.8+
- requests >= 2.28.0
- cryptography >= 41.0.0
- aiohttp >= 3.8.0 (for async client)
Documentation
Full API documentation: https://web.askbuddy.ai/brain/#/developers
Support
- 📧 Email: support@netxd.com
- 📖 Docs: API Documentation
- 🐛 Issues: GitHub Issues
License
MIT License - see LICENSE file for 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 liam_client-1.0.0.tar.gz.
File metadata
- Download URL: liam_client-1.0.0.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b5cff2c73b25ad9ca696076f67a0d6036284ce0bc6c7dcc0c9ad3051ee47104
|
|
| MD5 |
c0ef486770f6e513ddf3986e8d455ccc
|
|
| BLAKE2b-256 |
9169b92271510709eab78c88f86dc1256e43a5d81dec3a868dcec462f86f9f82
|
File details
Details for the file liam_client-1.0.0-py3-none-any.whl.
File metadata
- Download URL: liam_client-1.0.0-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b962a7bbfd0d5c1dc91b045607893492a79ce3e22308ccd9ade031c8337ba6a6
|
|
| MD5 |
a08657a9c9c9e27ab7627cbc7f14372a
|
|
| BLAKE2b-256 |
a17959dff951a53631ba460ba06ba8ed4dbb9d51e7c827b094adb851dc2b8e04
|