Use this file to discover all available pages before exploring further.
AGT works with any agent framework through two integration paths: the universal govern() wrapper — which adds policy enforcement in two lines with zero framework knowledge — or framework-specific kernel adapters that unlock deeper hooks like tool call interception, memory write logging, and sub-agent delegation tracking. Every adapter intercepts calls before they reach the model, making denied actions structurally impossible rather than merely discouraged.
Kernel adapters provide deeper integration. The pattern is always: create a policy → create a kernel → wrap the framework object → use the governed object as normal.
ctx = governed.get_context()print(ctx.call_count) # number of LLM round-tripsprint(ctx.total_tokens) # cumulative token usageprint(ctx.tool_calls) # list of intercepted tool calls
LangChainKernel wraps chains, agents, and runnables. It intercepts invoke(), ainvoke(), stream(), and batch(), and provides deep hooks into the tool registry, memory writes, and sub-agent delegation.
from langchain_openai import ChatOpenAIfrom langchain_core.prompts import ChatPromptTemplatefrom langchain_core.output_parsers import StrOutputParserfrom agent_os.integrations import LangChainKernel, GovernancePolicyllm = ChatOpenAI(model="gpt-4o")chain = ChatPromptTemplate.from_template("Explain {topic}") | llm | StrOutputParser()policy = GovernancePolicy( max_tokens=2048, timeout_seconds=30, blocked_patterns=[ ("\\b\\d{3}-\\d{2}-\\d{4}\\b", "regex"), # block SSN patterns ("password", "substring"), ], log_all_calls=True,)kernel = LangChainKernel(policy=policy)governed_chain = kernel.wrap(chain)# invoke() is now governedresult = governed_chain.invoke({"topic": "zero-trust architecture"})# Async and streaming work the same wayresult = await governed_chain.ainvoke({"topic": "mTLS"})
Deep hooks available in the LangChain kernel:
Hook
What It Catches
Tool registry
Every tool invocation validated against allowed_tools
Memory writes
Detects and logs writes to conversation memory
Sub-agent spawning
Tracks when an agent delegates to another agent
PII detection
Built-in patterns catch SSNs, emails, secrets in output
Wrap an agent with tools:
from langchain_core.tools import tool@tooldef query_database(sql: str) -> str: """Run a read-only SQL query.""" ...policy = GovernancePolicy( allowed_tools=["query_database"], blocked_patterns=[ ("DROP", "substring"), ("DELETE", "substring"), ], max_tool_calls=10,)kernel = LangChainKernel(policy=policy)governed_agent = kernel.wrap(agent_executor)governed_agent.invoke({"input": "How many users signed up last week?"})
pip install agent-os-kernel crewai
CrewAIKernel wraps an entire crew, governing both kickoff() and kickoff_async(). It intercepts individual agent execution and tool calls within the crew.
All 22+ adapters live in agent-governance-python/agent-os/src/agent_os/integrations/. When your framework isn’t listed, extend BaseIntegration — the custom adapter section in Tutorial 03 walks through the minimal implementation.