Feature Request: Native Token Metering & Bounded Overshoot (x402 Protocol)
Maintainer thường phản hồi trong vòng 2 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
- Cần làm rõ
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- csharp, javascript
- Lĩnh vực
- backend-api-design, payments, security
Hướng nghiên cứu
Không có tệp, bài kiểm thử hoặc điểm vào cụ thể nào được nêu. Hãy bắt đầu bằng việc đọc lớp định tuyến của framework, issue #3229 của upstream modelcontextprotocol và SDK tham chiếu @neuforge/pay-js; để được xem là hoàn tất, cần có phạm vi tích hợp x402 native được thống nhất, hành vi vượt quá có giới hạn và cách xử lý compliance.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Context
As enterprise adoption of this framework accelerates, developers are increasingly hitting the "Margin Leak" problem: autonomous agents entering loops and aggressively polling paid LLM resources without proactive financial guardrails.
Currently, developers must build bespoke token-counting wrappers around the LLM calls. If a loop occurs, the API bill skyrockets before the framework can halt it.
Proposal: Adopt the x402 Protocol
We recently authored V2 of the x402 Native Token Metering Protocol upstream in the core modelcontextprotocol repository (Issue #3229).
We propose adding native support for x402 token metering and Bounded Overshoot directly into the framework's routing layer.
How it works (Bounded Overshoot)
Instead of pre-flight token math (which leads to false refusals), the framework passes requests through a meter. If the budget is exceeded, the request returns a standardized -4020 Payment Required error, and the agent safely halts.
Visual Demonstration:
🔥 Margin Leak Simulator Running...
=============================================
🚨 SCENARIO 1: UNPROTECTED AGENT (Status Quo)
=============================================
[Unprotected] Call 1 | Cost: $0.05 | Agent continues looping blindly...
[Unprotected] Call 5 | Cost: $0.25 | Agent continues looping blindly...
[Unprotected] Call 10| Cost: $0.50 | Agent continues looping blindly...
❌ DISASTER: Agent burned $0.50 and is still looping!
=============================================
🛡️ SCENARIO 2: PROTECTED AGENT (x402 Protocol)
=============================================
[Protected] Call 1 | Cost: $0.05 | LLM Call Success.
[Protected] Call 2 | Cost: $0.10 | LLM Call Success.
[Protected] Call 3 | Cost: $0.15 | LLM Call Success.
[Protected] Call 4 | Cost: $0.20 | LLM Call Success.
[x402 Firewall] Call 5 INTERCEPTED! HTTP 402 Payment Required.
✅ SUCCESS: Agent safely halted before catastrophic margin leak.
--> Remaining Budget: $0.00
Compliance (HTTP 451)
Enterprise environments also require strict KYC/Sanctions checks. The x402 spec natively supports returning HTTP 451 (Unavailable For Legal Reasons) if a destination wallet or tool is flagged, preventing the agent from transacting with sanctioned entities.
Reference Implementation
Our team maintains the @neuforge/pay-js SDK which handles the Stripe/Fiat bridging for this exact protocol. We would love to collaborate on submitting a PR to integrate this standard routing logic natively here.
Would the maintainers be open to standardizing this guardrail?
- Ngôn ngữ chính
- C#
- Star
- 28.6k
- Fork
- 4.8k
- Merge trung bình
- 13 giờ 24 phút
- Pull request đã merge (30 ngày)
- 11
Chuẩn bị môi trường
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 microsoft/semantic-kernel
-
python triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
microsoft/semantic-kernel#14491 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
python triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
microsoft/semantic-kernel#14490 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Python: [Python] structured_outputs_transform reuses ChatHistory across calls (prompt pollution)Đang mởpython triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
microsoft/semantic-kernel#14483 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
.NET python triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
microsoft/semantic-kernel#14482 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Python: [Python] as_agent_framework_tool drops parameter defaults (optionals become required)Đang mởpython triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
microsoft/semantic-kernel#14481 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của microsoft/semantic-kernel
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
NethermindEth/nethermind#14012 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
dependencies Status: Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
json-schema-org/website#2518 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agentic-workflows
Độ 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 68/100
builtbybel/Flyoobe#498 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
builtbybel/CrapFixer#112 ·