SuperAPIAI Directory

toolwrit

github.com · AI agents

Toolwrit is a tool-call authorization and audit library for AI agents, and also provides a sidecar runtime. It uses policy files to establish allowlists, budget caps, and rate limits for tool calls, and writes every allow, deny, or ask decision to a verifiable hash-chain audit log. It does not act as a gateway; traffic does not leave your own infrastructure. You can wrap tool handler functions in three lines of code, or use the command line to apply policies in front of an existing MCP server. Supports Node.js 20+ and Python 3.10+, licensed under Apache-2.0.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)

About this tool

Toolwrit is a tool-call authorization and auditing tool for AI agents, positioned as a library and sidecar rather than a gateway. Its core idea: if an agent has tools, it has the permissions those tools possess; prompt-level guardrails are only suggestions and cannot truly constrain the model. Therefore checks must be enforced outside the model, so every tool call goes through indisputable rule-based judgment and leaves a record.

Purpose and main capabilities

  • Policy authorization: define tool allowlists, parameter constraints, and effect precedence (deny over ask, ask over allow) via policy files, denying unknown tools or parameters not accepted by rules by default.
  • Budgets and rate limits: support run-level budgets across five dimensions: calls, tokens, usd, bytes, seconds, plus rule-based rate limits. Once budget is exhausted, deny all calls.
  • Audit chain: every allow, deny, or ask decision is appended to a JSONL hash chain containing the previous hash, verifiable offline, replayable, and archivable.
  • Plan envelope: declare a budget envelope before a run and have it approved once by a human, as the first record in the audit chain; execution then follows that envelope, alerting or denying when exceeded.
  • Alert thresholds: warnAt triggers by budget proportion, at most once per dimension per threshold; alerts are written to the audit chain.
  • Byte cap: limits total bytes returned by tools, used to detect bulk exfiltration from repeatedly executing an allowed action, but measurement occurs after the call, so the cap is exceeded by at most one call's worth.
  • MCP proxy: use toolwrit run --policy toolwrit.yaml -- to put policy in front of an existing MCP server without changing application code; denials are returned as MCP tool errors, and the model can read the reason and adjust.
  • CI check: the check command asserts in CI which calls a policy must deny, preventing allowlists from regressing toward permissiveness.

Usage

  • After installation, you get a binary named toolwrit. The Node package and Python port use the same policy language and write compatible audit chains; the Python version must be installed from the repository before it enters PyPI.
  • Code integration: wrap the location where tool calls are originally executed with guard; guard evaluates the call, writes the audit chain, and only then calls the handler; on denial it throws ToolwritDenied instead of silently skipping side effects.
  • Metering: tokens and usd require explicit calls to meter() and spend() to record them in the ledger; calls and bytes are automatically counted by guard.
  • MCP integration: in the MCP client configuration or shell, place toolwrit run in front of the server process; all tools/call crossing the boundary are enforced according to policy.

Use cases and limitations Suitable for development and operations scenarios requiring permission boundaries, budget control, and auditable records for AI agent tool calls, especially teams that already have MCP servers and want to add a policy layer without changing the traffic path. Limitations include: it does not count tokens or costs of the model calls themselves and requires explicit metering; the bytes cap is measured after the call, so it cannot prevent a single oversized response; non-serializable results undercount bytes; unknown top-level keys in the policy cause loading to fail; ask rules are treated as deny when onAsk is not configured.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools