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.2.tar.gz (14.4 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.2-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mcal_ai_langgraph-0.2.2.tar.gz
  • Upload date:
  • Size: 14.4 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.2.tar.gz
Algorithm Hash digest
SHA256 df7c7644324bf090b5da95f2dd0a2ea03e2a667f36e5bde34a80d66cbe1cc585
MD5 d748b3d99c06e789c816ea81eb7ca7a3
BLAKE2b-256 ae1926eea2b1e7f509223edfdddc564f5628e9b91c269a1381bc2140bdeef963

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcal_ai_langgraph-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7bd64b18051da647030b2b1e6d90aae8b900a2e052fa140715bc97252ca16060
MD5 ea056a2c327c348468e4017882770eeb
BLAKE2b-256 d313b76fce9a735a6c4d6f0244e283ccbd0eda066a63d7ecacf09cc5466288f3

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