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.2

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.2
File Size Uploaded Provenance Actions
mainspring_eval_online-0.1.2.tar.gz 8.5 kB With provenance Details for mainspring_eval_online-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 19.7 kB

Release files / mainspring_eval_online-0.1.2.tar.gz

Download URL mainspring_eval_online-0.1.2.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
29cef8599d839e51b7c3c8a8eba7afbb2c0a8f9b7b82797c7b2df20a65713615
BLAKE2b-256 checksum
How to use checksums
72ae54ddd613791d20a7d68431096a631c4f75a3f1a4f250c881c4b2785ae05d
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.2-py3-none-any.whl

Download URL mainspring_eval_online-0.1.2-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b2f124dcfe9ab5756d12cb066a4519656ca45e68bd5cafcd5afb01152c01f03
BLAKE2b-256 checksum
How to use checksums
ee0fb8d21957907ac19f45402c1be3f1648d16e3de1e0c05b7ccd0f9bdccfaaa
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.2

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.2.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