Skip to main content

The mind database for AI agents

Project description

MenteDB Python SDK

Python bindings for MenteDB, the mind database for AI agents. Built with PyO3 and maturin for native Rust performance from Python.

Installation

From source (development)

cd sdks/python
pip install maturin
maturin develop

From PyPI (once published)

pip install mentedb

Quick start

from mentedb import MenteDB, MemoryType, EdgeType

with MenteDB("./agent-memory") as db:
    # Store a memory
    mid = db.store(
        "The deployment failed because the config was missing",
        memory_type=MemoryType.EPISODIC,
        tags=["deployment", "config"],
    )

    # Recall memories with MQL
    result = db.recall("RECALL tag:deployment LIMIT 5")
    print(result.text)

    # Vector similarity search
    hits = db.search(embedding=[0.1] * 384, k=5)
    for hit in hits:
        print(f"{hit.id}: {hit.score:.4f}")

    # Relate memories
    mid2 = db.store("Always validate config before deploy", memory_type=MemoryType.PROCEDURAL)
    db.relate(mid, mid2, edge_type=EdgeType.CAUSED)

    # Forget a memory
    db.forget(mid)

Cognitive features

The SDK also exposes MenteDB cognitive subsystems for real time stream monitoring, conversation trajectory tracking, and pain signal management.

from mentedb._mentedb_python import CognitionStream, TrajectoryTracker, PainRegistry

# Stream monitoring
stream = CognitionStream(buffer_size=500)
stream.feed_token("The")
stream.feed_token(" sky")
alerts = stream.check_alerts([("some-uuid", "the sky is blue")])

# Trajectory tracking
tracker = TrajectoryTracker(max_turns=50)
tracker.record_turn("deployment", "investigating", ["which env?"])
context = tracker.get_resume_context()

# Pain registry
pain = PainRegistry(max_warnings=3)
pain.record_pain("some-uuid", 0.8, ["timeout", "deploy"], "deploy timed out")
warnings = pain.check_triggers(["deploy"])

API reference

MenteDB

Method Description
store(content, memory_type, embedding, agent_id, tags) Store a memory, returns its UUID
recall(query) Recall memories using MQL
search(embedding, k) Vector similarity search
relate(source, target, edge_type, weight) Add a relationship
forget(memory_id) Remove a memory
close() Flush and close the database

Types

MemoryType: episodic, semantic, procedural, anti_pattern, reasoning, correction

EdgeType: caused, before, related, contradicts, supports, supersedes, derived, part_of

License

Apache 2.0. See the repository root LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

mentedb-0.7.0-cp312-cp312-win_amd64.whl (5.6 MB view details)

Uploaded CPython 3.12Windows x86-64

mentedb-0.7.0-cp312-cp312-manylinux_2_39_x86_64.whl (9.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

mentedb-0.7.0-cp312-cp312-macosx_11_0_arm64.whl (5.9 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file mentedb-0.7.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: mentedb-0.7.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 5.6 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mentedb-0.7.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 061488bdfae24f8988db39dc19d9049eca1eb5026a29223a82b9b8bc0231b4f0
MD5 7d1aade13b940dc698a0e6b824c45869
BLAKE2b-256 82e132c4be5d9b3a0f082618d4beb507570cecbcab220f1cad4581acd6751777

See more details on using hashes here.

Provenance

The following attestation bundles were made for mentedb-0.7.0-cp312-cp312-win_amd64.whl:

Publisher: publish-sdks.yml on nambok/mentedb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mentedb-0.7.0-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for mentedb-0.7.0-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 cce788172c733d166b7e7456b51968be217151d5991a1720d1b557193519a17a
MD5 3a31cf1ce8474f30daebde80dbaa8bd0
BLAKE2b-256 52b1c8cadbdcbc147d93fe4f8b8cb627fecb2bd00ada04b28e85496fbfc15e06

See more details on using hashes here.

Provenance

The following attestation bundles were made for mentedb-0.7.0-cp312-cp312-manylinux_2_39_x86_64.whl:

Publisher: publish-sdks.yml on nambok/mentedb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mentedb-0.7.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mentedb-0.7.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 860fad2ad01f3db2459ff8cccc29bc68131ef60e8c005f582031f80860bc6019
MD5 822121ae33b0d1b9f407b4c6987796cd
BLAKE2b-256 a4577d107ef86c5b540f38c3c318bfcf1573d3b7fea38e93847a6dc0df7e581c

See more details on using hashes here.

Provenance

The following attestation bundles were made for mentedb-0.7.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish-sdks.yml on nambok/mentedb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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