sriram1983007 commited on
Commit
372f0e7
ยท
verified ยท
1 Parent(s): 863d690

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +66 -8
README.md CHANGED
@@ -19,6 +19,7 @@ tags:
19
  - disputes
20
  - refunds
21
  - agents
 
22
  - trl
23
  - web3
24
  - usdc
@@ -29,10 +30,10 @@ tags:
29
  - text-generation
30
  ---
31
 
32
- # ๐Ÿ›ก๏ธ SRA-RiskGate-4B
33
 
34
  [![PyPI Version](https://img.shields.io/pypi/v/sra-riskgate?style=for-the-badge&logo=pypi&color=blue)](https://pypi.org/project/sra-riskgate/)
35
- [![PyPI Downloads](https://img.shields.io/pypi/dm/sra-riskgate?style=for-the-badge&logo=pypi&color=orange)](https://pypi.org/project/sra-riskgate/)
36
  [![Interactive Demo](https://img.shields.io/badge/Demo-Interactive%20Space-blue?style=for-the-badge&logo=huggingface)](https://sriram1983007-sra-riskgate-demo.static.hf.space/index.html)
37
  [![Dataset](https://img.shields.io/badge/Dataset-Risk%20Bench-green?style=for-the-badge&logo=huggingface)](https://huggingface.co/datasets/sriram1983007/sra-stablecoin-risk-bench)
38
  [![GGUF Quantized](https://img.shields.io/badge/GGUF-Q4__K__M-yellow?style=for-the-badge&logo=huggingface)](https://huggingface.co/sriram1983007/SRA-RiskGate-4B-Q4_K_M-GGUF)
@@ -47,6 +48,57 @@ It is engineered for both ends of a stablecoin payment's operational lifecycle:
47
 
48
  ---
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  ## ๐Ÿš€ Transformers Quickstart
51
 
52
  The model expects the standard ChatML template and outputs strict JSON conforming to the [sra-stablecoin-risk-bench](https://huggingface.co/datasets/sriram1983007/sra-stablecoin-risk-bench) schema:
@@ -163,6 +215,7 @@ with torch.no_grad():
163
 
164
  response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
165
  print(json.dumps(json.loads(response), indent=2))
 
166
  ```
167
 
168
  ### Output Schema (`risk_gate`)
@@ -181,6 +234,7 @@ print(json.dumps(json.loads(response), indent=2))
181
  "obtain_attestation_from_trusted_attester"
182
  ]
183
  }
 
184
  ```
185
 
186
  ---
@@ -191,6 +245,7 @@ The `sra-riskgate` SDK provides zero-latency deterministic pre-filtering rules (
191
 
192
  ```bash
193
  pip install --upgrade sra-riskgate
 
194
  ```
195
 
196
  ```python
@@ -208,11 +263,12 @@ tx = TransactionPayload(
208
  )
209
 
210
  verdict = gate.inspect(tx)
211
- print("Decision: ", verdict.decision.value) # hold
212
- print("Risk Score: ", verdict.risk_score) # 0.65
213
- print("Flags: ", verdict.flags) # ['MODERATE_DEPEG']
214
- print("Required Actions:", verdict.required_actions) # ['manual_review']
215
- print("Explanation: ", verdict.explanation)
 
216
  ```
217
 
218
  ---
@@ -223,11 +279,13 @@ Run locally via Ollama with greedy sampling (`temperature 0.0`) to ensure valid
223
 
224
  ```bash
225
  ollama run sriram1983007/sra-riskgate
 
226
  ```
227
 
228
  *Note: Ensure `temperature 0.0` is configured in your `Modelfile`.*
229
 
230
  ---
 
231
  ## ๐Ÿ“Š Benchmark Evaluation (Held-Out Test Split)
232
 
233
  Evaluated against the 2,000-case test set in [`sra-stablecoin-risk-bench`](https://huggingface.co/datasets/sriram1983007/sra-stablecoin-risk-bench) using `score.py`:
@@ -252,4 +310,4 @@ Evaluated against the 2,000-case test set in [`sra-stablecoin-risk-bench`](https
252
 
253
  ## โš–๏ธ License
254
 
255
- Distributed under the Apache 2.0 License.
 
19
  - disputes
20
  - refunds
21
  - agents
22
+ - agentkit
23
  - trl
24
  - web3
25
  - usdc
 
30
  - text-generation
31
  ---
32
 
33
+ # ๐Ÿ›ก๏ธ๏ธ SRA-RiskGate-4B
34
 
35
  [![PyPI Version](https://img.shields.io/pypi/v/sra-riskgate?style=for-the-badge&logo=pypi&color=blue)](https://pypi.org/project/sra-riskgate/)
36
+ [![PyPI Downloads](https://img.shields.io/pypi/dm/sra-riskgate?style=for-the-badge&logo=orange)](https://pypi.org/project/sra-riskgate/)
37
  [![Interactive Demo](https://img.shields.io/badge/Demo-Interactive%20Space-blue?style=for-the-badge&logo=huggingface)](https://sriram1983007-sra-riskgate-demo.static.hf.space/index.html)
38
  [![Dataset](https://img.shields.io/badge/Dataset-Risk%20Bench-green?style=for-the-badge&logo=huggingface)](https://huggingface.co/datasets/sriram1983007/sra-stablecoin-risk-bench)
39
  [![GGUF Quantized](https://img.shields.io/badge/GGUF-Q4__K__M-yellow?style=for-the-badge&logo=huggingface)](https://huggingface.co/sriram1983007/SRA-RiskGate-4B-Q4_K_M-GGUF)
 
48
 
49
  ---
50
 
51
+ ## ๐Ÿค– Autonomous Agent Firewall (Coinbase AgentKit Integration)
52
+
53
+ Autonomous on-chain agents can hallucinate payment transfers, sign malformed calldata, or trigger catastrophic transactions during market depegs.
54
+
55
+ The deterministic pre-filter and policy firewall is available directly as a plug-and-play **Action Provider** for the [Coinbase AgentKit](https://github.com/coinbase/agentkit) framework:
56
+
57
+ ```bash
58
+ pip install "sra-riskgate[agentkit]>=0.3.3"
59
+
60
+ ```
61
+
62
+ ### Drop-in Agent Firewall Example
63
+
64
+ Add `RiskGateActionProvider` to intercept and gate transaction attempts before wallet signing:
65
+
66
+ ```python
67
+ from coinbase_agentkit import AgentKit, CdpWalletProvider, CdpWalletProviderConfig
68
+ from sra_riskgate.integrations.agentkit import RiskGateActionProvider
69
+
70
+ # 1. Initialize your wallet provider
71
+ wallet_provider = CdpWalletProvider(CdpWalletProviderConfig())
72
+
73
+ # 2. Wrap agent execution with the deterministic RiskGate firewall
74
+ agentkit = AgentKit(
75
+ ActionProviderOptions(
76
+ wallet_provider=wallet_provider,
77
+ action_providers=[
78
+ RiskGateActionProvider(
79
+ max_amount=1000.0, # Ceiling per transaction (USDC)
80
+ depeg_hold_pct=1.0, # Triggers manual review if depeg >= 1%
81
+ depeg_reject_pct=5.0 # Hard aborts execution if depeg >= 5%
82
+ )
83
+ ]
84
+ )
85
+ )
86
+
87
+ ```
88
+
89
+ ### Deterministic Risk Enforcement
90
+
91
+ Every payment action triggered by the LLM is intercepted and validated against strict financial safety boundaries:
92
+
93
+ | Check | Action Taken | Why It Matters |
94
+ | --- | --- | --- |
95
+ | **Invalid / Zero Address** | Hard Reject | Aborts `0x0...0` burner or malformed hex executions |
96
+ | **Self-Transfer** | Hard Reject | Blocks recursive/hallucinated self-loops draining gas |
97
+ | **Exceeds Amount Ceiling** | Paused (HOLD) | Intercepts rogue agent spending beyond allocated policy |
98
+ | **Severe Depeg ($\ge 5\%$)** | Critical Abort | Prevents clearing payments in collapsing or compromised assets |
99
+
100
+ ---
101
+
102
  ## ๐Ÿš€ Transformers Quickstart
103
 
104
  The model expects the standard ChatML template and outputs strict JSON conforming to the [sra-stablecoin-risk-bench](https://huggingface.co/datasets/sriram1983007/sra-stablecoin-risk-bench) schema:
 
215
 
216
  response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
217
  print(json.dumps(json.loads(response), indent=2))
218
+
219
  ```
220
 
221
  ### Output Schema (`risk_gate`)
 
234
  "obtain_attestation_from_trusted_attester"
235
  ]
236
  }
237
+
238
  ```
239
 
240
  ---
 
245
 
246
  ```bash
247
  pip install --upgrade sra-riskgate
248
+
249
  ```
250
 
251
  ```python
 
263
  )
264
 
265
  verdict = gate.inspect(tx)
266
+ print("Decision: ", verdict.decision.value) # hold
267
+ print("Risk Score: ", verdict.risk_score) # 0.65
268
+ print("Flags: ", verdict.flags) # ['MODERATE_DEPEG']
269
+ print("Required Actions:", verdict.required_actions) # ['manual_review']
270
+ print("Explanation: ", verdict.explanation)
271
+
272
  ```
273
 
274
  ---
 
279
 
280
  ```bash
281
  ollama run sriram1983007/sra-riskgate
282
+
283
  ```
284
 
285
  *Note: Ensure `temperature 0.0` is configured in your `Modelfile`.*
286
 
287
  ---
288
+
289
  ## ๐Ÿ“Š Benchmark Evaluation (Held-Out Test Split)
290
 
291
  Evaluated against the 2,000-case test set in [`sra-stablecoin-risk-bench`](https://huggingface.co/datasets/sriram1983007/sra-stablecoin-risk-bench) using `score.py`:
 
310
 
311
  ## โš–๏ธ License
312
 
313
+ Distributed under the Apache 2.0 License.