RFC: Opt-in policy hook for AgentKit action execution (budget / risk providers like Cycles)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python, typescript
- Lĩnh vực
- backend-api-design, security
Hướng nghiên cứu
Issue không nêu tên các tệp, test hoặc điểm vào thực thi. Trước tiên, lập sơ đồ các đường dẫn thực thi action của TypeScript và Python, sau đó thống nhất về interface không phụ thuộc provider và ngữ nghĩa vòng đời theo phần thảo luận. Hoàn thành khi một hook opt-in hỗ trợ allow/deny và xử lý tùy chọn sau action hoặc khi thất bại mà không thay đổi hành vi mặc định.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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_
- Ngôn ngữ chính
- TypeScript
- Star
- 1.3k
- Fork
- 842
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của coinbase/agentkit
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
coinbase-agentkit 0.7.x fails on fresh install: imports solana.rpc.api, which solana>=0.37 removedCó thể đã có người làm @JulienKervarrec đã nhận 16 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Community Action Provider: Agent Safe paid_fetch, x402 payments where the model only picks the URLĐang mở
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 15/100
coinbase/agentkit#1544 · 6 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
coinbase/agentkit#1539 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của coinbase/agentkit
Issue tương tự
-
[Bug]: Server git tests sign fixture commits with the developer's key when run from the repo rootĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
melgarafael/DeskcommCRM#2657 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
MystenLabs/MemWal#1163 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Mondriaan
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
knaw-huc/textannoviz#709 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
billion-context-pi
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
ranxianglei/billion-context#2521 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày