Python SDK
Litica Python SDK
The official Python client for the Litica API. Write memories, search them, share them between agents, and inspect why a result surfaced — from code instead of an MCP client.
pip install liticaThe package is litica on PyPI. It is a thin, synchronous client for the same hosted API that powers the MCP server — one method per API route, 22 routes in total. It requires Python 3.10 or newer and has a single dependency, httpx.
Two minutes to a working client
import litica
client = litica.Client(api_key="lk_...")
client.add_memory("Sam owns the Atlas pricing page.")
# Writes are queued — poll briefly before searching. See "Writing Memories".
for hit in client.search_memories("who owns pricing?"):
print(hit.id, hit.text)The conventional import shorthand is lit, which is why the class is Client rather than LiticaClient:
import litica as lit
client = lit.Client(api_key="lk_...")What the SDK covers
- Memories — add one, add a batch, upload a whole document, search, list, trace, delete. Writing Memories and Search & Retrieval.
- Namespaces — shared memory between agents, with per-agent read and write grants. Namespaces.
- Inspection — the memory graph, the write-side audit feed, queue depth, and search with the full score breakdown. Inspection.
Every method, parameter, and response type is documented in the API Reference.
Design principles
- One method per route. The client mirrors the API one-to-one. Nothing is invented on top, so what you learn from the REST reference transfers directly.
- Typed, tolerant responses. Responses are frozen dataclasses with the full untouched body on
.raw. A server that grows a new field never breaks an older SDK. - Honest errors. Everything raised inherits from
LiticaErrorand carries the status code and the server's message verbatim. Error Handling. - Fully typed. The package ships a
py.typedmarker (PEP 561), so mypy and pyright see every annotation.
Current limitations
v0.1.0 is deliberately small, and its gaps are documented rather than papered over:
- Writes are queued, not instant. The server accepts a write (HTTP 202) before it is searchable, and there is no built-in wait. You poll — the pattern is in Writing Memories.
- No async client and no automatic retries — out of scope for this release.
- No provenance on writes. The MCP tools can record where a fact came from; the HTTP route the SDK wraps does not accept that yet.
- No tenant provisioning. That route uses a separate admin credential and is intentionally absent.
While the version is 0.x the surface may still change between minor versions; breaking changes are called out explicitly in the changelog.
License and source
The SDK is open source under Apache-2.0 at Litica-AI/litica-sdk. The license covers the client library only — the Litica service is separate, and an API key is issued separately.
Next steps
- Quickstart — install, get a key, write and search your first memory.
- Configuration — API keys, environment variables, and how agent and namespace scope works.