Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

nenavi

The Python client for Nenavi Cloud, the hosted memory service for AI agents. It has sync and async clients, typed models, typed errors, and retries only where a retry is safe. Python 3.11 or later; the only runtime dependencies are httpx and pydantic (v2).

Early access. Nenavi Cloud is an alpha for invited users (join the waitlist), and this package is an alpha prerelease. Until version 1.0, a release that renames or removes a method or an option raises the minor version.

pip install --pre nenavi

Create a project and an API key in the console, put the key in NENAVI_API_KEY, and then:

import nenavi

client = nenavi.Nenavi()  # reads NENAVI_API_KEY
client.store(content="Jo moved to Lisbon in March.", user_id="user-1")
found = client.retrieve(query="Where does Jo live?", user_id="user-1")

Retrieved memory is untrusted input: stored text can carry instructions meant for the model that later reads it. Treat retrieved text as data, not instructions.

The Python SDK docs cover configuration, the async client, safe batch imports, waiting for extraction, re-ingest, errors, retries, request ids, and timeouts.

nenavi.AsyncNenavi has the same methods as coroutines. Use the SDK from server-side code only: the key must not ship to a browser.

One AsyncNenavi can serve several event loops in turn, so you can build it once at module scope and call it through asyncio.run() in each AWS Lambda invocation or Celery task. On a new loop it opens new connections; the ones left on the closed loop are released when they are garbage-collected, with a ResourceWarning. In tests that treat warnings as errors, build the client in a fixture on the test's loop and close it there. An httpx.AsyncClient that you pass as http_client cannot move between loops: build it inside the loop that uses it, or a call from another loop raises nenavi.ConfigurationError, which can follow a request that reached the service.

Every supported operation of the hosted API has a method. Four helpers cover the long-running work:

answer = client.ingest(content="Jo is learning Portuguese.", user_id="user-1")
status = client.events.wait_for_extraction(answer.event_id, timeout=300)  # complete or failed
run = client.reingest.run(user_id="user-1")  # starts a run and polls it every 5 seconds
started = client.reingest.start(user_id="user-2")  # starts a run and returns at once
if started.run_id is not None:
    finished = client.reingest.wait(started.run_id)  # polls a run you have, starts nothing
for node in client.nodes.scan_all(user_id="user-1", limit=1000):  # every page, 1,000 nodes each
    print(node.id)

reingest.preview() estimates a re-ingest without starting one; only reingest.start() and reingest.run() start a real run. A helper that runs out of time raises nenavi.WaitTimeoutError with the last status as last_status, and a poll that fails inside reingest.run() raises its own error with last_status set the same way, so the run's run_id is not lost: pass it to reingest.wait(), which polls that run with the same rules and starts nothing. A 409 reingest_running raises nenavi.ConflictError with the working run's id as run_id, so after a lost answer to the start, a cancelled task or an outside timeout, calling reingest.run() again while that run is working tells you which run to go on with in reingest.wait(); if it has ended, the call starts the next run instead, or returns when nothing is left to re-derive. To find a run whose id you lost, whether or not it has ended, call reingest.latest(user_id=...), which starts nothing and returns the user's newest run; check its started_at and scope, since another caller may have started a newer one. Every scan page counts against the key's request rate limit (60 a minute by default) like any other call, and store(), ingest() and retrieve() are never retried on a 429, so for a large scan pass a larger limit (up to 1,000 nodes a page), and run background jobs with their own key. The polls of the waiting helpers count against a separate limit of the same size for the two status reads, so they never use up the requests your writes need; to wait on many events at once, use a longer interval.

Only GET methods and ingest_fast() retry by themselves, on a 429 rate_limited (after Retry-After), a 503 database_unavailable or lease_unavailable, a 503 with no reason code (from the load balancer in front of the service), or a connection error. store(), ingest() and retrieve() never retry: a retried store stores the text again and counts twice against the monthly limits. ingest_fast() sends one Idempotency-Key on every retry of a call. A timeout is never retried, so to retry it by hand, pass the error's idempotency_key. If you wrap ingest_fast() in your own retry, such as a tenacity decorator or a backoff loop, make one key before the first attempt and pass it on every attempt: a call without a key gets a new one, and the service stores and meters the batch again.

A 2xx answer whose body does not match the operation's model raises nenavi.ResponseValidationError, with status, request_id, headers and the parsed body. The call may have taken effect, so read body (for example the event_id of a store()) before calling again: a second store() stores the text again and counts twice against the monthly limits. body can hold stored memory text: log the error's message and request_id, not the whole error object.

Development

uv sync
uv run pytest
uv run ruff check .
uv run ruff format --check .
uv run pyright
uv build
  • src/nenavi/_generated/ holds the Pydantic models generated from sdks/openapi.json. After the snapshot changes, run uv run python scripts/generate.py; tests/test_generated.py fails until you do.
  • src/nenavi/_client.py (the sync client) is written from src/nenavi/_async_client.py by uv run python scripts/unasync.py. Edit the async file, then run the script; the same test fails when they differ.
  • tests/test_conformance.py runs every scenario in sdks/conformance/ on both clients.
  • examples/quickstart.py stores and retrieves one memory with the key from NENAVI_API_KEY (and NENAVI_BASE_URL for a local service): uv run python examples/quickstart.py.

Metadata

Release files for nenavi 0.1.0a3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nenavi 0.1.0a3
File Size Uploaded Provenance Actions
nenavi-0.1.0a3.tar.gz 81.6 kB Without provenance Details for nenavi-0.1.0a3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nenavi 0.1.0a3
File Interpreter ABI Platform Actions
nenavi-0.1.0a3-py3-none-any.whl Python 3 none any Details for nenavi-0.1.0a3-py3-none-any.whl

Total release size: 167.7 kB

Release files / nenavi-0.1.0a3.tar.gz

Download URL nenavi-0.1.0a3.tar.gz
Size 81.6 kB
Tags Source
SHA-256 checksum
How to use checksums
806b9133a4ce3900eb74ce3f496b15d3073db403b731ad888ddbf508f423cd3f
BLAKE2b-256 checksum
How to use checksums
e79e3adbdb5fed72e4e7882b23d4871a16cb3597e54082b91d5598548fcc4680
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / nenavi-0.1.0a3-py3-none-any.whl

Download URL nenavi-0.1.0a3-py3-none-any.whl
Size 86.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
78f55fcca878c1a064d85fd28543e28fdf5f4ef7cc19bde1029460881dd30008
BLAKE2b-256 checksum
How to use checksums
05a8a3220ff3311d0fafdd613ea52c0f9e8f042d438d6b93942e3d5cc2180f66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for nenavi 0.1.0a3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page