LiticaLitica
Docs/Quickstart

Python SDK

Quickstart

From pip install to a searchable memory in four steps.

1

Install the package

Requires Python 3.10+. The only dependency is httpx.

pip install litica
2

Get an API key

Create a free account and mint a key from the playground. Keys look like lk_... — the same key works for the SDK, the REST API, and the MCP server.

Create an account

Export it so the client picks it up automatically:

export LITICA_API_KEY="lk_your-api-key"
3

Write a memory, then search it

Writes are queued: the server accepts them instantly (HTTP 202) but decomposes, embeds, and stores them in the background. So the one non-obvious part of a first script is the poll between write and search:

first_memory.py
import time
import litica

client = litica.Client()  # reads LITICA_API_KEY from the environment

client.add_memory("Sam owns the Atlas pricing page.")

# Poll until the write has landed (usually a few seconds).
for _ in range(20):
    hits = client.search_memories("who owns pricing?")
    if hits:
        break
    time.sleep(3)

for hit in hits:
    print(hit.id, hit.text)

Why the poll exists — and a reusable wait_for helper — is covered in Writing Memories.

4

Give your agent an identity

Every memory belongs to an agent. Set agent_id once on the client and every call uses it:

client = litica.Client(agent_id="support-bot")

client.add_memory("Ticket #1042 was a billing bug.")   # written as support-bot
client.search_memories("billing bugs")                  # searched as support-bot

That is the whole loop.

Your agent now writes memories that persist across sessions and retrieves them ranked by what fits the task. Everything else in the SDK — namespaces, tracing, the audit feed — builds on these two calls.

Next steps

  • Configuration — environment variables, scope defaults, timeouts, and client lifecycle.
  • Namespaces — let several agents read and write one shared memory.
  • API Reference — every method, parameter, and response type.