Framework Integrations

Faramesh offers one-line governance for popular AI agent frameworks. Wrap your tools or agents and route every action through Faramesh for policy checks before execution.

Supported Frameworks

Framework

Integration

What You Get

LangChain

GovernedTool wrapper

Wrap LangChain tools; tool calls go through Faramesh

CrewAI

GovernedCrew, GovernedTool

Govern crew and tool execution

AutoGen

GovernedFunction

Wrap AutoGen function calling

MCP

GovernedMCPClient

Govern Model Context Protocol tools

LangGraph

Governed graph nodes

Wrap tool calls in graph nodes

LlamaIndex

Tool wrapping

Wrap LlamaIndex agent tools

DSPy

GovernedModule

Govern DSPy module execution

LangChain

Wrap any LangChain tool with GovernedTool. Tool calls are submitted to Faramesh first; if allowed or approved, execution proceeds.

from langchain.tools import ShellTool
from faramesh.integrations.langchain import GovernedTool

shell_tool = ShellTool()
governed_shell = GovernedTool(tool=shell_tool, agent_id="my-agent")

# Use like a regular LangChain tool
result = await governed_shell.arun("ls -la")
from langchain.tools import ShellTool
from faramesh.integrations.langchain import GovernedTool

shell_tool = ShellTool()
governed_shell = GovernedTool(tool=shell_tool, agent_id="my-agent")

# Use like a regular LangChain tool
result = await governed_shell.arun("ls -la")
from langchain.tools import ShellTool
from faramesh.integrations.langchain import GovernedTool

shell_tool = ShellTool()
governed_shell = GovernedTool(tool=shell_tool, agent_id="my-agent")

# Use like a regular LangChain tool
result = await governed_shell.arun("ls -la")

Set FARAMESH_URL (or FARAMESH_API_BASE) and FARAMESH_API_KEY (or FARAMESH_TOKEN).

Demo: Run demo_agents/01_langchain_delete_all.py to see blocking rm -rf while allowing safe commands. See LangChain Demo.

CrewAI

Use GovernedCrew or GovernedTool to govern crew and tool execution.

from faramesh.integrations.crewai import GovernedTool, GovernedCrew

# Wrap tools or crew
governed_tool = GovernedTool(tool=my_tool, agent_id="crew-agent")
from faramesh.integrations.crewai import GovernedTool, GovernedCrew

# Wrap tools or crew
governed_tool = GovernedTool(tool=my_tool, agent_id="crew-agent")
from faramesh.integrations.crewai import GovernedTool, GovernedCrew

# Wrap tools or crew
governed_tool = GovernedTool(tool=my_tool, agent_id="crew-agent")

Demo: Run demo_agents/02_crewai_infinite_loop.py to see rate limiting and loop prevention.

AutoGen

Wrap AutoGen function calling with GovernedFunction.

from faramesh.integrations.autogen import GovernedFunction

# Wrap your function; calls go through Faramesh
governed_refund = GovernedFunction(fn=refund_fn, agent_id="autogen-agent")
from faramesh.integrations.autogen import GovernedFunction

# Wrap your function; calls go through Faramesh
governed_refund = GovernedFunction(fn=refund_fn, agent_id="autogen-agent")
from faramesh.integrations.autogen import GovernedFunction

# Wrap your function; calls go through Faramesh
governed_refund = GovernedFunction(fn=refund_fn, agent_id="autogen-agent")

Demo: Run demo_agents/03_autogen_high_value_approval.py to see human-in-the-loop for high-value transactions.

MCP (Model Context Protocol)

Use GovernedMCPClient for MCP tool servers.

from faramesh.integrations.mcp import GovernedMCPClient

# MCP tool calls routed through Faramesh
client = GovernedMCPClient(agent_id="mcp-agent")
from faramesh.integrations.mcp import GovernedMCPClient

# MCP tool calls routed through Faramesh
client = GovernedMCPClient(agent_id="mcp-agent")
from faramesh.integrations.mcp import GovernedMCPClient

# MCP tool calls routed through Faramesh
client = GovernedMCPClient(agent_id="mcp-agent")

Demo: Run demo_agents/04_mcp_filesystem_security.py for path-based access control.

LangGraph

Wrap tool calls in your graph nodes. Submit actions to Faramesh before executing.

from faramesh.sdk.client import ExecutionGovernorClient

def http_node(state):
    client = ExecutionGovernorClient()
    action = client.submit_action(
        tool="http", operation="get",
        params={"url": state["url"]},
        context={"agent_id": "langgraph-demo"}
    )
    if action["status"] == "pending_approval":
        return {"error": "pending_approval"}
    # Execute if allowed
    ...
from faramesh.sdk.client import ExecutionGovernorClient

def http_node(state):
    client = ExecutionGovernorClient()
    action = client.submit_action(
        tool="http", operation="get",
        params={"url": state["url"]},
        context={"agent_id": "langgraph-demo"}
    )
    if action["status"] == "pending_approval":
        return {"error": "pending_approval"}
    # Execute if allowed
    ...
from faramesh.sdk.client import ExecutionGovernorClient

def http_node(state):
    client = ExecutionGovernorClient()
    action = client.submit_action(
        tool="http", operation="get",
        params={"url": state["url"]},
        context={"agent_id": "langgraph-demo"}
    )
    if action["status"] == "pending_approval":
        return {"error": "pending_approval"}
    # Execute if allowed
    ...

Demo: Run demo_agents/03_langraph_payment_processor.py.

LlamaIndex

Wrap tool functions with Faramesh before they run.

from faramesh.sdk.client import ExecutionGovernorClient
from llama_index.core.tools import FunctionTool

def http_get(url: str) -> str:
    client = ExecutionGovernorClient()
    action = client.submit_action(
        tool="http", operation="get",
        params={"url": url},
        context={"agent_id": "llamaindex-demo"}
    )
    # Check decision, execute if allowed
    ...

tool = FunctionTool.from_defaults(fn=http_get, name="http_get")
from faramesh.sdk.client import ExecutionGovernorClient
from llama_index.core.tools import FunctionTool

def http_get(url: str) -> str:
    client = ExecutionGovernorClient()
    action = client.submit_action(
        tool="http", operation="get",
        params={"url": url},
        context={"agent_id": "llamaindex-demo"}
    )
    # Check decision, execute if allowed
    ...

tool = FunctionTool.from_defaults(fn=http_get, name="http_get")
from faramesh.sdk.client import ExecutionGovernorClient
from llama_index.core.tools import FunctionTool

def http_get(url: str) -> str:
    client = ExecutionGovernorClient()
    action = client.submit_action(
        tool="http", operation="get",
        params={"url": url},
        context={"agent_id": "llamaindex-demo"}
    )
    # Check decision, execute if allowed
    ...

tool = FunctionTool.from_defaults(fn=http_get, name="http_get")

Demo: Run demo_agents/07_llamaindex_rag_agent.py.

Quick Start

  1. pip install faramesh (and your framework: langchain, crewai, autogen, etc.)

  2. Get an API key from the Horizon dashboard (or use faramesh serve for self-hosted)

  3. Set FARAMESH_URL and FARAMESH_API_KEY

  4. Wrap your tools or agents with the appropriate governed class

  5. Actions are evaluated by your policies—allowed, denied, or sent for approval

Was this helpful?

Was this helpful?

Was this helpful?

Previous

More

Previous

More

Previous

More

Next

More

Next

More

Next

More

Table of content

Table of content

Table of content

Framework Integrations

Framework Integrations