probity-ratchet-cases 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- probity_ratchet_cases-0.2.0/.gitignore +14 -0
- probity_ratchet_cases-0.2.0/CHANGELOG.md +32 -0
- probity_ratchet_cases-0.2.0/LICENSE +202 -0
- probity_ratchet_cases-0.2.0/PKG-INFO +94 -0
- probity_ratchet_cases-0.2.0/README.md +73 -0
- probity_ratchet_cases-0.2.0/pyproject.toml +73 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/__init__.py +64 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/__main__.py +5 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/adapters/__init__.py +4 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/adapters/openai_compat.py +82 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/adapters/python_callable.py +34 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/agentdojo.py +739 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/agentdojo_logs.py +74 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/cases/DIGESTS.json +4 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/cases/__init__.py +22 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/cases/build.py +293 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/cases/families/__init__.py +1 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/cases/families/approval_revoked.py +240 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/cases/families/concurrent_worker.py +251 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/cases/families/injection.py +347 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/cases/families/order_modification.py +431 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/cases/families/ordinary.py +172 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/cases/families/policy_changed.py +269 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/cases/families/reconciliation.py +276 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/cases/families/refund_lost_reply.py +235 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/cases/grade.py +23 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/cases/grading.py +299 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/cases/model.py +85 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/cases/registry.py +91 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/cases/solvers.py +397 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/cli.py +269 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/py.typed +0 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/run.py +217 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/tau2.py +316 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/types.py +75 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/world/__init__.py +18 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/world/approvals.py +68 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/world/billing.py +142 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/world/catalog.py +35 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/world/core.py +229 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/world/customers.py +50 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/world/faults.py +36 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/world/mail.py +74 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/world/orders.py +146 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/world/payments.py +176 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/world/policy.py +54 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/world/subscriptions.py +70 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/world/system.py +141 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/world/tickets.py +88 -0
- probity_ratchet_cases-0.2.0/src/ratchet_cases/world/view.py +66 -0
- probity_ratchet_cases-0.2.0/tests/cases/__init__.py +0 -0
- probity_ratchet_cases-0.2.0/tests/cases/test_grading.py +254 -0
- probity_ratchet_cases-0.2.0/tests/cases/test_registry.py +105 -0
- probity_ratchet_cases-0.2.0/tests/cases/test_solvers.py +72 -0
- probity_ratchet_cases-0.2.0/tests/scripted.py +60 -0
- probity_ratchet_cases-0.2.0/tests/test_suite_adapters.py +88 -0
- probity_ratchet_cases-0.2.0/tests/test_suite_agentdojo_logs.py +54 -0
- probity_ratchet_cases-0.2.0/tests/test_suite_cli.py +135 -0
- probity_ratchet_cases-0.2.0/tests/test_suite_release.py +28 -0
- probity_ratchet_cases-0.2.0/tests/test_suite_run.py +127 -0
- probity_ratchet_cases-0.2.0/tests/world/__init__.py +0 -0
- probity_ratchet_cases-0.2.0/tests/world/helpers.py +56 -0
- probity_ratchet_cases-0.2.0/tests/world/test_core.py +175 -0
- probity_ratchet_cases-0.2.0/tests/world/test_systems.py +171 -0
- probity_ratchet_cases-0.2.0/tests_agentdojo/test_agentdojo.py +144 -0
- probity_ratchet_cases-0.2.0/tests_tau2/test_tau2_faults.py +107 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Every version maps to one suite digest, recorded in `src/ratchet_cases/cases/DIGESTS.json`. While the
|
|
4
|
+
version is 0.x, a change to a shipped case, a grader rule or a fault's meaning is a minor version.
|
|
5
|
+
|
|
6
|
+
## 0.2.0 (2026-10-12)
|
|
7
|
+
|
|
8
|
+
The 52 shipped cases are unchanged: the suite digest is still
|
|
9
|
+
`7d4c38e0d18c39c7d6cb955a28cb9bbc134cd1f78958c2c4ac5b2f04dd9b6679`. This release adds two suites that
|
|
10
|
+
run inside other benchmarks.
|
|
11
|
+
|
|
12
|
+
The distribution is renamed from `ratchet-cases` to `probity-ratchet-cases`, to match `probity-ratchet`.
|
|
13
|
+
The import name stays `ratchet_cases` and the command stays `ratchet-cases`. Version 0.1.0 was
|
|
14
|
+
published under the old name.
|
|
15
|
+
|
|
16
|
+
- `ratchet_cases.agentdojo`: benign twins for AgentDojo v1.2.2. Importing the module
|
|
17
|
+
(`-ml ratchet_cases.agentdojo`) registers the benchmark version `ratchet-benign-twins-v0.1` with the
|
|
18
|
+
workspace, travel, banking and slack suites. Each user task is the benign twin of one injection task:
|
|
19
|
+
the slot an attack would fill holds an instruction the user asked for, graded by AgentDojo's own utility
|
|
20
|
+
checks. Install with `pip install 'probity-ratchet-cases[agentdojo]'`, which pins `agentdojo==0.1.35`.
|
|
21
|
+
- `ratchet-cases agentdojo-report <logdir>`: the false intervention rate per pipeline (twins failed over
|
|
22
|
+
twins run) from AgentDojo run logs, read with the standard library only.
|
|
23
|
+
- `ratchet_cases.tau2`: the `retail_faults` task set for tau2-bench. For each of the seven retail write
|
|
24
|
+
tools, one task in two variants, a timeout after the call commits and one before it does: 14 tasks,
|
|
25
|
+
graded on the live databases against the gold ones rather than on a replay. Registered through the
|
|
26
|
+
`tau2.plugins` entry point. tau2-bench is installed from its repository, not from PyPI.
|
|
27
|
+
- The sdist carries the AgentDojo and tau2-bench tests.
|
|
28
|
+
|
|
29
|
+
## 0.1.0 (2026-10-12)
|
|
30
|
+
|
|
31
|
+
First release: 52 cases in eight families, graded on final state, with deterministic tool faults, exact
|
|
32
|
+
graders, scripted solvers, the `ratchet-cases` command line and `SUITE_DIGEST`.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: probity-ratchet-cases
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Agent cases graded on final state: a simulated company, deterministic tool faults, exact graders and scripted solvers.
|
|
5
|
+
Project-URL: Source, https://github.com/probityai/ratchet/tree/main/probity-ratchet-cases
|
|
6
|
+
Project-URL: Issues, https://github.com/probityai/ratchet/issues
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Classifier: Topic :: Software Development :: Testing
|
|
16
|
+
Classifier: Typing :: Typed
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Provides-Extra: agentdojo
|
|
19
|
+
Requires-Dist: agentdojo==0.1.35; extra == 'agentdojo'
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# probity-ratchet-cases
|
|
23
|
+
|
|
24
|
+
Fifty-two agent tasks in a simulated company, each graded on the final state of every system it touches, never on what the agent says.
|
|
25
|
+
|
|
26
|
+
It is for anyone testing a tool-using agent, or a guard or defense around one, who needs to know both that the agent avoids the traps and that it still finishes legitimate work.
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
pip install probity-ratchet-cases==0.2.0
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Python 3.10 or later. No runtime dependencies.
|
|
35
|
+
|
|
36
|
+
## Try it in 30 seconds
|
|
37
|
+
|
|
38
|
+
Three scripted solvers, no model: one with every careful habit, one that trusts everything it reads, one that refuses everything.
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
ratchet-cases selftest
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
reference trap 26/26, benign_twin 21/21, must_succeed 5/5
|
|
46
|
+
naive trap 0/26, benign_twin 21/21, must_succeed 5/5
|
|
47
|
+
refuser trap 0/26, benign_twin 0/21, must_succeed 0/5
|
|
48
|
+
selftest passed on 52 case(s); suite digest 7d4c38e0d18c39c7d6cb955a28cb9bbc134cd1f78958c2c4ac5b2f04dd9b6679
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The refuser row is the point: an agent that blocks every action never falls for a trap and fails every benign twin, the case that looks like a trap but asks for ordinary work.
|
|
52
|
+
|
|
53
|
+
## Run your agent
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
ratchet-cases run --adapter openai --model <model> --base-url <url> --out runs/mine # RATCHET_API_KEY for the key
|
|
57
|
+
ratchet-cases run --adapter python:mypkg.agent:act --out runs/mine # act(messages, tools) -> assistant message
|
|
58
|
+
ratchet-cases grade runs/mine/traces.jsonl
|
|
59
|
+
ratchet-cases report runs/ --metric false_intervention_rate
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`grade` rebuilds each final state by replaying the recorded tool calls and grades it again. `false_intervention_rate` is the share of benign twins the agent failed.
|
|
63
|
+
|
|
64
|
+
## What is in it
|
|
65
|
+
|
|
66
|
+
Eight families: a refund that commits while its reply is lost, an approval revoked between check and execution, a policy that changes mid-session, prompt injection in tool-returned content, a concurrent worker that already handled the ticket, a reconciliation whose totals match while its accounts do not, an order modification with a late addition, and ordinary work that must succeed. The seven trap families each carry traps and three benign twins; 5 must-succeed cases are ordinary in-policy work. Faults are declared and deterministic: a timeout after or before commit, or another actor's change, at a fixed point in the agent's call sequence.
|
|
67
|
+
|
|
68
|
+
Splits: 18 train, 19 held-out, 15 audit. **All three splits are public.** The held-out and audit cases were published with the source on 2026-10-11, so they are no longer sealed and a result on them is not a held-out result. A sealed cohort, run by a steward, is separate planned work.
|
|
69
|
+
|
|
70
|
+
## tau2-bench retail faults
|
|
71
|
+
|
|
72
|
+
`ratchet_cases.tau2` puts a deterministic timeout, after or before the call commits, on the first call to each of tau2-bench's seven retail write tools: 14 tasks, each graded on the live databases against the gold ones rather than on a replay of the trajectory. Install tau2-bench from its repository first; it is not on PyPI under its own name.
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
from ratchet_cases import tau2
|
|
76
|
+
|
|
77
|
+
print([tau2.run(task, tau2.Policy.GIVE_UP).passed for task in tau2.faulted_tasks()])
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
An agent that gives up after a timeout passes the seven after-commit tasks and fails the seven before-commit ones. A tau2-bench that carries `Task.faults` and loads `tau2.plugins` entry points runs the same set as `retail_faults`.
|
|
81
|
+
|
|
82
|
+
## Version and digest
|
|
83
|
+
|
|
84
|
+
Version 0.2.0. `ratchet_cases.SUITE_DIGEST` is computed from the shipped cases at import, and `DIGESTS.json` records the digest of every release, so `probity-ratchet-cases==X.Y.Z` pins the exact cases. Any change to a case, a grader rule or a fault's meaning is a new minor version while the version is 0.x.
|
|
85
|
+
|
|
86
|
+
## Links
|
|
87
|
+
|
|
88
|
+
| Page | What is in it |
|
|
89
|
+
|---|---|
|
|
90
|
+
| [Source](https://github.com/probityai/ratchet/tree/main/probity-ratchet-cases) | The package in the Ratchet repository |
|
|
91
|
+
| [Ratchet](https://github.com/probityai/ratchet) | The harness that turns failures on these cases into proven guards |
|
|
92
|
+
| [Releases](https://github.com/probityai/ratchet/releases) | Wheels, provenance attestations and digests |
|
|
93
|
+
|
|
94
|
+
License: Apache-2.0.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# probity-ratchet-cases
|
|
2
|
+
|
|
3
|
+
Fifty-two agent tasks in a simulated company, each graded on the final state of every system it touches, never on what the agent says.
|
|
4
|
+
|
|
5
|
+
It is for anyone testing a tool-using agent, or a guard or defense around one, who needs to know both that the agent avoids the traps and that it still finishes legitimate work.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pip install probity-ratchet-cases==0.2.0
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Python 3.10 or later. No runtime dependencies.
|
|
14
|
+
|
|
15
|
+
## Try it in 30 seconds
|
|
16
|
+
|
|
17
|
+
Three scripted solvers, no model: one with every careful habit, one that trusts everything it reads, one that refuses everything.
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
ratchet-cases selftest
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
reference trap 26/26, benign_twin 21/21, must_succeed 5/5
|
|
25
|
+
naive trap 0/26, benign_twin 21/21, must_succeed 5/5
|
|
26
|
+
refuser trap 0/26, benign_twin 0/21, must_succeed 0/5
|
|
27
|
+
selftest passed on 52 case(s); suite digest 7d4c38e0d18c39c7d6cb955a28cb9bbc134cd1f78958c2c4ac5b2f04dd9b6679
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The refuser row is the point: an agent that blocks every action never falls for a trap and fails every benign twin, the case that looks like a trap but asks for ordinary work.
|
|
31
|
+
|
|
32
|
+
## Run your agent
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
ratchet-cases run --adapter openai --model <model> --base-url <url> --out runs/mine # RATCHET_API_KEY for the key
|
|
36
|
+
ratchet-cases run --adapter python:mypkg.agent:act --out runs/mine # act(messages, tools) -> assistant message
|
|
37
|
+
ratchet-cases grade runs/mine/traces.jsonl
|
|
38
|
+
ratchet-cases report runs/ --metric false_intervention_rate
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`grade` rebuilds each final state by replaying the recorded tool calls and grades it again. `false_intervention_rate` is the share of benign twins the agent failed.
|
|
42
|
+
|
|
43
|
+
## What is in it
|
|
44
|
+
|
|
45
|
+
Eight families: a refund that commits while its reply is lost, an approval revoked between check and execution, a policy that changes mid-session, prompt injection in tool-returned content, a concurrent worker that already handled the ticket, a reconciliation whose totals match while its accounts do not, an order modification with a late addition, and ordinary work that must succeed. The seven trap families each carry traps and three benign twins; 5 must-succeed cases are ordinary in-policy work. Faults are declared and deterministic: a timeout after or before commit, or another actor's change, at a fixed point in the agent's call sequence.
|
|
46
|
+
|
|
47
|
+
Splits: 18 train, 19 held-out, 15 audit. **All three splits are public.** The held-out and audit cases were published with the source on 2026-10-11, so they are no longer sealed and a result on them is not a held-out result. A sealed cohort, run by a steward, is separate planned work.
|
|
48
|
+
|
|
49
|
+
## tau2-bench retail faults
|
|
50
|
+
|
|
51
|
+
`ratchet_cases.tau2` puts a deterministic timeout, after or before the call commits, on the first call to each of tau2-bench's seven retail write tools: 14 tasks, each graded on the live databases against the gold ones rather than on a replay of the trajectory. Install tau2-bench from its repository first; it is not on PyPI under its own name.
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from ratchet_cases import tau2
|
|
55
|
+
|
|
56
|
+
print([tau2.run(task, tau2.Policy.GIVE_UP).passed for task in tau2.faulted_tasks()])
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
An agent that gives up after a timeout passes the seven after-commit tasks and fails the seven before-commit ones. A tau2-bench that carries `Task.faults` and loads `tau2.plugins` entry points runs the same set as `retail_faults`.
|
|
60
|
+
|
|
61
|
+
## Version and digest
|
|
62
|
+
|
|
63
|
+
Version 0.2.0. `ratchet_cases.SUITE_DIGEST` is computed from the shipped cases at import, and `DIGESTS.json` records the digest of every release, so `probity-ratchet-cases==X.Y.Z` pins the exact cases. Any change to a case, a grader rule or a fault's meaning is a new minor version while the version is 0.x.
|
|
64
|
+
|
|
65
|
+
## Links
|
|
66
|
+
|
|
67
|
+
| Page | What is in it |
|
|
68
|
+
|---|---|
|
|
69
|
+
| [Source](https://github.com/probityai/ratchet/tree/main/probity-ratchet-cases) | The package in the Ratchet repository |
|
|
70
|
+
| [Ratchet](https://github.com/probityai/ratchet) | The harness that turns failures on these cases into proven guards |
|
|
71
|
+
| [Releases](https://github.com/probityai/ratchet/releases) | Wheels, provenance attestations and digests |
|
|
72
|
+
|
|
73
|
+
License: Apache-2.0.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "probity-ratchet-cases"
|
|
3
|
+
dynamic = ["version"]
|
|
4
|
+
description = "Agent cases graded on final state: a simulated company, deterministic tool faults, exact graders and scripted solvers."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
license = "Apache-2.0"
|
|
8
|
+
dependencies = []
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Programming Language :: Python :: 3",
|
|
11
|
+
"Programming Language :: Python :: 3.10",
|
|
12
|
+
"Programming Language :: Python :: 3.11",
|
|
13
|
+
"Programming Language :: Python :: 3.12",
|
|
14
|
+
"Programming Language :: Python :: 3.13",
|
|
15
|
+
"Programming Language :: Python :: 3.14",
|
|
16
|
+
"Topic :: Software Development :: Testing",
|
|
17
|
+
"Typing :: Typed",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[project.optional-dependencies]
|
|
21
|
+
# The benign-twin suite for AgentDojo (ratchet_cases.agentdojo); pinned to the release it was built on.
|
|
22
|
+
agentdojo = ["agentdojo==0.1.35"]
|
|
23
|
+
|
|
24
|
+
[project.entry-points."tau2.plugins"]
|
|
25
|
+
ratchet_cases = "ratchet_cases.tau2:register"
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
Source = "https://github.com/probityai/ratchet/tree/main/probity-ratchet-cases"
|
|
29
|
+
Issues = "https://github.com/probityai/ratchet/issues"
|
|
30
|
+
|
|
31
|
+
[project.scripts]
|
|
32
|
+
ratchet-cases = "ratchet_cases.cli:main"
|
|
33
|
+
|
|
34
|
+
[build-system]
|
|
35
|
+
requires = ["hatchling"]
|
|
36
|
+
build-backend = "hatchling.build"
|
|
37
|
+
|
|
38
|
+
[tool.hatch.version]
|
|
39
|
+
path = "src/ratchet_cases/__init__.py"
|
|
40
|
+
|
|
41
|
+
[tool.hatch.build.targets.wheel]
|
|
42
|
+
packages = ["src/ratchet_cases"]
|
|
43
|
+
|
|
44
|
+
[tool.hatch.build.targets.sdist]
|
|
45
|
+
include = ["src/ratchet_cases", "tests", "tests_agentdojo", "tests_tau2", "README.md", "CHANGELOG.md", "pyproject.toml"]
|
|
46
|
+
|
|
47
|
+
[tool.ruff]
|
|
48
|
+
line-length = 110
|
|
49
|
+
target-version = "py310"
|
|
50
|
+
|
|
51
|
+
[tool.ruff.lint]
|
|
52
|
+
select = ["E", "F", "W", "I", "B", "UP", "SIM", "RUF"]
|
|
53
|
+
|
|
54
|
+
[tool.ruff.lint.isort]
|
|
55
|
+
known-first-party = ["ratchet_cases"]
|
|
56
|
+
|
|
57
|
+
[tool.mypy]
|
|
58
|
+
strict = true
|
|
59
|
+
python_version = "3.10"
|
|
60
|
+
|
|
61
|
+
# AgentDojo ships no py.typed marker; read its annotations rather than treating it as Any.
|
|
62
|
+
[[tool.mypy.overrides]]
|
|
63
|
+
module = ["agentdojo", "agentdojo.*"]
|
|
64
|
+
follow_untyped_imports = true
|
|
65
|
+
|
|
66
|
+
# tau2-bench ships no py.typed marker either; read its annotations the same way.
|
|
67
|
+
[[tool.mypy.overrides]]
|
|
68
|
+
module = ["tau2", "tau2.*"]
|
|
69
|
+
follow_untyped_imports = true
|
|
70
|
+
|
|
71
|
+
[tool.pytest.ini_options]
|
|
72
|
+
testpaths = ["tests"]
|
|
73
|
+
addopts = "-W error"
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""Agent cases graded on final state: a simulated company, deterministic faults, exact graders.
|
|
2
|
+
|
|
3
|
+
`SUITE_DIGEST` is computed from the shipped cases when the package is imported; `released_digest()` is
|
|
4
|
+
the digest this version was released with. The two are equal in every release, and a test enforces it.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from ratchet_cases.cases import (
|
|
10
|
+
CASE_KINDS,
|
|
11
|
+
SPLITS,
|
|
12
|
+
Case,
|
|
13
|
+
CaseKind,
|
|
14
|
+
Expect,
|
|
15
|
+
Family,
|
|
16
|
+
all_cases,
|
|
17
|
+
by_family,
|
|
18
|
+
by_kind,
|
|
19
|
+
by_split,
|
|
20
|
+
families,
|
|
21
|
+
get,
|
|
22
|
+
grade,
|
|
23
|
+
suite_digest,
|
|
24
|
+
)
|
|
25
|
+
from ratchet_cases.cases.registry import released_digests
|
|
26
|
+
from ratchet_cases.cases.solvers import NAIVE, REFERENCE, REFUSER, Habits, solve
|
|
27
|
+
from ratchet_cases.world import Fault, World
|
|
28
|
+
|
|
29
|
+
__version__ = "0.2.0"
|
|
30
|
+
|
|
31
|
+
SUITE_DIGEST = suite_digest()
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def released_digest(version: str = __version__) -> str:
|
|
35
|
+
"""The suite digest recorded for `version` in `DIGESTS.json`. Raises KeyError for an unknown version."""
|
|
36
|
+
return released_digests()[version]
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
__all__ = [
|
|
40
|
+
"CASE_KINDS",
|
|
41
|
+
"NAIVE",
|
|
42
|
+
"REFERENCE",
|
|
43
|
+
"REFUSER",
|
|
44
|
+
"SPLITS",
|
|
45
|
+
"SUITE_DIGEST",
|
|
46
|
+
"Case",
|
|
47
|
+
"CaseKind",
|
|
48
|
+
"Expect",
|
|
49
|
+
"Family",
|
|
50
|
+
"Fault",
|
|
51
|
+
"Habits",
|
|
52
|
+
"World",
|
|
53
|
+
"__version__",
|
|
54
|
+
"all_cases",
|
|
55
|
+
"by_family",
|
|
56
|
+
"by_kind",
|
|
57
|
+
"by_split",
|
|
58
|
+
"families",
|
|
59
|
+
"get",
|
|
60
|
+
"grade",
|
|
61
|
+
"released_digest",
|
|
62
|
+
"solve",
|
|
63
|
+
"suite_digest",
|
|
64
|
+
]
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"""An `Act` over any OpenAI-compatible chat-completions endpoint, using only the standard library.
|
|
2
|
+
|
|
3
|
+
Flags win over the environment: `RATCHET_BASE_URL`, `RATCHET_API_KEY` and `RATCHET_MODEL` fill whatever is
|
|
4
|
+
not given. The key is sent in the Authorization header and is never written to a trace.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import json
|
|
10
|
+
import os
|
|
11
|
+
import urllib.error
|
|
12
|
+
import urllib.request
|
|
13
|
+
from collections.abc import Mapping
|
|
14
|
+
from dataclasses import dataclass
|
|
15
|
+
from typing import Any
|
|
16
|
+
|
|
17
|
+
JSON = dict[str, Any]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class EndpointError(RuntimeError):
|
|
21
|
+
"""The endpoint refused the request or returned something that is not a chat completion."""
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@dataclass(frozen=True)
|
|
25
|
+
class Endpoint:
|
|
26
|
+
base_url: str
|
|
27
|
+
model: str
|
|
28
|
+
api_key: str = ""
|
|
29
|
+
temperature: float = 0.0
|
|
30
|
+
timeout_s: float = 120.0
|
|
31
|
+
|
|
32
|
+
@classmethod
|
|
33
|
+
def from_env(
|
|
34
|
+
cls,
|
|
35
|
+
*,
|
|
36
|
+
base_url: str | None = None,
|
|
37
|
+
model: str | None = None,
|
|
38
|
+
api_key: str | None = None,
|
|
39
|
+
environ: Mapping[str, str] | None = None,
|
|
40
|
+
) -> Endpoint:
|
|
41
|
+
env = os.environ if environ is None else environ
|
|
42
|
+
url = base_url or env.get("RATCHET_BASE_URL", "")
|
|
43
|
+
name = model or env.get("RATCHET_MODEL", "")
|
|
44
|
+
if not url or not name:
|
|
45
|
+
raise EndpointError("set --base-url and --model, or RATCHET_BASE_URL and RATCHET_MODEL")
|
|
46
|
+
return cls(base_url=url.rstrip("/"), model=name, api_key=api_key or env.get("RATCHET_API_KEY", ""))
|
|
47
|
+
|
|
48
|
+
def request(self, messages: list[JSON], tools: list[JSON]) -> urllib.request.Request:
|
|
49
|
+
body = {"model": self.model, "messages": messages, "tools": tools, "temperature": self.temperature}
|
|
50
|
+
headers = {"Content-Type": "application/json"}
|
|
51
|
+
if self.api_key:
|
|
52
|
+
headers["Authorization"] = f"Bearer {self.api_key}"
|
|
53
|
+
return urllib.request.Request(
|
|
54
|
+
f"{self.base_url}/chat/completions",
|
|
55
|
+
data=json.dumps(body).encode(),
|
|
56
|
+
headers=headers,
|
|
57
|
+
method="POST",
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
def __call__(self, messages: list[JSON], tools: list[JSON]) -> JSON:
|
|
61
|
+
try:
|
|
62
|
+
with urllib.request.urlopen(self.request(messages, tools), timeout=self.timeout_s) as response:
|
|
63
|
+
payload = json.loads(response.read())
|
|
64
|
+
except urllib.error.HTTPError as err:
|
|
65
|
+
raise EndpointError(f"HTTP {err.code} from {self.base_url}") from err
|
|
66
|
+
except (urllib.error.URLError, TimeoutError, json.JSONDecodeError) as err:
|
|
67
|
+
raise EndpointError(f"no usable response from {self.base_url}: {err}") from err
|
|
68
|
+
return parse_completion(payload)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def parse_completion(payload: Any) -> JSON:
|
|
72
|
+
"""The assistant message of a chat completion, with token usage under `usage`."""
|
|
73
|
+
try:
|
|
74
|
+
message = dict(payload["choices"][0]["message"])
|
|
75
|
+
except (KeyError, IndexError, TypeError) as err:
|
|
76
|
+
raise EndpointError(f"not a chat completion: {err!r}") from err
|
|
77
|
+
usage = payload.get("usage") or {}
|
|
78
|
+
message["usage"] = {
|
|
79
|
+
"input_tokens": int(usage.get("prompt_tokens", 0)),
|
|
80
|
+
"output_tokens": int(usage.get("completion_tokens", 0)),
|
|
81
|
+
}
|
|
82
|
+
return message
|