Skip to main content

Async Python client for the MyPalace memory service

Project description

mypalace-client

Async Python client for the MyPalace Memory Service.

Install

pip install mypalace-client
# Optional gRPC transport:
pip install "mypalace-client[grpc]"
# Operator CLI (`mypalace-admin`):
pip install "mypalace-client[cli]"

The mypalace-admin CLI is bundled with this package as of v0.10.x. If you previously got it via the server-side mypalace package, that entry point still works as a deprecation shim and will be removed in v0.12.0 — switch to pip install 'mypalace-client[cli]'.

Quick start

import asyncio
from palace_client import PalaceClient

async def main():
    async with PalaceClient(
        base_url="http://localhost:8000",
        api_key="pk_live_...",
    ) as client:
        # Add a memory
        mem = await client.create(
            user_id="u1",
            content="Joshua likes oat milk",
            memory_type="preference",
        )
        # Search
        results = await client.search(query="milk", user_id="u1", limit=5)
        for r in results:
            print(r.score, r.content)

asyncio.run(main())

Features

Mirrors the full Palace HTTP API:

  • Memory CRUD + semantic search + smart-ingestion (infer=True)
  • Sessions + messages
  • Episode reflection + narrative arc synthesis
  • FSRS dynamics (promote/demote/score)
  • Intentions (set/check/format)
  • Layered context assembly
  • Manual supersede + supersession history

Auth

Pass api_key to the constructor; the client sends it as X-Palace-Key on every request. Without an API key, the client works against a server with PALACE_AUTH_DISABLED=true.

gRPC (optional)

Phase 3 ships a focused gRPC mirror covering MemoryService (Create/Get/Delete/Search/List). Use PalaceGrpcClient when you want lower-overhead binary transport for memory ops:

from palace_client.grpc import PalaceGrpcClient

async with PalaceGrpcClient("localhost:50051", api_key="pk_live_...") as c:
    mem = await c.create(user_id="u1", content="hello via gRPC")

Other surfaces (sessions, episodes, etc.) ride HTTP via PalaceClient.

CLI: mypalace-admin

Operator wrapper around the HTTP admin surface. Subcommands cover the day-to-day surface — health, version, keys {list|mint|revoke}, tenants {list|create}, stats, audit, reembed, job, export.

export MYPALACE_URL=http://your-palace:8000
export MYPALACE_ADMIN_KEY=pk_live_...

mypalace-admin health
mypalace-admin tenants list
mypalace-admin keys mint --label acme-prod --scopes read,write --tenant-id acme
mypalace-admin stats acme
mypalace-admin export acme -o acme.ndjson

--json emits raw JSON (good for jq pipelines).

License

PolyForm Noncommercial 1.0.0 — see LICENSE.md.

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

mypalace_client-0.11.0.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

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

mypalace_client-0.11.0-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

Details for the file mypalace_client-0.11.0.tar.gz.

File metadata

  • Download URL: mypalace_client-0.11.0.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mypalace_client-0.11.0.tar.gz
Algorithm Hash digest
SHA256 bf58260d29731e0cd8bb5bfbfc43572c15cb81ae8e8e7b3fe8fb5d23eae8a43b
MD5 dc1e37592a75b97f059d40d81ed91bd4
BLAKE2b-256 07af60eb93b6a33c25cbb3edda202b4c2d24ac2df807f49f8e994f0cea580ae1

See more details on using hashes here.

Provenance

The following attestation bundles were made for mypalace_client-0.11.0.tar.gz:

Publisher: release.yml on BangRocket/MyPalace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mypalace_client-0.11.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mypalace_client-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 06e78ce03ec57b6c16166fba3bcaab8df7db619b92d54deba64b36ebf5437e6c
MD5 15840859b2be5253aaa4548f721cb954
BLAKE2b-256 694f09611b1271ff87a246a9a6a93d98763f3599160969abfb85d7a29f0841f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for mypalace_client-0.11.0-py3-none-any.whl:

Publisher: release.yml on BangRocket/MyPalace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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