Skip to main content

ChainMemory Python SDK

Permanent memory for AI agents on the ChainMemory blockchain.

Install

pip install chainmemory

Quick Start

from chainmemory import ChainMemory

# Generate new API key
cm = ChainMemory.create()
# Get AIC from https://faucet.chainmemory.ai

# Or use existing key
cm = ChainMemory(api_key="aic_...")

# Register your AI
cm.register("MyAgent", "gpt-4")

# Write a memory (instant response, syncs to blockchain in ~30s)
memory = cm.remember(
    "Decided to use Python for ML pipeline",
    category="DECISION",
    importance=8
)
print(memory["memory_id"])  # 1
print(memory["tier"])       # episodic
print(memory["chain_sync"]) # pending -> synced in 30s

# Recall memories
memories = cm.recall(limit=10)
for m in memories:
    print(f"[{m['category']}] {m['summary']}")

# Get profile
profile = cm.profile()
print(f"Total memories: {profile['local_memories']}")
print(f"Synced to chain: {profile['synced_memories']}")

# Network stats (no API key needed)
stats = ChainMemory.stats()
print(f"Block: {stats['block']}")
print(f"Chain ID: {stats['chain_id']}")

LangChain Integration

from langchain.memory import ConversationBufferMemory
from chainmemory import ChainMemory

cm = ChainMemory(api_key="aic_...")
cm.register("LangChainAgent", "gpt-4")

# Save conversation turns to ChainMemory
def save_to_chainmemory(human_input, ai_output):
    cm.remember(
        f"User: {human_input[:140]} | AI: {ai_output[:140]}",
        category="INTERACTION",
        importance=5,
        platform="langchain"
    )

Categories

Category Use Case
DECISION Important decisions made
LEARNING New knowledge acquired
INTERACTION Conversation summaries
STATE Agent state changes
ERROR Errors and corrections
MILESTONE Key achievements
CUSTOM Everything else

Network

Field Value
Chain ID 202604
Currency AIC (native)
RPC https://rpc.chainmemory.ai
Explorer https://chainmemory.ai
Faucet https://faucet.chainmemory.ai

License

MIT — ChainMemory — The permanent memory layer for artificial intelligence.

Metadata

Release files for chainmemory 1.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 chainmemory 1.0.0
File Size Uploaded Provenance
chainmemory-1.0.0.tar.gz 4.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for chainmemory 1.0.0
File Interpreter ABI Platform
chainmemory-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.2 kB

Release files / chainmemory-1.0.0.tar.gz

Download URL chainmemory-1.0.0.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
57b9b629d1951005ebc0ba4f742b637d0d45cf21c494f4b07549c44ff0ca4244
BLAKE2b-256 checksum
How to use checksums
772866487fd950f1f5f0e50ecbd3da4dd4c8823ca0124146ccb20429a85dbc6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / chainmemory-1.0.0-py3-none-any.whl

Download URL chainmemory-1.0.0-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
23182c96838c4d56a54499c2ad5ac7ac6641f1094f1d0796a7b4c3479ed70940
BLAKE2b-256 checksum
How to use checksums
159d8a55d1dd4a4c8e5ecbf79f3a3ed4630173b73eed2286b0fc2e20984017e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for chainmemory 1.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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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