Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 1.28 KB

File metadata and controls

46 lines (33 loc) · 1.28 KB

Integrations

CausalOS provides native integrations for modern agent frameworks to make recording and guarding causal context seamless.

LangChain

The LangChain integration uses a Callback Handler to automatically record tool executions and outcomes.

Setup

from causal_memory import CausalMemory
from causal_memory.integrations.langchain import CausalMemoryCallback
from langchain.agents import initialize_agent

# Initialize memory
memory = CausalMemory()
causal_callback = CausalMemoryCallback(memory)

# Pass the callback to your agent
agent = initialize_agent(
    tools=tools,
    llm=llm,
    agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,
    callbacks=[causal_callback]
)

# Every tool execution will now be captured in your causal database!
agent.run("Delete the temporary logs in /var/tmp")

LangGraph

(Documentation coming soon — v1 focusing on LangChain and direct SDK usage.)

Custom Integrations

You can easily build your own integrations by wrapping your agent's tool-calling logic with memory.recall() for guarding and memory.record() for history preservation.

# Generic pattern
result = recall_guard(intended_action)
if result.safe:
    outcome = execute(intended_action)
    memory.record(intended_action, outcome)