Skip to main content

LangGraph integration for MCAL - Goal-aware memory for AI agents

Project description

mcal-langgraph

LangGraph integration for MCAL - Goal-aware memory for AI agents.

Installation

pip install mcal-langgraph

This will automatically install mcal and langgraph as dependencies.

Quick Start

from mcal import MCAL
from mcal_langgraph import MCALStore

# Initialize MCAL with a goal
mcal = MCAL(goal="Build a fraud detection system")

# Create LangGraph-compatible store
store = MCALStore(mcal)

# Use with LangGraph
from langgraph.prebuilt import create_react_agent

agent = create_react_agent(
    model=your_model,
    tools=your_tools,
    store=store  # Goal-aware memory!
)

Features

MCALStore (BaseStore)

Drop-in replacement for LangGraph's built-in stores with goal-aware memory:

from mcal_langgraph import MCALStore

store = MCALStore(mcal)

# Store memories
await store.aput(
    namespace=("user_123", "memories"),
    key="decision_1",
    value={"text": "Decided to use PostgreSQL for ACID compliance"}
)

# Goal-aware search - returns memories relevant to current goals
results = await store.asearch(
    namespace_prefix=("user_123",),
    query="database choice"
)

# Results include goal context and decisions
for item in results:
    print(item.value["goals"])      # Related goals
    print(item.value["decisions"])  # Related decisions

MCALMemory

Memory nodes for custom LangGraph workflows:

from mcal_langgraph import MCALMemory

memory = MCALMemory(llm_provider="anthropic")

# Add as nodes in your graph
graph.add_node("update_memory", memory.update_node())
graph.add_node("get_context", memory.context_node())

MCALCheckpointer

State persistence for LangGraph graphs:

from mcal_langgraph import MCALCheckpointer

checkpointer = MCALCheckpointer(mcal)
graph = builder.compile(checkpointer=checkpointer)

Why mcal-langgraph?

Feature LangGraph InMemoryStore MCALStore
BaseStore interface
Namespace organization
Goal-aware search
Decision tracking
Intent preservation

Migrating from mcal[langgraph]

If you were using the old extras-based installation:

# Old way (deprecated)
from mcal.integrations.langgraph import MCALStore

# New way (recommended)
from mcal_langgraph import MCALStore

The old import path still works but will show a deprecation warning.

License

MIT

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

mcal_ai_langgraph-0.2.0.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

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

mcal_ai_langgraph-0.2.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file mcal_ai_langgraph-0.2.0.tar.gz.

File metadata

  • Download URL: mcal_ai_langgraph-0.2.0.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for mcal_ai_langgraph-0.2.0.tar.gz
Algorithm Hash digest
SHA256 55cf38a3e856bf5774c16a4dbd13771f7f08d2b98d0a61dc97df16b9ff85fd76
MD5 1f05889d228f887072c8c9d612da6ea6
BLAKE2b-256 2625c147ee7e6efee4118de5c3323423ed92ef8b38592b114718ae352dbbffee

See more details on using hashes here.

File details

Details for the file mcal_ai_langgraph-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mcal_ai_langgraph-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac2b4505477d3f8a5a20dc3b45a6d05ffd6fa7bf3460d4779a14cee7bb817cc4
MD5 c3f712395145c2edd2ec7cecdca697c6
BLAKE2b-256 ca0e43e79b4ee402d958b95b946320eba16641208233226b3068dabc4af84973

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