Execution gatekeeper for AI agents
Faramesh Core is an open-core execution governor that provides policy-driven governance, risk scoring, and human-in-the-loop approval for AI agent tool calls. Built for production use with a modern web UI, comprehensive CLI, and SDK integrations.
Faramesh Horizon is our fully-managed SaaS offering that provides instant onboarding with no deployments required. Horizon includes a fully-managed core service, automatic upgrades, usage tracking and metrics, API keys and secrets management, and approval routing via Slack and email. Ideal for startups and small teams who want to get started quickly without infrastructure management.
Faramesh Nexus is an enterprise-grade deployment of Faramesh that runs inside your VPC or Kubernetes cluster. Nexus supports SSO, RBAC, multi-org management, audit exports with long-term retention, and optional air-gap compatibility for security-critical environments. Perfect for organizations that need full control over their governance infrastructure.
Faramesh OSS is the engine, Nexus and Horizon are the accelerators.
- Policy-Driven Governance: YAML-based policies with first-match-wins evaluation
- Risk Scoring: Automatic risk assessment (low/medium/high) based on configurable rules
- Human-in-the-Loop: Approval workflows for high-risk or policy-required actions
- Audit Ledger: Complete event timeline for every action (created, approved, executed, etc.)
- Real-Time UI: Modern web dashboard with live updates via Server-Sent Events
- Developer-Friendly CLI: Powerful command-line interface with prefix matching
- SDK Integration: Python and Node.js SDKs for easy agent integration
- LangChain Support: Drop-in wrapper for LangChain tools
- Framework Integrations - One-line governance for LangChain, CrewAI, AutoGen, MCP, LangGraph, LlamaIndex
- LangChain Integration Demo - Runnable demo showing how to wrap LangChain tools with Faramesh governance
- CrewAI Integration - One-line governance for CrewAI agents
- AutoGen Integration - One-line governance for AutoGen function calling
- MCP Integration - One-line governance for MCP tools
- LangGraph Integration - Simple graph nodes with Faramesh governance
- LlamaIndex Integration - Tool wrapping for LlamaIndex agents
- Docker Compose with Demo Agent - One-click setup with continuous demo agent
- Policy Packs - Ready-to-use policy templates for common scenarios
- Govern Your Own Tool Tutorial - Step-by-step guide to wrapping custom tools
pip install faramesh
faramesh serveSDKs:
- Python SDK:
pip install faramesh-sdk(optional - for advanced SDK features) - Node SDK:
npm install @faramesh/sdk(optional - for Node.js/TypeScript)
Note: Framework integrations work with just pip install faramesh - no SDK package needed!
See docs/Quickstart.md for a step‑by‑step guide.
- Installation
- Quick Start
- Core Concepts
- Policy Configuration
- Risk Scoring
- CLI Usage
- Web UI
- SDK Integration
- Framework Integrations
- Docker Deployment
- API Reference
- Environment Variables
- Examples
- Architecture
- Contributing
- Governance
- Python 3.9+
- pip
- Node.js 18+ (optional, for UI development)
git clone https://github.com/faramesh/faramesh-core.git
cd faramesh
pip install -e .For enhanced CLI output and DX features:
pip install -e ".[cli]"This installs:
rich- Beautiful terminal output with colorstabulate- Professional table formattingwatchdog- File watching (for--watchflag)sseclient- SSE streaming (fortailcommand)
Note: All features work without these dependencies, with graceful fallbacks to plain text output.
faramesh serveServer starts on http://127.0.0.1:8000 by default.
Open http://127.0.0.1:8000 in your browser.
The UI provides:
- Real-time action monitoring
- Event timeline for each action
- One-click approve/deny
- Risk level visualization
- Demo mode with sample data
Python SDK:
from faramesh import configure, submit_action
# Configure client (or use environment variables)
configure(base_url="http://127.0.0.1:8000")
# Submit action
action = submit_action(
agent_id="my-agent",
tool="shell",
operation="run",
params={"cmd": "echo 'Hello Faramesh'"}
)
print(f"Status: {action['status']}")
print(f"Risk Level: {action.get('risk_level')}")Alternative (Class-based API):
from faramesh.sdk.client import ExecutionGovernorClient
client = ExecutionGovernorClient("http://127.0.0.1:8000")
action = client.submit_action(
tool="shell",
operation="run",
params={"cmd": "echo 'Hello Faramesh'"},
context={"agent_id": "my-agent"}
)
print(f"Status: {action['status']}")
print(f"Risk Level: {action.get('risk_level')}")cURL:
curl -X POST http://127.0.0.1:8000/v1/actions \
-H "Content-Type: application/json" \
-d '{
"agent_id": "my-agent",
"tool": "shell",
"operation": "run",
"params": {"cmd": "echo test"}
}'CLI:
# List all actions (color-coded)
faramesh list
# List with full UUIDs
faramesh list --full
# Explain why action was allowed/denied
faramesh explain <action-id>
# Get specific action
faramesh get <action-id>
# View event timeline
faramesh events <action-id>
# Stream live actions
faramesh tailWeb UI:
- Click any action row to see details
- View event timeline in the detail drawer
- See risk levels and approval status
- Copy curl commands with one click
- Demo mode indicator (if active)
High‑level data flow:
┌─────────┐ submit ┌─────────────┐ decision ┌───────────────┐
│ Agents │ ─────────────────▶ │ Faramesh │ ─────────────────────▶ │ Executors / │
│ (LLMs, │ │ API Server │ │ Tools │
└─────────┘ │ / Policy │ └───────────────┘
▲ │ Engine │ │
│ └─────────────┘ │ report
│ ▲ │ result
│ │ ▼
│ ┌─────────────┐ ┌──────────────┐
│ │ Web UI & │◀──────────────────────▶│ Storage / │
└──────────────────────▶ │ CLI (HITL) │ events / state │ DB / Metrics │
└─────────────┘ └──────────────┘
The deterministic execution gate ensures all actions pass through canonicalization, profile evaluation, and policy evaluation before any execution occurs.
flowchart TD
client[Client/SDK] -->|submit action| actionsEndpoint["POST /v1/actions"]
client -->|decide only| gateEndpoint["POST /v1/gate/decide"]
subgraph decisionEngine[Decision Engine]
canon[Canonicalize + request_hash]
profileEval[Profile evaluation]
policyEval[PolicyEngine.evaluate]
outcomeMap[Map to outcome + reason_code]
versionBind[Bind policy/profile/runtime + provenance_id]
end
actionsEndpoint --> decisionEngine
gateEndpoint --> decisionEngine
decisionEngine -->|EXECUTE outcome| executor[ActionExecutor]
decisionEngine -->|ABSTAIN/HALT| noExec["No execution"]
executor --> eventsDB[(action_events with hash chain)]
actionsEndpoint --> actionsDB[(actions table)]
gateEndpoint --> decisionsOnly["Decision response only"]
eventsDB --> cliVerify["faramesh verify-log"]
actionsDB --> cliReplay["faramesh replay-decision"]
Decision Outcomes:
| Outcome | Description | Next Step |
|---|---|---|
| EXECUTE | Action is allowed to proceed | Executor runs the action |
| ABSTAIN | Action requires human approval | Wait for approval |
| HALT | Action is denied | No execution, logged |
Version-Bound Fields: Every decision includes deterministic metadata: request_hash, policy_hash, profile_hash, runtime_version, and provenance_id for replay verification.
See also:
Architecture.pngfor a visual diagram.docs/API.mdfor endpoint‑level details.
An action represents a tool call that an AI agent wants to execute. Each action has:
- ID: Unique identifier (UUID)
- Agent ID: Identifier for the agent making the request
- Tool: Tool name (e.g., "shell", "http", "stripe")
- Operation: Operation name (e.g., "run", "get", "refund")
- Params: Tool-specific parameters
- Context: Additional metadata
- Status: Current state (pending_approval, approved, executing, etc.)
- Decision: Policy decision (allow, deny, require_approval)
- Risk Level: Computed risk (low, medium, high)
- Events: Timeline of all state changes
Policies are evaluated in order, and the first matching rule wins. If no rules match, the action is denied by default (deny-by-default security model).
Risk scoring runs independently of policy rules. Risk rules can trigger automatic approval requirements even if a policy rule would allow the action.
Policies are defined in YAML files. By default, Faramesh looks for policies/default.yaml.
rules:
# Rules evaluated in order - first match wins
- match:
tool: "http"
op: "get"
allow: true
description: "Allow HTTP GET requests"
risk: "low"
- match:
tool: "shell"
op: "*"
require_approval: true
description: "Shell commands require approval"
risk: "medium"
# Default deny (must be last)
- match:
tool: "*"
op: "*"
deny: true
description: "Default deny rule"
risk: "high"Available match conditions:
tool: Tool name (supports"*"wildcard)op/operation: Operation namecontains: Substring match in params JSONpattern: Regex pattern matchamount_gt,amount_lt,amount_gte,amount_lte: Numeric comparisonspath_contains,path_starts_with,path_ends_with: Path matchingmethod: HTTP methodbranch: Git branch nameagent_id: Agent identifierfield+value: Custom field matching
Each rule can have one effect:
allow: true- Allow immediatelydeny: true- Deny immediatelyrequire_approval: true- Require human approval
Block Destructive Shell Commands:
rules:
- match:
tool: "shell"
op: "*"
pattern: "rm -rf|shutdown|reboot|mkfs"
deny: true
description: "Block destructive commands"
risk: "high"
- match:
tool: "*"
op: "*"
deny: trueRequire Approval for Large Payments:
rules:
- match:
tool: "stripe"
op: "refund"
amount_gt: 1000
require_approval: true
description: "Large refunds require approval"
risk: "medium"
- match:
tool: "stripe"
op: "*"
allow: true
risk: "low"
- match:
tool: "*"
op: "*"
deny: trueRisk scoring provides an additional layer of safety by automatically assessing action risk levels.
Define risk rules in your policy file:
risk:
rules:
- name: dangerous_shell
when:
tool: shell
operation: run
pattern: "rm -rf"
risk_level: high
- name: large_payments
when:
tool: stripe
operation: refund
amount_gt: 1000
risk_level: medium- low: Safe operations (default)
- medium: Moderate risk
- high: High risk - automatically requires approval even if policy allows
Risk rules use the same match conditions as policy rules. The first matching risk rule determines the risk level.
If an action has risk_level: high and a policy rule would allow it, Faramesh automatically changes the decision to require_approval for safety.
Faramesh provides a powerful CLI for managing actions and policies.
# Start server
faramesh serve
# Start with policy hot-reload (local mode only)
faramesh serve --hot-reload
# Or use environment variable:
# FARAMESH_HOT_RELOAD=1 faramesh serve
# Note: If policy reload fails, previous valid policy stays active
# List actions (truncated IDs, color-coded)
faramesh list
# List with full UUIDs
faramesh list --full
# JSON output (for scripting)
faramesh list --json
# Get specific action (supports prefix matching)
faramesh get 2755d4a8
faramesh get 2755d4a8-1000-47e6-873c-b9fd535234ad
# Explain why action was allowed/denied
faramesh explain 2755d4a8
# View event timeline
faramesh events 2755d4a8
# Approve action
faramesh approve 2755d4a8
# or
faramesh allow 2755d4a8
# Deny action
faramesh deny 2755d4a8
# Replay an action
faramesh replay 2755d4a8
# Get ready-to-copy curl commands
faramesh curl 2755d4a8
# Stream live actions (SSE, like kubectl logs)
faramesh tail
# Show status transitions
faramesh logs 2755d4a8# Scaffold starter layout
faramesh init
# Build web UI
faramesh build-ui
# Sanity check environment
faramesh doctor
# Compare policy files
faramesh policy-diff old.yaml new.yaml
# Generate Docker files
faramesh init-dockerAll commands that take an action ID support prefix matching. Use the first 8+ characters:
# These are equivalent:
faramesh get 2755d4a8
faramesh get 2755d4a8-1000-47e6-873c-b9fd535234adIf multiple actions match, Faramesh will warn you and list all matches.
# Specify API host/port
faramesh --host 0.0.0.0 --port 9000 list
# Override auth token
faramesh --token my-token list
# JSON output
faramesh --json get <id>List actions with risk levels (color-coded):
$ faramesh list
┌────────────┬──────────────────┬────────┬────────────┬──────────────┬──────────────────────────────────────┬─────────────────────┐
│ ID │ Status │ Risk │ Tool │ Operation │ Params │ Created │
├────────────┼──────────────────┼────────┼────────────┼──────────────┼──────────────────────────────────────┼─────────────────────┤
│ 2755d4a8 │ pending_approval │ high │ shell │ run │ {"cmd": "rm -rf /tmp"} │ 2026-01-12 10:00:00 │
│ a1b2c3d4 │ allowed │ low │ http │ get │ {"url": "https://..."} │ 2026-01-12 09:59:00 │
└────────────┴──────────────────┴────────┴────────────┴──────────────┴──────────────────────────────────────┴─────────────────────┘Explain why action was allowed/denied:
$ faramesh explain 2755d4a8
Action Explanation: 2755d4a8
Status: pending_approval
Decision: require_approval
Reason: Shell commands require approval
Risk Level: high
Policy File: /path/to/policies/default.yaml
Policy Version: yaml
Tool: shell
Operation: run
Params: {"cmd": "rm -rf /tmp"}View event timeline:
$ faramesh events 2755d4a8
Event Timeline - 2755d4a8
┌─────────────────────┬──────────────────────┬─────────────────────────────┐
│ Time │ Event │ Details │
├─────────────────────┼──────────────────────┼─────────────────────────────┤
│ 2026-01-12 10:00:00 │ created │ {"decision": "require_..."} │
│ 2026-01-12 10:00:01 │ decision_made │ {"decision": "require_..."} │
│ 2026-01-12 10:05:23 │ approved │ {"reason": "Looks safe"} │
│ 2026-01-12 10:05:24 │ started │ {} │
│ 2026-01-12 10:05:25 │ succeeded │ {"reason": "ok"} │
└─────────────────────┴──────────────────────┴─────────────────────────────┘Stream live actions (SSE):
$ faramesh tail
Streaming actions (press CTRL+C to stop)...
[10:00:15] pending_approval 2755d4a8 | shell | run
[10:00:20] approved a1b2c3d4 | http | get
[10:00:25] succeeded 2755d4a8 | shell | runGet curl commands:
$ faramesh curl 2755d4a8
# Action: 2755d4a8-1000-47e6-873c-b9fd535234ad
# Status: pending_approval
# Approve:
curl -X POST http://127.0.0.1:8000/v1/actions/2755d4a8-.../approval \
-H "Content-Type: application/json" \
-d '{"token": "abc123...", "approve": true}'
# Deny:
curl -X POST http://127.0.0.1:8000/v1/actions/2755d4a8-.../approval \
-H "Content-Type: application/json" \
-d '{"token": "abc123...", "approve": false}'DX Commands:
# Initialize project
$ faramesh init
✓ Created starter files:
• policies/
• policies/default.yaml
• .env.example
Next steps:
1. Review policies/default.yaml
2. Copy .env.example to .env and customize
3. Run: faramesh serve
# Check environment
$ faramesh doctor
✓ Python 3.11.0
✓ Database exists and is writable
✓ Policy file exists: policies/default.yaml
✓ Auth token configured
✓ UI assets found
# Compare policies
$ faramesh policy-diff old.yaml new.yaml
Policy Differences:
Old: old.yaml
New: new.yaml
Old rules: 3
New rules: 4
Added rules:
+ Allow HTTP GET requestsThe Faramesh web UI provides a modern, real-time dashboard for monitoring and managing actions.
- Action Table: View all actions with status, risk level, tool, and operation
- Event Timeline: Click any action to see complete event history
- Real-Time Updates: Live updates via Server-Sent Events (SSE)
- Approve/Deny: One-click approval for pending actions
- Copy Curl Commands: Copy ready-to-use curl commands for API calls
- Demo Badge: Visual indicator for demo-seeded actions
- Dark/Light Mode: Toggle between themes
- Search & Filters: Filter by status, agent, tool
- Pagination: Navigate large action lists
- Start the server:
faramesh serve - Open
http://127.0.0.1:8000in your browser
- View Actions: See all actions in the main table
- Click Action: Opens detail drawer with full information
- View Events: Scroll to event timeline section
- Approve/Deny: Click buttons if action is pending approval
- Copy Curl: Use copy buttons to get API commands
The event timeline shows every state change:
created- Action was createddecision_made- Policy evaluation completedapproved- Human approved the actiondenied- Human denied the actionstarted- Execution begansucceeded- Execution completed successfullyfailed- Execution failed
Each event includes:
- Timestamp
- Event type
- Metadata (reason, error, etc.)
Modern Functional API:
from faramesh import configure, submit_action, get_action, start_action, wait_for_completion
# Configure client
configure(base_url="http://127.0.0.1:8000")
# Submit action
action = submit_action(
agent_id="my-agent",
tool="shell",
operation="run",
params={"cmd": "echo 'Hello World'"}
)
# Check status
print(f"Status: {action['status']}")
print(f"Risk Level: {action.get('risk_level')}")
print(f"Decision: {action.get('decision')}")
# If pending approval, wait for completion
if action['status'] == 'pending_approval':
final = wait_for_completion(action['id'])
print(f"Final status: {final['status']}")
# Start execution and wait for result
if action['status'] in ('allowed', 'approved'):
start_action(action['id'])
result = wait_for_completion(action['id'])
print(f"Execution result: {result.get('result')}")Class-based API (Legacy):
from faramesh.sdk.client import ExecutionGovernorClient
client = ExecutionGovernorClient("http://127.0.0.1:8000")
action = client.submit_action(
tool="shell",
operation="run",
params={"cmd": "echo 'Hello World'"},
context={"agent_id": "my-agent"}
)
# Check status
print(f"Status: {action['status']}")
# Wait for approval if needed
if action['status'] == 'pending_approval':
import time
while True:
time.sleep(2)
updated = client.get_action(action['id'])
if updated['status'] in ('approved', 'denied'):
break
print(f"Final status: {updated['status']}")
# Report result
client.report_result(action['id'], success=True, error=None)const { ExecutionGovernorClient } = require('@faramesh/sdk');
const client = new ExecutionGovernorClient('http://127.0.0.1:8000');
// Submit action
const action = await client.submitAction({
tool: 'shell',
operation: 'run',
params: { cmd: "echo 'Hello World'" },
context: { agent_id: 'my-agent' }
});
console.log(`Status: ${action.status}`);
console.log(`Risk Level: ${action.risk_level}`);
// Get events
const events = await client.getEvents(action.id);
console.log(`Event count: ${events.length}`);Faramesh provides a drop-in wrapper for LangChain tools that automatically enforces governance.
from langchain.tools import ShellTool
from faramesh.sdk.client import ExecutionGovernorClient
from faramesh.integrations.langchain.governed_tool import GovernedTool
# Create Faramesh client
client = ExecutionGovernorClient("http://127.0.0.1:8000")
# Wrap LangChain tool
shell_tool = ShellTool()
governed = GovernedTool(
tool=shell_tool,
client=client,
agent_id="my-langchain-agent"
)
# Use in agent - tool calls are automatically governed
result = governed.run("ls -la")from langchain.agents import initialize_agent, AgentType
from langchain.llms import OpenAI
# Wrap all tools
governed_tools = [
GovernedTool(tool=t, client=client, agent_id="agent-1")
for t in [shell_tool, http_tool]
]
# Create agent with governed tools
agent = initialize_agent(
tools=governed_tools,
llm=llm,
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
verbose=True
)
# Agent tool calls are now governed by Faramesh
response = agent.run("List files in /tmp and fetch a URL")- Intercept: GovernedTool intercepts tool calls before execution
- Submit: Submits to Faramesh for policy evaluation
- Wait: If pending approval, polls until approved/denied
- Execute: Only executes if allowed/approved
- Report: Reports result back to Faramesh
See examples/langchain/ for a complete runnable demo with HTTP and shell tools.
# Start with demo data
docker compose up
# Access UI
open http://localhost:8000# Build image
docker build -t faramesh .
# Run with custom config
docker run -p 8000:8000 \
-e FARAMESH_DEMO=1 \
-e FARAMESH_ENABLE_CORS=1 \
-e FARAMESH_HOST=0.0.0.0 \
-e FARAMESH_PORT=8000 \
-v $(pwd)/policies:/app/policies \
-v $(pwd)/data:/app/data \
farameshThe docker-compose.yaml includes:
- faramesh: Main server
- demo-agent: Example agent that submits actions
Edit docker-compose.yaml to customize:
services:
faramesh:
build: .
ports:
- "8000:8000"
environment:
- FARAMESH_DEMO=1
- FARAMESH_ENABLE_CORS=1
volumes:
- ./data:/app/data
- ./policies:/app/policiesPOST /v1/actions
Content-Type: application/json
{
"agent_id": "string",
"tool": "string",
"operation": "string",
"params": {},
"context": {}
}GET /v1/actions/{action_id}GET /v1/actions?limit=20&offset=0&status=pending_approval&tool=shellGET /v1/actions/{action_id}/eventsReturns array of events:
[
{
"id": "uuid",
"action_id": "uuid",
"event_type": "created",
"meta": {},
"created_at": "2026-01-12T10:00:00Z"
}
]POST /v1/actions/{action_id}/approval
Content-Type: application/json
{
"token": "approval_token",
"approve": true,
"reason": "Optional reason"
}POST /v1/actions/{action_id}/startPOST /v1/actions/{action_id}/result
Content-Type: application/json
{
"success": true,
"error": "Optional error message"
}GET /v1/eventsReturns SSE stream of action updates.
GET /health
GET /readyGET /metricsReturns Prometheus metrics.
| Variable | Default | Description |
|---|---|---|
FARAMESH_HOST |
127.0.0.1 |
Server bind address |
FARAMESH_PORT |
8000 |
Server port |
FARAMESH_TOKEN |
- | Auth token (overrides FARA_AUTH_TOKEN) |
FARAMESH_ENABLE_CORS |
1 |
Enable CORS (1=enabled, 0=disabled) |
FARAMESH_DEMO |
- | Demo mode (1=seed demo data if DB empty) |
| Variable | Default | Description |
|---|---|---|
FARA_POLICY_FILE |
policies/default.yaml |
Policy file path |
FARA_DB_BACKEND |
sqlite |
Database backend (sqlite or postgres) |
FARA_SQLITE_PATH |
data/actions.db |
SQLite database path |
FARA_POSTGRES_DSN |
- | PostgreSQL connection string |
These are still supported but FARAMESH_* variants take precedence:
FARA_API_HOST→FARAMESH_HOSTFARA_API_PORT→FARAMESH_PORTFARA_AUTH_TOKEN→FARAMESH_TOKEN
All configurable via environment variables:
# Server
export FARAMESH_HOST=0.0.0.0
export FARAMESH_PORT=9000
export FARAMESH_TOKEN=my-secret-token
export FARAMESH_ENABLE_CORS=1
# Policy
export FARA_POLICY_FILE=policies/custom.yaml
# Database
export FARA_DB_BACKEND=sqlite
export FARA_SQLITE_PATH=data/actions.db
# Demo Mode
export FARAMESH_DEMO=1Or use .env file:
# Copy example
cp .env.example .env
# Edit .env with your settings
# Faramesh automatically reads .env if python-dotenv is installed- Framework Integrations - One-line governance for LangChain, CrewAI, AutoGen, MCP, LangGraph, LlamaIndex
- LangChain Integration Demo - Runnable demo showing how to wrap LangChain tools with Faramesh governance
- CrewAI Integration - One-line governance for CrewAI agents
- AutoGen Integration - One-line governance for AutoGen function calling
- MCP Integration - One-line governance for MCP tools
- LangGraph Integration - Simple graph nodes with Faramesh governance
- LlamaIndex Integration - Tool wrapping for LlamaIndex agents
- Docker Compose with Demo Agent - One-click setup with continuous demo agent
- Policy Packs - Ready-to-use policy templates for common scenarios
- Govern Your Own Tool Tutorial - Step-by-step guide to wrapping custom tools
from faramesh.sdk.client import ExecutionGovernorClient
client = ExecutionGovernorClient("http://127.0.0.1:8000")
def execute_command(cmd):
action = client.submit_action(
tool="shell",
operation="run",
params={"cmd": cmd},
context={"agent_id": "my-bot"}
)
if action['status'] == 'denied':
raise PermissionError(f"Action denied: {action['reason']}")
if action['status'] == 'pending_approval':
# Wait for approval
import time
while True:
time.sleep(2)
updated = client.get_action(action['id'])
if updated['status'] in ('approved', 'denied'):
break
if updated['status'] == 'denied':
raise PermissionError("Action denied")
# Execute command
import subprocess
result = subprocess.run(cmd, shell=True, capture_output=True)
# Report result
client.report_result(
action['id'],
success=result.returncode == 0,
error=result.stderr.decode() if result.returncode != 0 else None
)
return result.stdout.decode()rules:
- match:
tool: "http"
op: "*"
allow: true
risk: "low"
- match:
tool: "shell"
op: "*"
require_approval: true
risk: "medium"
- match:
tool: "*"
op: "*"
deny: true
risk:
rules:
- name: dangerous_commands
when:
tool: shell
operation: run
pattern: "rm -rf|shutdown|reboot"
risk_level: high
- name: large_payments
when:
tool: stripe
operation: refund
amount_gt: 1000
risk_level: mediumversion: '3.8'
services:
faramesh:
build: .
ports:
- "8000:8000"
environment:
- FARAMESH_DEMO=1
- FARAMESH_ENABLE_CORS=1
- FARA_POLICY_FILE=/app/policies/custom.yaml
volumes:
- ./policies:/app/policies
- ./data:/app/dataContributions are welcome! Please see CONTRIBUTING.md for guidelines.
# Clone repository
git clone https://github.com/faramesh/faramesh-core.git
cd faramesh
# Install in development mode
pip install -e ".[dev,cli]"
# Initialize project
faramesh init
# Run tests
pytest
# Start development server with hot-reload
faramesh serve --watch
# Build UI (if making UI changes)
cd web && npm install && npm run buildFaramesh includes comprehensive developer experience features:
faramesh init- Scaffold starter layoutfaramesh explain <id>- Explain policy decisionsfaramesh doctor- Environment sanity checksfaramesh build-ui- Build web UIfaramesh serve --hot-reload- Hot reload policy files (local mode only)FARAMESH_HOT_RELOAD=1- Enable hot reload via environment variable- Note: If policy reload fails, previous valid policy stays active
faramesh replay <id>- Replay actionsfaramesh tail- Stream live actions (SSE)faramesh policy-diff- Compare policy filesfaramesh init-docker- Generate Docker config
See docs/CLI.md and docs/Policies.md for complete DX and policy documentation.
faramesh/
├── src/faramesh/
│ ├── server/ # FastAPI server
│ ├── sdk/ # Python SDK
│ ├── cli.py # CLI interface
│ └── integrations/ # LangChain, etc.
├── web/ # React UI
├── policies/ # Policy examples
├── examples/ # Integration examples
└── tests/ # Test suite
Faramesh Core is made available under the Elastic License 2.0.
You are free to use, modify, and integrate Faramesh Core in your own products and services, except you may not offer it as a competing hosted service where the primary value is Faramesh Core itself.
- Code of Conduct:
CODE_OF_CONDUCT.md - Security policy:
SECURITY.md - Changelog:
CHANGELOG.md - Issues: GitHub Issues (bug/feature templates included)
- Pull requests: See
.github/PULL_REQUEST_TEMPLATE.md
If installation fails, upgrade pip: python3 -m pip install --upgrade pip
- Documentation: docs/
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Built with ❤️ for safe AI agent operations
The primary execution path from agent action submission through policy evaluation to final execution and logging.
+--------+ +------+ +------------+ +--------+
| Agent | --> | SDK | --> | Faramesh | --> | Policy |
+--------+ +------+ | Core API | | Engine |
+------------+ +--------+
|
v
+-------------+
| allow/deny/ |
| pending |
+-------------+
|
+--------------+--------------+
| |
v v
+-------------+ +-------------+
| Agent / | | Dashboard |
| Executor | | + Logs |
+-------------+ +-------------+
How YAML policies are loaded, matched against actions, and produce decisions.
+-------------+
| YAML Policy |
+-------------+
|
v
+-------------+
| Load Policy |
+-------------+
|
v
+-------------+
| Rule Match |
| (first wins)|
+-------------+
|
v
+-------------+
| Decision |
| allow/deny/ |
| pending |
+-------------+
|
v
+-------------+
| API Response|
+-------------+
The complete lifecycle of an action from creation through approval, execution, and final audit logging.
+-------------+
| Action |
| Created |
+-------------+
|
v
+-------------+
| Pending |
| Approval |
+-------------+
|
v
+-------------+
| Approve or |
| Reject |
+-------------+
|
+----> Deny --> Audit Log (Final)
|
v
+-------------+
| Execute |
+-------------+
|
v
+-------------+
| Audit Log |
| (Final) |
+-------------+
All integration points that connect to Faramesh Core and consume its outputs.
+----------------------------------+
| Integration Layer |
| +--------+ +--------+ +------+ |
| | SDKs | | CLI | |Lang | |
| |(Py/JS) | | | |Chain| |
| +--------+ +--------+ +------+ |
| +--------+ |
| |CI Hooks| |
| +--------+ |
+----------------------------------+
|
v
+---------------+
| Faramesh Core |
+---------------+
|
+-------+-------+
| |
v v
+----------+ +-----------+
|Dashboard | | Logs |
+----------+ +-----------+
Three common deployment patterns for Faramesh.
Single Binary (Local):
+------------------+
| Single Binary |
| +------------+ |
| | Faramesh | |
| | Core + DB | |
| +------------+ |
+------------------+
Docker Compose:
+------------------+ +------------+
| Faramesh Core | <-> | PostgreSQL |
| (Container) | | (Container)|
+------------------+ +------------+
Kubernetes:
+------------------+ +------------------+
| Faramesh Pods | <-> | Persistent DB |
| (Replicas) | | (StatefulSet) |
+------------------+ +------------------+
The open-source core and the hosted/enterprise feature layers.
+----------------------------------------+
| Hosted/Enterprise Features (Horizon/ |
| Nexus): SSO, RBAC, Multi-org, |
| Advanced Routing, ML Risk Scoring |
+----------------------------------------+
| |
| +----------------------------------+ |
| | Open Source Core | |
| | Policy Engine, API, CLI, SDKs, | |
| | Web UI, Basic Auth | |
| +----------------------------------+ |
| |
+----------------------------------------+
The security model ensuring no side effects occur until approval.
+-------------+
| Inputs |
+-------------+
|
v
+-------------+
| Policy Gate |
| (no side |
| effects) |
+-------------+
|
+--> Deny --> Append-Only Log
|
v
+-------------+
| Approval |
| Required? |
+-------------+
|
+--> No --> Controlled Execution
|
v
+-------------+
| Human |
| Approval |
+-------------+
|
v
+-------------+
| Controlled |
| Execution |
+-------------+
|
v
+-------------+
| Append-Only|
| Log |
+-------------+
Faramesh is an execution gatekeeper for AI agents that intercepts tool calls before execution, evaluates them against configurable policies, requires human approval when necessary, and logs every decision for audit purposes.
Faramesh focuses specifically on governance and safety—it doesn't build agents, it governs them. It provides policy-driven control, risk scoring, and human-in-the-loop approval workflows that work with any agent framework.
No. Faramesh integrates via SDKs that wrap your existing tools. Your agents call the SDK instead of tools directly, and Faramesh handles the governance layer transparently.
See Govern Your Own Tool for a step-by-step tutorial on wrapping custom tools.
This depends on your integration pattern. The SDK can be configured to fail-open (allow actions) or fail-closed (deny actions) when Faramesh is unavailable. Production deployments should run Faramesh as a critical service with appropriate redundancy.
Yes. Faramesh Core is production-ready with PostgreSQL support, comprehensive APIs, web UI, and robust error handling. For enterprise features like SSO, RBAC, and advanced routing, consider Faramesh Nexus or Horizon.
Policies are YAML files that define rules evaluated in order (first-match-wins). Each rule can allow, deny, or require approval. If no rule matches, actions are denied by default (secure-by-default).
Policy rules determine the decision (allow/deny/require_approval). Risk scoring provides an independent assessment (low/medium/high) that can automatically upgrade decisions—for example, high-risk actions automatically require approval even if a policy would allow them.
Yes. Faramesh provides CLI tools and APIs that can be integrated into CI/CD workflows to govern automated actions and deployments.
Yes. Faramesh Horizon provides a fully-managed SaaS offering, and Faramesh Nexus provides enterprise on-prem deployments. See the Faramesh Cloud Products section above.
Faramesh supports SQLite (default, for development) and PostgreSQL (recommended for production). The database stores actions, events, and audit logs.
For automated workflows, you can configure policies to allow low-risk actions automatically while requiring approval for high-risk operations. You can also integrate with approval systems via the API or use Faramesh Nexus/Horizon for advanced routing.
Yes. All actions and events are stored in the database and can be exported via the API. Faramesh Nexus includes advanced audit export features with long-term retention.
Faramesh Core is available under the Elastic License 2.0. See the License section for details.