Skip to main content

Python SDK for the LIAM Memory Management API

Project description

LIAM Python SDK

Official Python SDK for the LIAM Memory Management API.

Python 3.8+ License: MIT

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

  1. Log in and navigate to Workspaces in the left sidebar
  2. You'll see your workspace listed with a masked API Key (e.g., M7a*****QI2Q)
  3. 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.

  1. Click on your workspace name to open the workspace detail page
  2. Scroll down to the Key Pair(s) section
  3. Click "Generate New Key"
  4. 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.

  1. On the workspace detail page, scroll down to the LLM Keys section
  2. Click "Add New Key" (top right of the section)
  3. Enter your LLM provider API key (e.g., OpenAI) along with the Identifier and Model Name
  4. 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:


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


License

MIT License - see LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

liam_client-1.0.0.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

liam_client-1.0.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

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

Hashes for liam_client-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8b5cff2c73b25ad9ca696076f67a0d6036284ce0bc6c7dcc0c9ad3051ee47104
MD5 c0ef486770f6e513ddf3986e8d455ccc
BLAKE2b-256 9169b92271510709eab78c88f86dc1256e43a5d81dec3a868dcec462f86f9f82

See more details on using hashes here.

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

Hashes for liam_client-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b962a7bbfd0d5c1dc91b045607893492a79ce3e22308ccd9ade031c8337ba6a6
MD5 a08657a9c9c9e27ab7627cbc7f14372a
BLAKE2b-256 a17959dff951a53631ba460ba06ba8ed4dbb9d51e7c827b094adb851dc2b8e04

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page