tf-rewardkit 1.6.3__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.
Files changed (95) hide show
  1. tf_rewardkit-1.6.3/LICENSE +201 -0
  2. tf_rewardkit-1.6.3/PKG-INFO +144 -0
  3. tf_rewardkit-1.6.3/README.md +109 -0
  4. tf_rewardkit-1.6.3/pyproject.toml +64 -0
  5. tf_rewardkit-1.6.3/src/rewardkit/__init__.py +66 -0
  6. tf_rewardkit-1.6.3/src/rewardkit/__main__.py +154 -0
  7. tf_rewardkit-1.6.3/src/rewardkit/agents.py +1747 -0
  8. tf_rewardkit-1.6.3/src/rewardkit/compare.py +91 -0
  9. tf_rewardkit-1.6.3/src/rewardkit/criteria/__init__.py +65 -0
  10. tf_rewardkit-1.6.3/src/rewardkit/criteria/_command.py +30 -0
  11. tf_rewardkit-1.6.3/src/rewardkit/criteria/_trajectory.py +32 -0
  12. tf_rewardkit-1.6.3/src/rewardkit/criteria/command_output_contains.py +18 -0
  13. tf_rewardkit-1.6.3/src/rewardkit/criteria/command_output_matches.py +18 -0
  14. tf_rewardkit-1.6.3/src/rewardkit/criteria/command_output_matches_regex.py +19 -0
  15. tf_rewardkit-1.6.3/src/rewardkit/criteria/command_succeeds.py +17 -0
  16. tf_rewardkit-1.6.3/src/rewardkit/criteria/csv_cell_equals.py +41 -0
  17. tf_rewardkit-1.6.3/src/rewardkit/criteria/diff_ratio.py +20 -0
  18. tf_rewardkit-1.6.3/src/rewardkit/criteria/file_contains.py +18 -0
  19. tf_rewardkit-1.6.3/src/rewardkit/criteria/file_contains_regex.py +19 -0
  20. tf_rewardkit-1.6.3/src/rewardkit/criteria/file_exists.py +10 -0
  21. tf_rewardkit-1.6.3/src/rewardkit/criteria/file_matches.py +20 -0
  22. tf_rewardkit-1.6.3/src/rewardkit/criteria/file_not_exists.py +10 -0
  23. tf_rewardkit-1.6.3/src/rewardkit/criteria/files_equal.py +20 -0
  24. tf_rewardkit-1.6.3/src/rewardkit/criteria/http_response_contains.py +24 -0
  25. tf_rewardkit-1.6.3/src/rewardkit/criteria/http_status_equals.py +26 -0
  26. tf_rewardkit-1.6.3/src/rewardkit/criteria/image_similarity.py +45 -0
  27. tf_rewardkit-1.6.3/src/rewardkit/criteria/image_size_equals.py +26 -0
  28. tf_rewardkit-1.6.3/src/rewardkit/criteria/json_key_equals.py +24 -0
  29. tf_rewardkit-1.6.3/src/rewardkit/criteria/json_path_equals.py +34 -0
  30. tf_rewardkit-1.6.3/src/rewardkit/criteria/sqlite_query_equals.py +26 -0
  31. tf_rewardkit-1.6.3/src/rewardkit/criteria/trajectory_tool_not_used.py +19 -0
  32. tf_rewardkit-1.6.3/src/rewardkit/criteria/trajectory_tool_used.py +21 -0
  33. tf_rewardkit-1.6.3/src/rewardkit/criteria/trajectory_turn_count.py +24 -0
  34. tf_rewardkit-1.6.3/src/rewardkit/criteria/xlsx_cell_equals.py +38 -0
  35. tf_rewardkit-1.6.3/src/rewardkit/isolation.py +126 -0
  36. tf_rewardkit-1.6.3/src/rewardkit/judges.py +834 -0
  37. tf_rewardkit-1.6.3/src/rewardkit/models.py +409 -0
  38. tf_rewardkit-1.6.3/src/rewardkit/prompts/agent.md +3 -0
  39. tf_rewardkit-1.6.3/src/rewardkit/prompts/llm.md +3 -0
  40. tf_rewardkit-1.6.3/src/rewardkit/prompts/llm_trajectory.md +3 -0
  41. tf_rewardkit-1.6.3/src/rewardkit/reward.py +382 -0
  42. tf_rewardkit-1.6.3/src/rewardkit/runner.py +837 -0
  43. tf_rewardkit-1.6.3/src/rewardkit/session.py +175 -0
  44. tf_rewardkit-1.6.3/src/rewardkit/trajectory.py +390 -0
  45. tf_rewardkit-1.6.3/src/rewardkit/workflow/__init__.py +21 -0
  46. tf_rewardkit-1.6.3/src/rewardkit/workflow/attribution.py +212 -0
  47. tf_rewardkit-1.6.3/src/rewardkit/workflow/cli.py +259 -0
  48. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/README.md +21 -0
  49. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/__init__.py +58 -0
  50. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/_internal/__init__.py +1 -0
  51. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/_internal/budget.py +129 -0
  52. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/_internal/rubric.py +157 -0
  53. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/_internal/salvage.py +235 -0
  54. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/_internal/scoring.py +177 -0
  55. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/_source.py +188 -0
  56. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/agentic.py +184 -0
  57. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/code.py +134 -0
  58. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/consume_upstream.py +23 -0
  59. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/contracts.py +582 -0
  60. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/criterion.py +161 -0
  61. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/do_nothing.py +16 -0
  62. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/fail.py +25 -0
  63. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/llm_judge.py +233 -0
  64. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/llm_stub.py +34 -0
  65. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/ppt_judge/__init__.py +1 -0
  66. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/ppt_judge/_code_methods.py +367 -0
  67. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/ppt_judge/_compute.py +194 -0
  68. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/ppt_judge/_content.py +423 -0
  69. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/ppt_judge/_contract.py +256 -0
  70. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/ppt_judge/_ctx.py +102 -0
  71. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/ppt_judge/_faults.py +28 -0
  72. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/ppt_judge/_html_render.py +547 -0
  73. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/ppt_judge/_pptx_render.py +154 -0
  74. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/ppt_judge/_render_common.py +97 -0
  75. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/ppt_judge/_tagging.py +163 -0
  76. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/ppt_judge/_visual.py +263 -0
  77. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/ppt_judge/_vlm.py +229 -0
  78. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/ppt_judge/aggregate.py +177 -0
  79. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/ppt_judge/content.py +188 -0
  80. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/ppt_judge/gate.py +138 -0
  81. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/ppt_judge/render.py +75 -0
  82. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/ppt_judge/tag.py +52 -0
  83. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/ppt_judge/visual.py +165 -0
  84. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/produce_value.py +14 -0
  85. tf_rewardkit-1.6.3/src/rewardkit/workflow/component/registry.py +459 -0
  86. tf_rewardkit-1.6.3/src/rewardkit/workflow/context.py +180 -0
  87. tf_rewardkit-1.6.3/src/rewardkit/workflow/converter/__init__.py +19 -0
  88. tf_rewardkit-1.6.3/src/rewardkit/workflow/converter/_convert.py +467 -0
  89. tf_rewardkit-1.6.3/src/rewardkit/workflow/diagram.py +250 -0
  90. tf_rewardkit-1.6.3/src/rewardkit/workflow/errors.py +48 -0
  91. tf_rewardkit-1.6.3/src/rewardkit/workflow/executor.py +543 -0
  92. tf_rewardkit-1.6.3/src/rewardkit/workflow/loader.py +703 -0
  93. tf_rewardkit-1.6.3/src/rewardkit/workflow/model_service.py +179 -0
  94. tf_rewardkit-1.6.3/src/rewardkit/workflow/plan.py +345 -0
  95. tf_rewardkit-1.6.3/src/rewardkit/workflow/scoring.py +108 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,144 @@
