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

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

Built distribution (wheel)

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

Total release size: 19.7 kB

Release files / mainspring_eval_online-0.1.1.tar.gz

Download URL mainspring_eval_online-0.1.1.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
aa40f9e258e1c9d3be51207d26df23e04df889eb3f35b566293cc6e5116e868e
BLAKE2b-256 checksum
How to use checksums
838eac4b4a0c5d695bc543136bf93094bad0e580434340a2eb7b16d6a55cccce
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.1-py3-none-any.whl

Download URL mainspring_eval_online-0.1.1-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bd72c3c4f2197ee42d560719781e4528feb769f88fc84a16bab4aff39f97b505
BLAKE2b-256 checksum
How to use checksums
8f25694d6056580132610c4abf75193c8a885b7dc1d0389e47a753bc50872f69
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.1

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