RFC: Opt-in policy hook for AgentKit action execution (budget / risk providers like Cycles)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- python, typescript
調査の方向性
この issue では、ファイル、テスト、または実行エントリーポイントは指定されていません。まず TypeScript と Python のアクション実行パスをマッピングし、その後、議論に沿ってプロバイダー非依存のインターフェースとライフサイクルのセマンティクスについて合意します。デフォルトの動作を変更せずに、オプトインのフックが allow/deny と、アクション後または失敗時のオプションの処理をサポートすれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Language Implementation
- Python
- TypeScript
Feature Type
- Action Provider Template
- Wallet Provider Template
- Framework Extension
- Core Requirements
- Other
🚀 The feature, motivation and pitch
I’d like to propose an opt-in policy hook around AgentKit action execution so users can plug in pre-execution spend/risk controls without changing default behavior.
Problem
AgentKit is one of the clearest examples of an agent framework where action authority is the product: once an agent has wallet + action access, a bad loop or bad orchestration path can create real onchain spend or unwanted side effects quickly.
Today, users can compose their own controls outside AgentKit, but there does not appear to be a first-class, provider-agnostic hook for:
- pre-execution allow / deny decisions
- per-wallet / per-user / per-run / per-day budget checks
- optional post-action settlement / release
- structured policy/audit metadata around why an action was allowed or denied
That makes these controls ad hoc and harder to standardize across AgentKit integrations.
Proposal
Add an optional policy interface that wraps action execution.
High-level shape:
- Before an AgentKit action executes, AgentKit calls a policy provider with action context.
- The provider returns a decision such as
allowordeny(optionally with metadata / reason). - If the action executes successfully, AgentKit can call an optional post-execution hook.
- If the action fails or is aborted, AgentKit can call an optional failure/release hook.
This would let AgentKit users plug in:
- budget providers
- risk engines
- approval gates
- internal governance systems
- audit / observability enrichers
without changing AgentKit’s default behavior for users who do not enable it.
Desired properties
- Fully opt-in
- No default behavior change
- Provider-agnostic interface (not Cycles-specific)
- Small surface area
- Works with both wallet-backed and non-wallet actions
- Usable across TypeScript and Python implementations
Example shape
Pseudo-interface only to make the idea concrete:
TypeScript
type PolicyDecision =
| { decision: "allow"; metadata?: Record<string, string> }
| { decision: "deny"; reason: string; metadata?: Record<string, string> };
interface ActionPolicyProvider {
beforeAction(context: {
actionName: string;
walletAddress?: string;
network?: string;
args: unknown;
userId?: string;
sessionId?: string;
runId?: string;
}): Promise<PolicyDecision>;
afterAction?(context: unknown, result: unknown): Promise<void>;
onActionError?(context: unknown, error: unknown): Promise<void>;
}
Python
class ActionPolicyProvider(Protocol):
async def before_action(self, context) -> PolicyDecision: ...
async def after_action(self, context, result) -> None: ...
async def on_action_error(self, context, error) -> None: ...
Why this seems useful for AgentKit
This would let AgentKit support patterns like:
max onchain spend per wallet per day
max actions per user / agent / run
denylist/allowlist for high-risk actions
environment-aware policies (prod vs test)
externalized audit/governance
without baking any one policy model into core.
Concrete integration I’d be happy to contribute
I maintain Cycles (Apache 2.0), a reserve/commit runtime budget layer for agent execution. I’d be happy to contribute:
an initial policy hook abstraction
a minimal opt-in implementation path
docs/examples
a Cycles adapter as one example provider
But the main ask here is the core hook itself, not adoption of any one vendor/project.
Suggested rollout
Phase 1:
define minimal policy interface
wire it into action execution path
no behavior change unless configured
Phase 2:
docs + examples
one reference implementation / adapter
If this direction seems reasonable, I’m happy to open a draft PR after aligning on API shape here.
Alternatives
Copy/paste for “Alternatives”
Alternatives considered:
1. **Leave this entirely to application code**
- Works, but every team reinvents the same wrapper differently.
- Harder to standardize around action governance and audit semantics.
2. **Build this only in framework-specific extensions**
- Useful, but misses the core AgentKit action surface.
- Would fragment behavior across integrations.
3. **Bake one concrete budget/risk model directly into AgentKit**
- I do not think this is the right approach.
- A provider/hook abstraction seems cleaner and more future-proof than embedding one opinionated policy engine in core.
### Additional context
_No response_
- 主要言語
- TypeScript
- スター
- 1.3k
- フォーク
- 871
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
coinbase/agentkit のほかの issue
-
Python: Permit2 approval in CdpSmartWalletActionProvider.swap always reports failure (integer vs string receipt status)対応中かも @0xLittleDream が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
Moonwell redeem fails on Base Sepolia and uses 18 decimals for cbBTC対応中かも @sebxt が 5 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
coinbase/agentkit#1578 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
ERC20 transfer reports "Transferred" when the transaction reverts (receipt status ignored)対応中かも @AgenticFinanceGraph が 14 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
coinbase/agentkit#1558 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[TypeScript] `ViemWalletProvider` rejects a wallet client from a newer viem than the exactly pinned one (TS2345, `tokens` missing on `Client`)対応中かも @PrabalParihar が 5 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
coinbase/agentkit#1532 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
coinbase-agentkit 0.7.x fails on fresh install: imports solana.rpc.api, which solana>=0.37 removed対応中かも @JulienKervarrec が 33 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
coinbase/agentkit の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
outline/outline#14348 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
[Bug]: Agent import retains quotes in .env API keys followed by inline comments対応中かも @yxr-2025 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
elie222/rakazo#2322 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
awslabs/visual-asset-management-system#804 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
dsh-market/dsh-market#1027 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信