1
+ Metadata-Version: 2.4
2
+ Name: tf-rewardkit
3
+ Version: 1.6.3
4
+ Summary: Lightweight grading toolkit for environment-based tasks.
5
+ Keywords: grading,evaluation,rewards,llm,agents,benchmarks
6
+ Author: benediktstroebl
7
+ License-Expression: Apache-2.0
8
+ License-File: LICENSE
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Topic :: Software Development :: Testing
15
+ Requires-Dist: litellm>=1.83
16
+ Requires-Dist: typing-extensions>=4.6
17
+ Requires-Dist: prefect>=3.8,<3.9
18
+ Requires-Dist: python-pptx>=1.0
19
+ Requires-Dist: pymupdf>=1.24
20
+ Requires-Dist: pillow>=10.0
21
+ Requires-Dist: pillow>=10.0 ; extra == 'all'
22
+ Requires-Dist: markitdown[pdf,docx,pptx,xlsx,xls,outlook]>=0.1 ; extra == 'all'
23
+ Requires-Dist: typesafe-sdk>=0.7 ; extra == 'all'
24
+ Requires-Dist: markitdown[pdf,docx,pptx,xlsx,xls,outlook]>=0.1 ; extra == 'documents'
25
+ Requires-Dist: pillow>=10.0 ; extra == 'image'
26
+ Requires-Dist: typesafe-sdk>=0.7 ; extra == 'jev'
27
+ Requires-Python: >=3.10
28
+ Project-URL: Repository, https://github.com/harbor-framework/harbor
29
+ Project-URL: Issues, https://github.com/harbor-framework/harbor/issues
30
+ Provides-Extra: all
31
+ Provides-Extra: documents
32
+ Provides-Extra: image
33
+ Provides-Extra: jev
34
+ Description-Content-Type: text/markdown
35
+
36
+ # Harbor Rewardkit
37
+
38
+ [![](https://dcbadge.limes.pink/api/server/https://discord.gg/QVvyhRw5UQ)](https://discord.gg/QVvyhRw5UQ)
39
+ [![Docs](https://img.shields.io/badge/Docs-000000?style=for-the-badge&logo=mdbook&color=105864)](https://harborframework.com/docs/rewardkit)
40
+
41
+ Rewardkit is a lightweight verifier package for Harbor tasks or standalone use.
42
+
43
+ ## Installation
44
+
45
+ ```bash
46
+ uv tool install harbor-rewardkit
47
+ ```
48
+
49
+ ## Programmatic verifier
50
+
51
+ ```python
52
+ # tests/checks.py
53
+ from rewardkit import criteria
54
+
55
+ criteria.file_exists("output.txt")
56
+ criteria.file_contains("output.txt", "hello")
57
+ ```
58
+
59
+ Run it with:
60
+
61
+ ```bash
62
+ uvx --from harbor-rewardkit rewardkit /tests
63
+ ```
64
+
65
+ Rewardkit runs the criteria against `/app` and writes
66
+ `/logs/verifier/reward.json`. With files directly under `tests/`, their scores
67
+ are combined into one `reward` automatically.
68
+
69
+ ## Configure scoring
70
+
71
+ Each Python file that registers criteria is one equal-weighted component named
72
+ after its filename stem. Use `[scoring.<stem>]` in `reward.toml` to change how
73
+ the criteria within that file combine:
74
+
75
+ ```toml
76
+ # tests/reward.toml
77
+ [scoring.checks]
78
+ aggregation = "all-pass"
79
+ ```
80
+
81
+ Files that only provide imports or `shared=True` criterion definitions and
82
+ register no checks are ignored.
83
+
84
+ ## Judge verifier
85
+
86
+ ```toml
87
+ # tests/quality.toml
88
+ [judge]
89
+ judge = "anthropic/claude-sonnet-5"
90
+ files = ["/app/main.py"]
91
+
92
+ [[criterion]]
93
+ description = "Is the code correct?"
94
+ type = "binary"
95
+ ```
96
+
97
+ `judge` is a LiteLLM model, an agent such as `claude-code`, or `jev` for
98
+ JEV, a new type of language model from TypeSafe (install `harbor-rewardkit[jev]`).
99
+
100
+ Python files and judge TOMLs can coexist. A judge TOML is also a component named
101
+ after its stem and has its own optional `[scoring]` section.
102
+
103
+ To change how these flat components combine, add a named reward aggregation:
104
+
105
+ ```toml
106
+ # tests/reward.toml
107
+ [[reward]]
108
+ name = "reward"
109
+ aggregation = "weighted-mean"
110
+ weights = { checks = 2.0, quality = 1.0 }
111
+ ```
112
+
113
+ ## Multi-reward verifier
114
+
115
+ Put scoring inputs in subdirectories to emit separate dimensions:
116
+
117
+ ```text
118
+ tests/
119
+ ├── correctness/
120
+ │ └── checks.py
121
+ ├── structure/
122
+ │ └── files.py
123
+ └── quality/
124
+ └── judge.toml
125
+ ```
126
+
127
+ This emits `correctness`, `structure`, and `quality`. Add a root
128
+ `tests/reward.toml` to combine them into a main reward:
129
+
130
+ ```toml
131
+ [[reward]]
132
+ name = "reward"
133
+ aggregation = "weighted-mean"
134
+ weights = { correctness = 2.0, structure = 1.0, quality = 1.0 }
135
+ ```
136
+
137
+ Inside a dimension, one unnamed `[[reward]]` can set weights across local
138
+ Python files, judge TOMLs, and child directories. Reference files by stem and
139
+ child groups by directory name.
140
+
141
+ See the [documentation](https://harborframework.com/docs/rewardkit) for custom
142
+ criteria, agent judges, the JEV judge, MCP servers, nested groups, and the complete config
143
+ reference. A [working Harbor task](https://github.com/harbor-framework/harbor/tree/main/examples/tasks/reward-kit-example)
144
+ shows the full layout.
@@ -0,0 +1,109 @@
1
+ # Harbor Rewardkit
2
+
3
+ [![](https://dcbadge.limes.pink/api/server/https://discord.gg/QVvyhRw5UQ)](https://discord.gg/QVvyhRw5UQ)
4
+ [![Docs](https://img.shields.io/badge/Docs-000000?style=for-the-badge&logo=mdbook&color=105864)](https://harborframework.com/docs/rewardkit)
5
+
6
+ Rewardkit is a lightweight verifier package for Harbor tasks or standalone use.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ uv tool install harbor-rewardkit
12
+ ```
13
+
14
+ ## Programmatic verifier
15
+
16
+ ```python
17
+ # tests/checks.py
18
+ from rewardkit import criteria
19
+
20
+ criteria.file_exists("output.txt")
21
+ criteria.file_contains("output.txt", "hello")
22
+ ```
23
+
24
+ Run it with:
25
+
26
+ ```bash
27
+ uvx --from harbor-rewardkit rewardkit /tests
28
+ ```
29
+
30
+ Rewardkit runs the criteria against `/app` and writes
31
+ `/logs/verifier/reward.json`. With files directly under `tests/`, their scores
32
+ are combined into one `reward` automatically.
33
+
34
+ ## Configure scoring
35
+
36
+ Each Python file that registers criteria is one equal-weighted component named
37
+ after its filename stem. Use `[scoring.<stem>]` in `reward.toml` to change how
38
+ the criteria within that file combine:
39
+
40
+ ```toml
41
+ # tests/reward.toml
42
+ [scoring.checks]
43
+ aggregation = "all-pass"
44
+ ```
45
+
46
+ Files that only provide imports or `shared=True` criterion definitions and
47
+ register no checks are ignored.
48
+
49
+ ## Judge verifier
50
+
51
+ ```toml
52
+ # tests/quality.toml
53
+ [judge]
54
+ judge = "anthropic/claude-sonnet-5"
55
+ files = ["/app/main.py"]
56
+
57
+ [[criterion]]
58
+ description = "Is the code correct?"
59
+ type = "binary"
60
+ ```
61
+
62
+ `judge` is a LiteLLM model, an agent such as `claude-code`, or `jev` for
63
+ JEV, a new type of language model from TypeSafe (install `harbor-rewardkit[jev]`).
64
+
65
+ Python files and judge TOMLs can coexist. A judge TOML is also a component named
66
+ after its stem and has its own optional `[scoring]` section.
67
+
68
+ To change how these flat components combine, add a named reward aggregation:
69
+
70
+ ```toml
71
+ # tests/reward.toml
72
+ [[reward]]
73
+ name = "reward"
74
+ aggregation = "weighted-mean"
75
+ weights = { checks = 2.0, quality = 1.0 }
76
+ ```
77
+
78
+ ## Multi-reward verifier
79
+
80
+ Put scoring inputs in subdirectories to emit separate dimensions:
81
+
82
+ ```text
83
+ tests/
84
+ ├── correctness/
85
+ │ └── checks.py
86
+ ├── structure/
87
+ │ └── files.py
88
+ └── quality/
89
+ └── judge.toml
90
+ ```
91
+
92
+ This emits `correctness`, `structure`, and `quality`. Add a root
93
+ `tests/reward.toml` to combine them into a main reward:
94
+
95
+ ```toml
96
+ [[reward]]
97
+ name = "reward"
98
+ aggregation = "weighted-mean"
99
+ weights = { correctness = 2.0, structure = 1.0, quality = 1.0 }
100
+ ```
101
+
102
+ Inside a dimension, one unnamed `[[reward]]` can set weights across local
103
+ Python files, judge TOMLs, and child directories. Reference files by stem and
104
+ child groups by directory name.
105
+
106
+ See the [documentation](https://harborframework.com/docs/rewardkit) for custom
107
+ criteria, agent judges, the JEV judge, MCP servers, nested groups, and the complete config
108
+ reference. A [working Harbor task](https://github.com/harbor-framework/harbor/tree/main/examples/tasks/reward-kit-example)
109
+ shows the full layout.
@@ -0,0 +1,64 @@
1
+ [project]
2
+ name = "tf-rewardkit"
3
+ version = "1.6.3"
4
+ description = "Lightweight grading toolkit for environment-based tasks."
5
+ readme = "README.md"
6
+ license = "Apache-2.0"
7
+ license-files = ["LICENSE"]
8
+ authors = [
9
+ { name = "benediktstroebl" },
10
+ ]
11
+ requires-python = ">=3.10"
12
+ keywords = ["grading", "evaluation", "rewards", "llm", "agents", "benchmarks"]
13
+ classifiers = [
14
+ "Development Status :: 4 - Beta",
15
+ "Intended Audience :: Developers",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3.12",
18
+ "Programming Language :: Python :: 3.13",
19
+ "Topic :: Software Development :: Testing",
20
+ ]
21
+ dependencies = [
22
+ "litellm>=1.83",
23
+ "typing_extensions>=4.6",
24
+ "prefect>=3.8,<3.9",
25
+ "python-pptx>=1.0",
26
+ "pymupdf>=1.24",
27
+ "Pillow>=10.0",
28
+ ]
29
+
30
+ [project.optional-dependencies]
31
+ documents = ["markitdown[pdf,docx,pptx,xlsx,xls,outlook]>=0.1"]
32
+ image = ["Pillow>=10.0"]
33
+ jev = ["typesafe-sdk>=0.7"]
34
+ all = [
35
+ "Pillow>=10.0",
36
+ "markitdown[pdf,docx,pptx,xlsx,xls,outlook]>=0.1",
37
+ "typesafe-sdk>=0.7",
38
+ ]
39
+
40
+ [project.urls]
41
+ Repository = "https://github.com/harbor-framework/harbor"
42
+ Issues = "https://github.com/harbor-framework/harbor/issues"
43
+
44
+ [dependency-groups]
45
+ dev = [
46
+ "pytest>=8",
47
+ "pytest-asyncio",
48
+ "ruff>=0.4",
49
+ "typesafe-sdk>=0.7",
50
+ ]
51
+
52
+ [project.scripts]
53
+ rewardkit = "rewardkit.__main__:main"
54
+ rewardkit-workflow = "rewardkit.workflow.cli:main"
55
+
56
+ [build-system]
57
+ requires = ["uv_build>=0.10.8,<0.11.0"]
58
+ build-backend = "uv_build"
59
+
60
+ [tool.uv.build-backend]
61
+ module-name = "rewardkit"
62
+
63
+ [tool.pytest.ini_options]
64
+ asyncio_mode = "auto"
@@ -0,0 +1,66 @@
1
+ from rewardkit.agents import AgentAttempt, AgentBackend, register_agent
2
+ from rewardkit.compare import ComparisonResult, compare, format_comparison
3
+ from rewardkit.models import (
4
+ Aggregation,
5
+ AgentJudge,
6
+ Binary,
7
+ Criterion,
8
+ JevJudge,
9
+ LLMJudge,
10
+ Likert,
11
+ MCPServerConfig,
12
+ Numeric,
13
+ OutputFormat,
14
+ Rubric,
15
+ Score,
16
+ )
17
+ from rewardkit.reward import Reward
18
+ from rewardkit.runner import discover, run, run_multi
19
+ from rewardkit.session import criterion
20
+ from rewardkit.trajectory import format_trajectory
21
+
22
+ __all__ = [
23
+ "AgentAttempt",
24
+ "AgentBackend",
25
+ "Aggregation",
26
+ "AgentJudge",
27
+ "Binary",
28
+ "ComparisonResult",
29
+ "Criterion",
30
+ "JevJudge",
31
+ "LLMJudge",
32
+ "Likert",
33
+ "MCPServerConfig",
34
+ "Numeric",
35
+ "OutputFormat",
36
+ "Reward",
37
+ "Rubric",
38
+ "Score",
39
+ "compare",
40
+ "criterion",
41
+ "discover",
42
+ "format_comparison",
43
+ "format_trajectory",
44
+ "register_agent",
45
+ "run",
46
+ "run_multi",
47
+ ]
48
+
49
+
50
+ def __getattr__(name: str): # noqa: ANN204
51
+ """Allow criteria to be accessed directly, e.g. ``rk.file_exists(...)``."""
52
+ import rewardkit.criteria # noqa: F401 — ensures built-in criteria are registered
53
+
54
+ from rewardkit.session import _factory_registry
55
+
56
+ if name in _factory_registry:
57
+ return _factory_registry[name]
58
+ raise AttributeError(f"module 'rewardkit' has no attribute {name!r}")
59
+
60
+
61
+ def __dir__() -> list[str]:
62
+ import rewardkit.criteria # noqa: F401
63
+
64
+ from rewardkit.session import _factory_registry
65
+
66
+ return list(set(__all__) | set(_factory_registry))