Agentrisk

io.github.trycoin-ai由 GitHub 帳號 trycoin-ai 發布v0.1.3更新於 Oct 24, 2026

Risk guardrails for AI trading agents. Your agent proposes; your policy decides.

已驗證STDIO僅桌面金融安全與監控

概覽

AI 產生的概覽

本機 MCP 伺服器,為 AI 交易代理提供投資組合風險分析、逐筆交易策略檢查和 YAML 風險策略管理。

可以做什麼
分析投資組合的集中度、曝險和策略遵循情況,以模擬成交後的組合進行評估。依你撰寫的策略檢查擬議交易,回傳 PASS、WARN 或 BLOCK 及一行原因。建立、更新或顯示可讀的 YAML 風險策略,涵蓋集中度上限、資產類別規則、訂單合理性、受限標的和資料品質。核心具確定性並採失敗即阻擋:無效輸入或缺少策略時阻擋,而非默默放行。
適用情境
當 AI 代理提出交易,而你希望用一份書面、可稽核的策略,在訂單送到券商前決定是否放行時使用。適合需要確定性護欄而非模型判斷,且能依回傳結論控制執行流程的使用者。
執行需求
透過 uvx 以 stdio 在本機執行(需要 uv),或作為 Claude Code 外掛安裝,同時註冊伺服器和可選的 Agent Skill。未宣告驗證、環境變數或標頭。核心程式庫不發出網路請求,也不使用 LLM。
安裝前請注意
它只提供建議,無法真正阻止下單;整合端必須在 BLOCK 時拒絕執行、在 WARN 時先顯示警告,否則它只是記錄器。PASS 僅表示交易未違反你寫的規則,不代表安全或獲利。策略是你自行撰寫和維護的 YAML,缺少策略時會阻擋。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Agentrisk,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

AgentRisk

[CI] [PyPI] [Python 3.10+] [License: MIT]

Risk guardrails for AI trading agents. Your agent proposes; your policy decides.

[AgentRisk in the terminal: create a risk policy, analyze portfolio exposure, and block an over-limit trade]

AgentRisk sits in front of trade execution: it analyzes portfolio risk, checks each proposed trade against a policy you write, and manages that policy. The core is deterministic (same inputs, same verdict), transparent (policies are plain YAML you can read and edit), and fail-closed (invalid input or a missing policy blocks, never a silent pass).

AgentRisk never recommends trades and never executes them. A PASS means a trade did not break the rules you wrote, not that it is safe or profitable. See DISCLAIMER.md.

Quickstart

The fastest path for a Claude agent is the Claude Code plugin. It installs the Agent Skill and registers the MCP server in one step (via uvx, so there is nothing else to install):

text
/plugin marketplace add trycoin-ai/agentrisk/plugin install agentrisk@agentrisk

For any other MCP client, register the server yourself:

json
{  "mcpServers": {    "agentrisk": {      "command": "uvx",      "args": ["--from", "agentrisk[mcp]", "agentrisk-mcp"]    }  }}

Then ask questions in plain English and the agent translates them into three tool calls:

ToolQuestion it answersReturns
analyze_portfolio_riskWhat risk am I holding?Concentration, exposure, and policy-compliance report
check_trade_riskShould this trade go through?PASS / WARN / BLOCK with a one-line reason
generate_risk_policyWhat are my rules?A human-readable YAML policy (create, update, show)

The plugin path needs uv for uvx. See examples/claude_desktop.md for a two-minute Claude Desktop setup.

Agent Skill

For Claude agents, AgentRisk ships an optional Agent Skill that encodes the discipline the guardrail depends on: before any order reaches a broker, classify the trade, call check_trade_risk, respect the verdict, and record the result, in that order. The plugin above installs it with the server. To install just the skill:

  • Claude Code or Claude Desktop: copy skills/agentrisk/ into ~/.claude/skills/.
  • claude.ai: upload skills/agentrisk/SKILL.md as a skill.

The enforcement contract

AgentRisk returns advice. It cannot physically stop an order, so your integration must gate execution on the verdict:

python
result = check_trade_risk(portfolio, trade)if not result.proceed:    refuse(result.summary)              # BLOCK: never call the brokerelif result.acknowledgements_required:    confirm_with_user(result)           # WARN: surface warnings firstelse:    execute(trade)                      # PASS

If you call the broker regardless of the verdict, you have a logger, not a guardrail. See the integration guide.

Using the library directly

The three tools are also a pure Python library, with no network calls and no LLM in the core:

bash
pip install agentrisk

Every parameter, return field, and error case is in the tool reference.

What it checks

  • Concentration caps on single names, sectors, themes, and asset classes, evaluated on the simulated post-trade portfolio.
  • Asset-class rules (allow, warn, or block) for crypto, options, and margin.
  • Order sanity: max order size, minimum cash floor, insufficient-funds detection.
  • Restricted symbols and data quality (stale snapshots warn, invalid ones block).

The policy reference covers every field and the safety behaviors: fail closed, exits are never trapped, only breach-worsening trades block, and the one-time bypass.

Documentation

DocContents
ConceptsThe mental model and the agent/AgentRisk division of labor
ArchitectureThe module layout and how a call flows through the core
Policy referenceEvery policy field and the check behavior it drives
Tool referenceParameters, outputs, and error cases for all three tools
CLI referenceThe agentrisk command: policy, check, analyze
Integration guideThe enforcement contract, broker MCP pairing, audit log
Threat modelWhat AgentRisk can and cannot protect against
Classification dataThe open taxonomy and how to contribute corrections

Roadmap

Next is deterministic stress scenarios, ETF look-through, and behavioral limits (v0.2), then options analytics, broker snapshot adapters, short positions, and multi-currency (v0.3). Trade recommendations, signals, execution, and telemetry are permanently out of scope. See the milestones.

Contributing

Classification-data corrections and new deterministic checks are especially welcome. See CONTRIBUTING.md, and keep the core pure: no network, no LLM calls, no hidden state.

License

MIT. See LICENSE.

來源:README.md,提交 7d8d84a

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

3
  1. v0.1.3最新Sep 28, 2026
  2. v0.1.2Sep 27, 2026
  3. v0.1.1Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分