failproofai README

项目的 README,来自 github.com/FailproofAI/failproofai。合并为一个 markdown 文件:README.md。

failproof ai

FailproofAI%2Ffailproofai | Trendshift FailproofAI%2Ffailproofai | Trendshift

npm CI Supply Chain Discord Reddit Docs License

Translations: 简体中文 · 日本語 · 한국어 · Español · Português · Deutsch · Français · Русский · हिन्दी · Türkçe · Tiếng Việt · Italiano · العربية · עברית

Ship agents that never fail.

Your agent ran rm -rf on the wrong directory. It read .env into its context. It spent forty minutes retrying the same broken call, then told you the task was done. Failproof lives in your agent's runtime and hears every hook event it fires: the session starting, every prompt, every tool call and its result, sub-agents spinning up, context about to be compacted, the moment it tries to stop. It can act on any of them: block the bad action before it executes, steer the agent mid-run, or send it back to work when it quits too early. Then it learns from every failure, so your agent's harness gets better with every run.

37% → 69% task success on failures a policy recognised. Same model, no fine-tuning (FIRE study)
~0.7 ms p50 per policy check, from a Rust daemon in the hot path
12 agent harnesses, one policy API: Claude Code, Codex, Cursor, Hermes, OpenClaw and more

Open source and free to start. Install the CLI, connect Failproof Cloud, and your first audit runs on your agents' real history.

Failproof AI in action


Supported harnesses

Twelve harnesses in two classes: ten coding CLIs, and two chat and assistant gateways (Hermes, OpenClaw).

Building your own agent, on any framework or none? Report its runs through the Python SDK or the TypeScript SDK, which give you tracing, sessions, evaluations and audits. Enforcement there needs a hook in your own runtime. Talk to us and we'll map it.

Claude Code OpenAI Codex GitHub Copilot Cursor Agent OpenCode Pi
Hermes OpenClaw Factory Droid Devin CLI Antigravity CLI Goose

Get started: find where your agents fail, then stop it

npm install -g failproofai
failproofai config                # hook your agents, connect to Failproof Cloud (free)
failproofai backfill --since 7d   # bring in the last week of runs already on disk
  1. Connect. failproofai config finds every agent on this machine, hooks into each one, starts the background daemon, and signs you in to Failproof Cloud in your browser. No account yet? Make one right there, on the free plan.
  2. Backfill. Your agents have been running for weeks, and that history is already on this machine. failproofai backfill --since 7d sends the last seven days (for supported harnesses), so you start with real evidence instead of an empty dashboard.
  3. Audit. The moment runs land, Cloud starts your first audit on its own. It reads your sessions, clusters what went wrong into named failure modes, and turns each one into an insight, with the sessions that prove it. The free plan includes audits every month.
  4. Plug in policies built for your agents. Open an insight and hit prevent this →. Failproof drafts a policy for that exact failure and tests it against your agents' own past tool calls. You then roll it out to every machine, watching first or enforcing straight away.

Setting up CI, a container, or letting an agent run the install? failproofai config notices there's no one to ask and applies the defaults without prompting.


One policy, every harness

Every harness speaks its own dialect:

Failproof translates all of it:

So a policy written once against Bash blocks the same command in Claude Code, Codex, Hermes and Goose. A "run the tests before you stop" gate sends the agent back to work on every harness that has a turn-end hook.

Each contract is verified against that CLI and pinned, with what it was verified on, in a capability matrix the test suite checks every claim against. Blocking before a tool runs is verified on all twelve harnesses; turn-end gates on eight. The per-harness matrix shows exactly which events each one honours.


Policies, written for your agents

A policy can listen to any of those events. Before a tool call, it can block the command outright. When a prompt arrives, it can add context. When the agent tries to stop, it can send it back to finish the job. Whatever it decides, the agent is told why. There are two kinds of policy, and you can mix them:

You don't have to write either. Failproof authors them for you. Open an insight in Cloud and hit prevent this →, or describe the rule in a sentence. Failproof drafts the policy, tests it against your agents' own past tool calls, and rolls it out to every machine, observing first or enforcing straight away.

A few examples of what a policy can catch, and what it does about it:

