Skip to main content

Pensyve Python SDK

Pensyve stores and retrieves persistent memory for AI agents. The Python SDK runs the Rust engine in your Python process, with SQLite storage and local ONNX embedding models.

Pensyve Cloud closed on October 1, 2026. Pensyve continues as an Apache 2.0 project that you run yourself. It is in maintenance mode, with security fixes and dependency updates but no new features. See the maintenance policy.

Install

Python 3.10 or later is required.

pip install pensyve

Local use needs no Pensyve account or API key. The first Pensyve() call may download embedding models from Hugging Face, so prepare the model cache before running without internet access. The SDK prefers Alibaba-NLP/gte-base-en-v1.5 and falls back to all-MiniLM-L6-v2 if the preferred model cannot load. Cross-encoder reranking is disabled by default.

Store and recall facts

Pass a storage directory and namespace explicitly when you want to control where memories are stored. Reopen the same directory and namespace to use those memories in another session.

import pensyve

p = pensyve.Pensyve(path="./pensyve-data", namespace="my-agent")
user = p.entity("user", kind="user")

p.remember(entity=user, fact="Prefers Python", confidence=0.95)

for memory in p.recall("programming language", entity=user):
    print(f"[{memory.score:.2f}] {memory.content}")

Record a conversation

An episode records messages when its context manager exits. Set the outcome inside the context manager, before the episode closes.

with p.episode(user) as episode:
    episode.message("user", "I prefer dark mode and vim keybindings")
    episode.message("agent", "I will use those editor settings")
    episode.outcome("success")

for memory in p.recall("editor preferences", entity=user):
    print(memory.content)

Use recall_grouped() to retrieve memories grouped by source session. Groups are ordered chronologically by default. Memories without a source episode appear in separate groups.

for group in p.recall_grouped("editor preferences", limit=50):
    print(f"Session {group.session_id} ({group.session_time})")
    for memory in group.memories:
        print(memory.content)

Consolidate memories

Call consolidate() to promote repeated episodic facts and apply memory decay. The result reports counts and whether the operation completed within its limits.

result = p.consolidate()
print(result["status"], result["promoted"], result["decayed"])

Delete an entity's memories

p.forget(user) deletes memories about the entity after writing a snapshot. The snapshot contains the deleted content, so retain or remove it according to your data retention needs.

result = p.forget(user)
print(result["forgotten_count"], result.get("snapshot_path"))
  • Snapshots are stored in <path>/snapshots/<namespace id>/. Set PENSYVE_SNAPSHOT_DIR before constructing Pensyve to use another directory.
  • If no memories are deleted, the result has no snapshot_path. If the snapshot cannot be written, forget() raises RuntimeError and deletes nothing.
  • Retention defaults to 30 days and 50 snapshots per namespace. Configure PENSYVE_SNAPSHOT_RETENTION_DAYS and PENSYVE_SNAPSHOT_MAX_PER_NAMESPACE to change the limits. Set a limit to 0 to disable it. Values above 36500 days or 1000000 snapshots, and values that are not whole numbers, use the default with a warning.

Build from source

Building the native Python module requires Rust 1.94 or later, Python 3.10 or later, and uv. Run the commands from the repository root.

git clone https://github.com/major7apps/pensyve.git
cd pensyve
uv sync --extra dev
uv run maturin develop --release -m pensyve-python/Cargo.toml
uv run python -c "import pensyve; print(pensyve.__version__)"

Documentation

License

Apache 2.0.

Metadata

Release files for pensyve 6.0.0

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

Source distribution (sdist)

