Skip to main content

The memory layer for AI apps — persistent, synthesized context for any LLM application

Project description

anansi-memory

The memory layer for AI apps. Give any LLM application persistent, synthesized memory in two API calls.

pip install anansi-memory

Usage

from anansi_memory import AnansiMemory

memory = AnansiMemory(api_key="zzy_...")

# Store a conversation turn
memory.ingest(
    user_id="user_123",
    content="User is building a voice agent. Prefers TypeScript. Team of 4.",
    source_type="conversation",
)

# Before your next LLM call — inject synthesized context into system prompt
ctx = memory.context(user_id="user_123", q="what is the user building?")
system_prompt = f"You are a helpful assistant.\n\n{ctx.format_for_prompt()}"

API

AnansiMemory(api_key, base_url=None)

Param Type Description
api_key str Your API key (zzy_...)
base_url str Override API base URL (default: https://api.zazzy.app)

memory.ingest(user_id, content, source_type=None, source_id=None, metadata=None)

Store content in a user's memory. Returns IngestResult(id, queued=True).

Param Type Required Description
user_id str Your internal user ID
content str Text to remember, max 100 KB
source_type str "conversation", "document", "note", "meeting", "custom"
source_id str Idempotency key — re-ingesting the same ID is a no-op
metadata dict title, author, timestamp, any custom fields

memory.context(user_id, q=None)

Retrieve synthesized memory for a user. Returns ContextResult(static, dynamic, relevant).

Param Type Required Description
user_id str Your internal user ID
q str Optional query to retrieve relevant chunks

ctx.format_for_prompt()

Format a context result into a ready-to-inject system prompt block (string).

Error handling

from anansi_memory import AnansiMemory, AnansiError

try:
    memory.ingest(user_id=user_id, content=content)
except AnansiError as e:
    print(e.status_code, e.args[0])
    # 401 — invalid API key
    # 402 — monthly quota exceeded
    # 413 — content too large
    # 429 — rate limit (retry after 60s)

Requirements

Python 3.9+. No external dependencies — uses stdlib urllib only.

Links

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

anansi_memory-0.1.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

anansi_memory-0.1.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file anansi_memory-0.1.0.tar.gz.

File metadata

  • Download URL: anansi_memory-0.1.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for anansi_memory-0.1.0.tar.gz
Algorithm Hash digest
SHA256 403c82d9f9589f59ba7e650057e0e31207efdf2944b8c6a69f8cd536d58701d4
MD5 49c96ccefa510e26c27e996ac4535ef8
BLAKE2b-256 f29e5ddb8d7dd0ca32914696e9ac09dcc81ba97e5add5c1ba58d3132da70a0c9

See more details on using hashes here.

File details

Details for the file anansi_memory-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: anansi_memory-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for anansi_memory-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 07846d13b355952fe54f5111f2d30f5c082fc89bc404cb881f34061471dbd131
MD5 b4dd1375b6a01ce0d3379304fdf9f9e1
BLAKE2b-256 6995b6c0c1395b244fde2b82df6673bbddbfaac73a608ed9eac63f911665287b

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