Skip to main content
Glama
Dvarapala

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)を発生させます — それをキャッチして、 モデルに別のことを再試行させます。

サーフェス

サーフェス

インポート

任意の同期/非同期関数用デコレータ

dvarapala.Gate

HTTPツールエンドポイント用ASGIミドルウェア

from dvarapala.middleware import ASGIGateMiddleware

MCPサーバーツールハンドラ

from dvarapala.mcp import gated_tool

CLI

dvarapala verify audit.jsonl · dvarapala tail -n 20 audit.jsonl

設計ルール

  • 標準ライブラリのみのコア。 依存関係はありません。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 を参照してください。

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    Local zero-trust permission gateway for AI agents. Enforces policy-based tool authorization, human approvals, scoped permissions, and cryptographically verifiable audit logs.
    4
    58 PyPI
    5
    Apache 2.0
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables 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
    -
  • A
    license
    Not graded
    quality
    A
    maintenance
    Tamper-evident audit trail for AI agent tool calls. Cryptographically signed, hash-chained records that prove what your agents did.
    3
    19 npm
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    Gates 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.
    4
    529 PyPI
    15
    AGPL 3.0