Source distribution for pensyve 6.0.0
File Size Uploaded Provenance Actions
pensyve-6.0.0.tar.gz 822.9 kB Without provenance Details for pensyve-6.0.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pensyve 6.0.0
File Actions
pensyve-6.0.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for pensyve-6.0.0-cp313-cp313-win_amd64.whl
pensyve-6.0.0-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details for pensyve-6.0.0-cp313-cp313-manylinux_2_28_x86_64.whl
pensyve-6.0.0-cp313-cp313-manylinux_2_28_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ ARM64 Details for pensyve-6.0.0-cp313-cp313-manylinux_2_28_aarch64.whl
pensyve-6.0.0-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details for pensyve-6.0.0-cp313-cp313-macosx_11_0_arm64.whl
pensyve-6.0.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for pensyve-6.0.0-cp312-cp312-win_amd64.whl
pensyve-6.0.0-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details for pensyve-6.0.0-cp312-cp312-manylinux_2_28_x86_64.whl
pensyve-6.0.0-cp312-cp312-manylinux_2_28_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ ARM64 Details for pensyve-6.0.0-cp312-cp312-manylinux_2_28_aarch64.whl
pensyve-6.0.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for pensyve-6.0.0-cp312-cp312-macosx_11_0_arm64.whl
pensyve-6.0.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for pensyve-6.0.0-cp311-cp311-win_amd64.whl
pensyve-6.0.0-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details for pensyve-6.0.0-cp311-cp311-manylinux_2_28_x86_64.whl
pensyve-6.0.0-cp311-cp311-manylinux_2_28_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ ARM64 Details for pensyve-6.0.0-cp311-cp311-manylinux_2_28_aarch64.whl
pensyve-6.0.0-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for pensyve-6.0.0-cp311-cp311-macosx_11_0_arm64.whl
pensyve-6.0.0-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details for pensyve-6.0.0-cp310-cp310-win_amd64.whl
pensyve-6.0.0-cp310-cp310-manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64 Details for pensyve-6.0.0-cp310-cp310-manylinux_2_28_x86_64.whl
pensyve-6.0.0-cp310-cp310-manylinux_2_28_aarch64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ ARM64 Details for pensyve-6.0.0-cp310-cp310-manylinux_2_28_aarch64.whl
pensyve-6.0.0-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details for pensyve-6.0.0-cp310-cp310-macosx_11_0_arm64.whl

Total release size: 319.1 MB

Release files / pensyve-6.0.0.tar.gz

Download URL pensyve-6.0.0.tar.gz
Size 822.9 kB
Tags Source
SHA-256 checksum
How to use checksums
00e6090248dd781aaec0c4e42c60366a286c2e380c6c8dd752ccdc404e7fcaef
BLAKE2b-256 checksum
How to use checksums
5fd12c1fbc954d560ca76238c1e848157e5e942c535a98a3ae6b7254634c8e8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pensyve-6.0.0-cp313-cp313-win_amd64.whl

Download URL pensyve-6.0.0-cp313-cp313-win_amd64.whl
Size 23.5 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
41994d5301ac2bbe50a18ad40ea2fd51a56b490b65b52a3e82b3b36abc53a002
BLAKE2b-256 checksum
How to use checksums
54366c20788709b636cbd32ac2a8d33b6fef539676aa02d0afd034a7c0fa886b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pensyve-6.0.0-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL pensyve-6.0.0-cp313-cp313-manylinux_2_28_x86_64.whl
Size 20.8 MB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
80af4f52309f692be3f61f87269986a3b7350012b2e8428fadbf4f5679d1bfd6
BLAKE2b-256 checksum
How to use checksums
1cb5df59451c76b84d619d9f97e914a96c3bdf1bdf38bfb5766a813231dd92a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pensyve-6.0.0-cp313-cp313-manylinux_2_28_aarch64.whl

Download URL pensyve-6.0.0-cp313-cp313-manylinux_2_28_aarch64.whl
Size 19.8 MB
Tags CPython 3.13 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
7d0e9c566ac16ebea810952c37bd0f652060e4180037904beba79f142645adec
BLAKE2b-256 checksum
How to use checksums
2eb9b0c2a87b7cc6d09555c75dcb821674bc566cc834e089fb4ae00c99918d26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pensyve-6.0.0-cp313-cp313-macosx_11_0_arm64.whl

Download URL pensyve-6.0.0-cp313-cp313-macosx_11_0_arm64.whl
Size 15.4 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
721b167d1f941c027253ed014d22c8f2970865b357f0d6dea9194ca68e01591c
BLAKE2b-256 checksum
How to use checksums
0d99b0c5ad43b4d59f252dbcab52bd2cd3a0ee00bca7bbdf9eda7d02b901507e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pensyve-6.0.0-cp312-cp312-win_amd64.whl

Download URL pensyve-6.0.0-cp312-cp312-win_amd64.whl
Size 23.5 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
8bb95c62cb9736475124816c16e465281b50ee83cf5ac3af4fee044ceb353761
BLAKE2b-256 checksum
How to use checksums
c7e8eb91cae9f70d2b42784e2cb7438c01387749e7f6cbb4c38a9cc34bf22a61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pensyve-6.0.0-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL pensyve-6.0.0-cp312-cp312-manylinux_2_28_x86_64.whl
Size 20.8 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
138b7ea2cb3761f782f6bf1ee4615b8e4b9863da43e14f148489b06b3d4f6438
BLAKE2b-256 checksum
How to use checksums
0c92137f37ffe7917e3d197fd78be99d68d40f4e9c3073b4a0be5c287e3c7e21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pensyve-6.0.0-cp312-cp312-manylinux_2_28_aarch64.whl