Example What it catches Does
block-env-files Reads of .env and other secret files Blocks
block-kubectl Unreviewed changes to live infrastructure Blocks
warn-destructive-sql DROP, TRUNCATE, an unbounded DELETE Warns the agent and lets it decide
warn-repeated-tool-calls The agent looping on the same failing call Warns the agent to change approach
no-refunds-over-limit (yours) A support agent approving a refund it isn't allowed to Whatever you decide
no-production-writes (yours) File writes and edits to production paths (the code below; shell commands aren't checked) Blocks

Prefer to write one yourself? Save it in .failproofai/policies/ as, say, no-production-writes-policies.mjs and it loads automatically (naming rules). Commit it, and every teammate whose agents run Failproof gets it on their next pull.

import { customPolicies, deny, allow } from "failproofai";

customPolicies.add({
  name: "no-production-writes",
  match: { events: ["PreToolUse"] },
  fn: async (ctx) => {
    if (!["Write", "Edit"].includes(ctx.toolName ?? "")) return allow();
    if (ctx.toolInput?.file_path?.includes("production"))
      return deny("Writes to production paths are blocked.");
    return allow();
  },
});

Every policy returns one of three decisions: allow(), deny(message), or instruct(message). The last is the quiet superpower. Instead of crashing the agent into a wall, it steers it ("run the tests before you stop", "use the staging database") and the agent corrects course on its own.

→ Write a policy · Decision-model policies · More examples


Built for agents that run on their own

A check that costs nothing can run on every event, all the time. That's what lets you hand an agent more autonomy, not less:


Failproof Cloud: a harness that improves itself

Generic guardrails are written for everyone's agent. Failproof Cloud is built for yours, from your agent's own traces, whether you run one agent or a hundred.

Every run feeds a loop that makes the harness around your agent better:

  1. Trace. Every prompt, model call, tool call and result, live and replayable, with parallel sub-agents on their own lanes, latency, cost and context windows, and SQL over all of it.
  2. Audit. Audits read your sessions on a schedule and cluster what went wrong into named failure modes: the loops, wrong tools and quiet give-ups that are specific to your agent. Each one becomes an insight, backed by the sessions that prove it.
  3. Check. Turn an insight into an eval and every new session is scored for it, by code, the decision model, an LLM judge or an agent. When the failure comes back, alerts reach you on Slack, email or a signed webhook.
  4. Fix. Hit prevent this → and Failproof writes the policy for that exact failure. It tests the policy against your agent's past tool calls, then rolls it out, observing first or enforcing right away.
  5. Repeat. The next audit runs on traces where that failure can't happen any more, and finds the next one.

The model never changes. The harness around it learns from every failure. It's the idea behind our FIRE study, where policies derived from an agent's failures took task success from 37% to 69% on the failures they recognised. Same model, no fine-tuning.

"The audits are the part that changed how we operate. We now have fewer incidents, less compute waste, and faster shipping." — Pratheep Velicherla, CTO, Testsigma

Ask the failproof agent anything about your agent in plain English, or pull the same data into your own tools through the MCP server, Slack and the fp CLI.

Start with one agent on the free plan: 5,000 runs a month, no card. Self-hosting in your own cluster is available on the Enterprise plan.

→ Start free · Pricing · Quickstart · Book a demo


Documentation

Start
Quickstart Install, connect a harness, see the first run
Concepts How the hook system works
Supported harnesses All 12, and what each one can enforce
Observe
Sessions Follow a run: models, tools, errors, latency
Read a trace What the execution graph is telling you
Audits Find failure patterns across many sessions
Evaluations Score every session with code, the decision model or an LLM judge
Enforce
Write a policy From an insight, from a sentence, or in code
Decision-model policies Jev judges calls against what the user asked
Configuration Config scopes, merge rules and policy parameters
Instrument your own agent
Python SDK Report runs from an agent with no harness
TypeScript SDK The same events from a Node agent
Policy SDK allow / deny / instruct reference

License

MIT with Commons Clause — free for internal and personal use; commercial resale of failproofai itself requires a separate agreement. See LICENSE for the full text.


Contributing

See CONTRIBUTING.md. New policies, edge cases, and translations all welcome.


Built with ❤️ by befailproof.ai in SF and Bengaluru.

failproofai (FailproofAI/failproofai)

正在搜索数据库…

这是干什么用的?Failproof AI 是一个可观测性和执行管控层,内嵌在 AI 代理 harness 里(编码类 CLI、聊天网关、自托管助手),记录每一次运行,并在危险工具调用执行之前拦截它们。
它是命令行工具还是托管的网页面板?它主要是一个本地 CLI/npm 包,接入你的 agent harness,以零额外延迟运行策略;它还会在 localhost:8020 提供一个本地网页面板。另外还有一个独立的托管产品 'Failproof AI Observability',面向在多台机器上跑代理的团队。
怎么把它跑起来?先运行安装命令把钩子接入你的 harness(此时不会启用任何策略),然后再单独添加一个策略包。在没有终端的 CI 或容器里,failproofai config 会自动应用默认配置,而不是交互式提问。
支持哪些编码代理和 harness?共十二种 harness,分两类:十个编码类 CLI(比如 Claude Code 和 Codex),加两个聊天/助手网关(Hermes 和 OpenClaw),它们共用同一套策略 API 和同一条会话历史。
拦截功能在每种 harness 上都一样吗?在工具调用执行前进行拦截,这一点在全部十二种 harness 上都经过验证;但回合结束时的门禁只在其中八种上有效。在这十二种 harness 之外运行的代理,需要用 Python SDK 才能做追踪,而且要实现拦截就得自己给运行时挂钩子。
我的运行数据会离开我的电脑吗?不会 —— 本地面板读取的是已经存在你机器上的运行记录,不需要账号或注册;除非你主动选择使用托管的 Observability 产品,否则任何数据都不会离开你的电脑。
许可证条款是什么?采用 MIT 加 Commons Clause:内部使用和个人使用免费,但对 failproofai 本身进行商业转售需要另外签订协议。
在我做任何配置之前,常开策略就已经拦截什么了?block-failproofai-commands 是唯一一条始终启用、无法禁用也无法暂停的策略,目的就是防止代理用它把其他所有策略都关掉。
怎么写自定义策略?把文件放进 .failproofai/policies/ 文件夹即可,不需要任何参数就会自动加载;提交到代码库后,团队其他人在下次 pull 时就能拿到。策略返回 allow()、deny(message) 或 instruct(message),分别表示放行、拦截或引导代理。
开箱即用能拦住哪些危险操作?40 条内置策略包括:拦截读取 .env 等机密文件、sudo 提权、递归 rm -rf、未经审查的 terraform/kubectl 变更、向 main 强制推送,以及对破坏性 SQL 或重复的工具调用循环给出警告。
托管的 Observability 产品比免费的本地面板多了什么?它把团队里每种 harness 的每次运行汇总在一起,提供并行的子代理执行图、p50/p95/p99 延迟、按模型统计的成本、对追踪数据跑 SQL、定期审计,以及推送到 Slack、邮件或 webhook 的告警;在企业版(Enterprise)方案下还可以自托管到你自己的集群里。
大小
102.3 MB
星标
9.8K
时长
7个月
提交 · 90 天