Official Python client for the LUKi AI agent & ReMeLife APIs
This project is licensed under the [Apache 2.0 License with ReMeLife custom clauses]
luki-sdk-python
gives you a typed, batteries‑included way to talk to:
- LUKi Core Agent API – chat, tool calls, recommendations
- Memory/ELR endpoints – ingest, search, update Electronic Life Records (ELR®)
- Reporting & Analytics services – pull wellbeing summaries, engagement metrics
- Token/Consent services – (optional) sign data-sharing intents, check CAP → REME status
It wraps our FastAPI gateway with clean Python classes, async support, and CLI helpers, so you can embed LUKi in backends, scripts, or notebooks fast. :contentReference[oaicite:0]{index=0}
- Sync & async clients (
requests
+httpx
) - Auto-retry / backoff & streaming responses (Server-Sent Events / WebSockets ready)
- Typed models (pydantic) for requests/responses
- RAG helpers to chunk & upload ELR text, then query via embeddings
- Convenience tools: activity recommendations, wellbeing reports, feedback submitters
- CLI for quick testing (
luki chat "Hello"
)
pip install luki-sdk
# or from source
pip install git+ssh://github.com/REMELife/luki-sdk-python.git
from luki_sdk import LukiClient
client = LukiClient(
base_url="https://api.luki.ai", # staging/prod URL
api_key="YOUR_LUKI_API_KEY" # or use env LUKI_API_KEY
)
# 1) Simple chat
resp = client.chat.send(message="I feel a bit low, any suggestions?")
print(resp.text)
# 2) Recommend activities (uses your stored ELR profile)
acts = client.activities.recommend(user_id="user_123", k=3)
for a in acts:
print(a.title, "-", a.description)
# 3) Upload ELR chunk
client.elr.upload_text(
user_id="user_123",
text="Alice loves gardening and jazz. Wedding in 1975 in Madrid.",
tags=["interests", "life_event"]
)
import asyncio
from luki_sdk.async_client import AsyncLukiClient
async def main():
async with AsyncLukiClient(api_key="...", base_url="...") as cli:
r = await cli.chat.send("Hello LUKi, what's a calming activity?")
print(r.text)
asyncio.run(main())
export LUKI_API_KEY=sk_live_xxx
OAuth/JWT flows are supported for enterprise—see /docs/auth.md
once enabled.
client.chat.send(
message: str,
user_id: str = None,
context: dict = None,
stream: bool = False
)
# context: extra metadata (mood tags, session id)
# stream=True: yields tokens progressively
client.elr.upload_text(user_id, text, tags=None, sensitivity="normal")
client.elr.upload_file(user_id, path)
client.elr.search(user_id, query, k=5, filters=None)
client.elr.delete(user_id, item_id)
client.activities.recommend(user_id, k=5, mood=None)
client.activities.feedback(activity_id, rating, comment=None)
client.reports.generate(user_id, window_days=7)
client.reports.get(report_id)
client.tokens.get_caps(user_id)
client.tokens.swap_caps_to_reme(user_id) # if permitted by backend
Endpoints are versioned (
/v1/chat
,/v1/elr
, …). The SDK tracks minor changes.
Env Var | Default | Purpose |
---|---|---|
LUKI_API_KEY |
None | Auth token |
LUKI_BASE_URL |
https://api.luki.ai | API root |
LUKI_TIMEOUT |
30 | Seconds |
LUKI_MAX_RETRIES |
3 | HTTP retries |
LUKI_LOG_LEVEL |
INFO | SDK logging |
(Or pass directly in LukiClient(...)
.)
for chunk in client.chat.stream("Tell me a story about my childhood photos"):
print(chunk.delta, end="")
Register token-level callbacks:
def on_token(tok): print(tok, end="")
client.chat.send("...", stream=True, on_token=on_token)
from luki_sdk.errors import LukiHTTPError
try:
client.elr.upload_text(...)
except LukiHTTPError as e:
print(e.status_code, e.body)
luki chat "Suggest a calming music activity"
luki elr upload --user user_123 --file story.txt
luki activities recommend --user user_123 -k 3
Install CLI extras:
pip install luki-sdk[cli]
git clone [email protected]:REMELife/luki-sdk-python.git
cd luki-sdk-python
pip install -e ".[dev]"
pytest
We use ruff + black + mypy:
ruff check .
black .
mypy luki_sdk
PRs welcome (SDK only). For core agent code, see internal repos.
Read CONTRIBUTING.md
& sign the CLA.
Semantic versioning (MAJOR.MINOR.PATCH).
Breaking API changes bump MAJOR; minor additions are non‑breaking.
Report vulnerabilities to [email protected].
Never include raw ELR text in issues—use synthetic examples.
Apache-2.0 © 2025 Singularities Ltd / ReMeLife.
- WebSocket streaming helper
- Retryable offline ingestion queue
- Pydantic v2 migration (if not already)
- Typed event hooks for tool results