Skip to main content

Causal memory graph for AI agents with belief revision and semantic retrieval

Project description

causalmem

Causal memory graph for AI agents with belief revision and semantic retrieval.

Overview

causalmem provides a structured memory system for AI agents that:

  • Records episodes (action + outcome) in an append-only buffer
  • Consolidates episodes into a causal graph using LLM-based belief revision
  • Classifies relationships as REFINEMENT, UPDATE, CORRECTION, or UNRELATED
  • Retrieves relevant memory chains using semantic similarity

Installation

pip install causalmem

Quick Start

from causalmem import Episode, EpisodeBuffer, Consolidator

buf = EpisodeBuffer()
c = Consolidator(buf)

buf.add(Episode("user wants report", "fetch data", ["fetch(db)"], "retrieved 100 rows", "need data first"), c)
buf.add(Episode("have data", "analyze data", ["analyze(data)"], "found 3 trends", "data available"), c)

await buf._queue.join()
result = c.retrieve("how was the analysis done?")
for node in result:
    print(node.episode.action, "->", node.episode.outcome)

License

Apache 2.0

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

causalmem-0.1.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

causalmem-0.1.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for causalmem-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3f9328310e1781b0e984da56d913c56763d4d2c773782acc163e067d80023460
MD5 d92e61b8aa9e08b0fca161bbc6f74245
BLAKE2b-256 34ced75ca706b6e4c9a2f4d23f111d6606d2df1ea76b6f79c61651d44deb6f5a

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for causalmem-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d36eb7e0ab95626397509554a3be04bcc175ecc2b43e69c04a1891f1b1c873d0
MD5 544c5a3cd9700283605808a510d90ca2
BLAKE2b-256 4681f1b0258cf9a137b2a1f78066409003a70d621957d223c3b77329b15dc486

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