
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.
概览
本地 MCP 服务器,为 AI 交易代理提供投资组合风险分析、逐笔交易策略校验和 YAML 风险策略管理。
- 可以做什么
- 分析投资组合的集中度、敞口和策略合规情况,基于模拟成交后的组合进行评估。按你编写的策略校验拟议交易,返回 PASS、WARN 或 BLOCK 及一行原因。创建、更新或展示可读的 YAML 风险策略,涵盖集中度上限、资产类别规则、订单合理性、受限标的和数据质量。核心是确定性的并采用失败即拦截:无效输入或缺少策略时拦截,而非静默放行。
- 适用场景
- 当 AI 代理提出交易,而你希望用一份书面、可审计的策略在订单到达券商前决定是否放行时使用。适合需要确定性护栏而非模型判断、并能依据返回结论控制执行流程的用户。
- 运行要求
- 通过 uvx 以 stdio 在本地运行(需要 uv),或作为 Claude Code 插件安装,同时注册服务器和可选的 Agent Skill。未声明认证、环境变量或请求头。核心库不发起网络请求,也不使用 LLM。
安装
在 SourceWeft 中
- 打开 控制台中的 Agentrisk,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
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 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
PASSmeans 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):
For any other MCP client, register the server yourself:
Then ask questions in plain English and the agent translates them into three tool calls:
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.mdas a skill.
The enforcement contract
AgentRisk returns advice. It cannot physically stop an order, so your integration must gate execution on the verdict:
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:
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
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版本历史
3- v0.1.3最新Sep 28, 2026
- v0.1.2Sep 27, 2026
- v0.1.1Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分