Skip to main content

mainspring-eval-online:线上评估闭环外挂(E3)

附件评估方案的线上三层落点。mainspring 是框架、没有生产流量,本外挂提供能力 + 示例, 真实数据由使用方接入——不虚构生产。

E3-1 逐轮安全分类器

生产里每一轮输入与输出都过一遍 TurnSafetyClassifier,抓「这一轮就出事」的问题:

类别 抓什么 特征来源
injection 越狱 / 注入话术 复用 core PromptInjectionGuardrail.DEFAULT_MARKERS(离线护栏与线上分类器同一口径)
leak 输出在复述系统提示 / 密钥 外挂内 DEFAULT_LEAK_MARKERS
policy 业务违规话术 部署方注入 policy_markers(不虚构业务规则)

毫秒级特征匹配、零额外 API——线上逐轮跑的前提是不比业务模型还贵。

装配(与用户代码同构,就是挂护栏)

from mainspring_eval_online import TurnSafetyClassifier, TurnSafetyGuardrail, TurnSafetyInputGuardrail

agent = Agent(
    ...,
    guardrails=[
        TurnSafetyInputGuardrail(TurnSafetyClassifier(policy_markers=("内部报价",))),
        TurnSafetyGuardrail(TurnSafetyClassifier(policy_markers=("内部报价",))),
    ],
)

命中即 GuardrailViolation,细节(category / marker / offset / severity)随 violation.details 落审计——告警后端自己接,外挂不强制绑定。

E3-2 抽样评分 + 失败反哺

见 sampling.py:1~5% 流量用离线同一套 rubric(judge)打分,低分走告警注入点, 失败 trace 一键转 case 反哺黄金集 / 边界集。

Metadata

Release files for mainspring-eval-online 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mainspring-eval-online 0.1.0
File Size Uploaded Provenance Actions
mainspring_eval_online-0.1.0.tar.gz 8.5 kB With provenance Details for mainspring_eval_online-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mainspring-eval-online 0.1.0
File Interpreter ABI Platform Actions
mainspring_eval_online-0.1.0-py3-none-any.whl Python 3 none any Details for mainspring_eval_online-0.1.0-py3-none-any.whl

Total release size: 19.7 kB

Release files / mainspring_eval_online-0.1.0.tar.gz

Download URL mainspring_eval_online-0.1.0.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
82d9641dd97edec772c2ee74deb7019d3eb4491af5a299c9ccd509a3716dc3a2
BLAKE2b-256 checksum
How to use checksums
b14b71044bef7745964cbafd859a66df2b7f68cf11b91e7b8f7fe4bf00cb296a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 6, 2026.

Transparency log

Release files / mainspring_eval_online-0.1.0-py3-none-any.whl

Download URL mainspring_eval_online-0.1.0-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
40e7bad365c3aa5d350caf797fa0f97dbf0c83be95733a2f55d2f2a93c0d3724
BLAKE2b-256 checksum
How to use checksums
2364cfab1fbb3b51f8309f74263686200d9bcf3623004de43901860553346456
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 6, 2026.

Transparency log

Security for mainspring-eval-online 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mainspring_eval_online-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page