Download URL pensyve-6.0.0-cp312-cp312-manylinux_2_28_aarch64.whl
Size 19.8 MB
Tags CPython 3.12 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
5522adf74f34afbbeca8b42fbc188061eb02fab80390b60b1157716ceb98c2b0
BLAKE2b-256 checksum
How to use checksums
79570396019156eaa821fb62042603a2f8cc0e0efa44a3bfd05d8de3e5115605
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pensyve-6.0.0-cp312-cp312-macosx_11_0_arm64.whl

Download URL pensyve-6.0.0-cp312-cp312-macosx_11_0_arm64.whl
Size 15.4 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
883d41bf6d81a8027407bb7c903e7fbf2d3bfb0e6814ee74fb40d1e66000d432
BLAKE2b-256 checksum
How to use checksums
206d166e988b911f195702613b101ff04254fac1236d343712c3ae3dd5b98f96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pensyve-6.0.0-cp311-cp311-win_amd64.whl

Download URL pensyve-6.0.0-cp311-cp311-win_amd64.whl
Size 23.5 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
31d4d80ca68a30dcf0d228d2f63af4bd41d2f976b72a6b608b26a6e178ce472c
BLAKE2b-256 checksum
How to use checksums
4f455bd5ce98c4241b21cf21df6023f70b8d886701773c74cabe8cdb0ba82ebc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pensyve-6.0.0-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL pensyve-6.0.0-cp311-cp311-manylinux_2_28_x86_64.whl
Size 20.8 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
d5fdbd6e6ace6f6c27e1df4f806588cace614af80b61580216c3134dfea67e8f
BLAKE2b-256 checksum
How to use checksums
d207fd0e1e12ed374fce0b4f9fc35c0fb3797959a507d9340ec7d0bd43e97e8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pensyve-6.0.0-cp311-cp311-manylinux_2_28_aarch64.whl

Download URL pensyve-6.0.0-cp311-cp311-manylinux_2_28_aarch64.whl
Size 19.8 MB
Tags CPython 3.11 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
2a8233182932b86621e9c8002ff6472bcc48e83408418475f9f2485848774c5c
BLAKE2b-256 checksum
How to use checksums
8d77963474ae5f5256ce757091fb6d1ed937660ef6ce1b2a4578b39b40e5a50c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pensyve-6.0.0-cp311-cp311-macosx_11_0_arm64.whl

Download URL pensyve-6.0.0-cp311-cp311-macosx_11_0_arm64.whl
Size 15.4 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d03eb0129b11db3d9179cb6e4265081f5f5040a6090686656c77aae8c960bde3
BLAKE2b-256 checksum
How to use checksums
0179fcc7def3619092310e1c68e30a3a5e102872353f6534632305a0251930b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pensyve-6.0.0-cp310-cp310-win_amd64.whl

Download URL pensyve-6.0.0-cp310-cp310-win_amd64.whl
Size 23.5 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
48a16bd2c7fec08d3d905dafe6a81e3339a47f42d9ba3eb8b62e7d19086d1285
BLAKE2b-256 checksum
How to use checksums
741bc15fcf4c91b3e6735171a6dffd46ae1e75eed43f7389351cf6396c8189a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pensyve-6.0.0-cp310-cp310-manylinux_2_28_x86_64.whl

Download URL pensyve-6.0.0-cp310-cp310-manylinux_2_28_x86_64.whl
Size 20.8 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
c47ac152a853d7160425b3755e74198fe8e54ac017476db78f1a68fb34a44b98
BLAKE2b-256 checksum
How to use checksums
43e7093a94faa65301d90a0ec7fe00c29506594b8a273b8dd1fbbe1e46685d3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pensyve-6.0.0-cp310-cp310-manylinux_2_28_aarch64.whl

Download URL pensyve-6.0.0-cp310-cp310-manylinux_2_28_aarch64.whl
Size 19.8 MB
Tags CPython 3.10 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
4ead0a9979561701ac8185110f02b0c53777469ee00f2a8ceeaf08c6915c9a90
BLAKE2b-256 checksum
How to use checksums
64e40ea26bcbc641e18ac2e75d66477e2840b5b77905de6f87c9e386b1535de5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pensyve-6.0.0-cp310-cp310-macosx_11_0_arm64.whl

Download URL pensyve-6.0.0-cp310-cp310-macosx_11_0_arm64.whl
Size 15.4 MB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6001460c181e64b3edc83d139fb890eaaf575d2e51d78e0d1aeead6ebcd9e55a
BLAKE2b-256 checksum
How to use checksums
2fdddeb1b229d9c0e132f9516a97b450c8c43023d39513ebb163f904e0354bf6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for pensyve 6.0.0

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.

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