CausalOS provides native integrations for modern agent frameworks to make recording and guarding causal context seamless.
The LangChain integration uses a Callback Handler to automatically record tool executions and outcomes.
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")(Documentation coming soon — v1 focusing on LangChain and direct SDK usage.)
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)