Dvarapala
Dvarapala
AIエージェントとMCPサーバーのための権限ゲート+改ざん防止監査ログ。3行で追加できます。
エージェントはツールを実行し、コマンドを走らせ、お金を動かします。何かがうまくいかなかったとき、 答えるべき2つの質問があります:それは許可されるべきだったのか? そして 実行は正確にどこで失敗したのか? Dvarapalaはその両方に答えます — 事前 (ゲーティング)と事後(監査)— 依存関係ゼロで。
import dvarapala
gate = dvarapala.Gate(policy="policy.json", audit="audit.jsonl")
@gate(risk="critical")
def refund(customer_id: str, amount_cents: int):
... # nothing runs unless policy + consent approve; every decision is hash-chainedなぜ
Gate(事前): 宣言的ポリシー(
allow/warn/confirm/deny)、 ヒューリスティックなリスクスコアリング、同意ラダー(1回 / セッション / 常に)、キルスイッチ、 レートリミッター。Audit(実行中→実行後): 各レコードにSHA-256チェーンを持つ追記専用JSONL。 履歴の編集や削除は検証を壊します:
dvarapala verify audit.jsonl。最初から因果関係フィールド: すべてのレコードは
run_id、step、parent_step、context_refs、alternatives_considered、state_deltaを保持するため、 「エージェントはなぜそんなことをしたのか?」という帰属を、計装し直すことなく その上に構築できます。
Related MCP server: enterprise-agent-lab
30秒ツアー
gate = dvarapala.Gate(
policy={
"rules": [
{"id": "reads-free", "match": {"tool": "read_*"}, "effect": "allow"},
{"id": "refunds-human","match": {"tool": "refund"}, "effect": "confirm"},
{"id": "no-drop", "match": {"keywords": ["drop table"]}, "effect": "deny"},
]
},
audit=".dvara/audit.jsonl",
)エージェントループ内で呼び出しが どこで 発生するかに注釈を付けます:
with dvarapala.step(run_id="r1", step_no=17,
alternatives_considered=["cancel_order"]):
refund("c1", 5000) # audited with step=17, alternatives recorded拒否された呼び出しは dvarapala.Denied(PermissionError)を発生させます — それをキャッチして、
モデルに別のことを再試行させます。
サーフェス
サーフェス | インポート |
任意の同期/非同期関数用デコレータ |
|
HTTPツールエンドポイント用ASGIミドルウェア |
|
MCPサーバーツールハンドラ |
|
CLI |
|
設計ルール
標準ライブラリのみのコア。 依存関係はありません。YAMLポリシーはオプションの追加機能です。
拒否安全なデフォルト。 非対話セッションはプロンプトを表示せずに拒否します。 不明なシェルコマンドはMEDIUMと評価され、破壊的トークンはCRITICALと評価されます。
ログは証拠です。 チェーン検証は1コマンドで完了し、サーバーは不要です。
ステータス
v0.1.0(アルファ)。ゲートと監査のコアは安定しています。アダプターと
障害帰属レイヤー(why did step 24 fail because of step 6?)は
ロードマップにあります。MITライセンス。コントリビューションを歓迎します。
インストール
pip install dvarapala # core, stdlib-only
pip install dvarapala[yaml] # + YAML policy support
pip install dvarapala[dev] # + pytest/ruffライセンス
MIT — LICENSE を参照してください。
This server cannot be deployed
Maintenance
Related MCP Connectors
Runtime permission, approval, and audit layer for AI agent tool execution.
Context and control for any AI. Agent identity, scoped access, and proof across tools.
See, price, and control every tool call your AI agents make: policy checks, cost, and audit tools.
Pre-execution governance for AI agents. Deterministic PASS/FAIL/REVIEW verdicts, replayable proof.
Related MCP Servers
- AlicenseAqualityBmaintenanceLocal zero-trust permission gateway for AI agents. Enforces policy-based tool authorization, human approvals, scoped permissions, and cryptographically verifiable audit logs.458 PyPI5Apache 2.0
- FlicenseNot gradedqualityCmaintenanceEnables controlled AI-agent access to enterprise-shaped tools with a deny-by-default gated write path, human approval, dry-run execution, and append-only audit logging.1-
- AlicenseNot gradedqualityAmaintenanceTamper-evident audit trail for AI agent tool calls. Cryptographically signed, hash-chained records that prove what your agents did.319 npmMIT
- AlicenseAqualityAmaintenanceGates every AI agent tool call against your policy before it runs, then writes a hash-chained, tamper-evident record of what was decided and what happened. Anyone can verify that record offline, without your software, your systems or any key you hold.4529 PyPI15AGPL 3.0