verifiers 0.3.2.dev36__py3-none-any.whl → 0.3.2.dev38__py3-none-any.whl

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.
@@ -5,7 +5,14 @@ import logging
5
5
  import shlex
6
6
  from typing import Any, Literal
7
7
 
8
- from pydantic import BaseModel, ConfigDict, Field, PositiveInt, model_validator
8
+ from pydantic import (
9
+ BaseModel,
10
+ ConfigDict,
11
+ Field,
12
+ NonNegativeInt,
13
+ PositiveInt,
14
+ model_validator,
15
+ )
9
16
  from pydantic_config import BaseConfig
10
17
 
11
18
  from verifiers.v1.acp import ACPConfig, ACPHarness, ACPTurn, JsonObject
@@ -17,7 +24,7 @@ from verifiers.v1.trace import Trace
17
24
 
18
25
  logger = logging.getLogger(__name__)
19
26
 
20
- BuiltinSkill = Literal["edit", "search"]
27
+ BuiltinSkill = Literal["bash", "edit", "fetch", "search"]
21
28
 
22
29
  RLM_REPO = "github.com/PrimeIntellect-ai/nano-rlm.git"
23
30
  RLM_CACHE_DIR = "/tmp/vf-rlm"
@@ -40,18 +47,45 @@ class CompactionConfig(BaseConfig):
40
47
  summarize_at_tokens: PositiveInt | None = None
41
48
  """Compact at this token count. When unset, compact when 16k tokens remain below the
42
49
  model context window when the provider advertises it."""
50
+ max_compactions: PositiveInt | None = None
51
+ """Compactions per session before the engine stops compacting; `None` =
52
+ nano-rlm's default."""
43
53
 
44
54
 
45
55
  class RLMHarnessConfig(HarnessConfig):
46
- version: str = Field(default="4ef3438", min_length=1)
47
- """Git ref (branch, tag, or commit) of nano-rlm to install."""
48
- max_depth: int = 0
49
- """Recursion depth RLM may spawn sub-harnesses to."""
56
+ version: str = Field(default="dd2c04f", min_length=1)
57
+ """Git ref (branch, tag, or commit) of nano-rlm to install. Must know every
58
+ field this harness puts on the wire, i.e. be at least the default ref."""
59
+ max_depth: NonNegativeInt | None = None
60
+ """Recursion depth RLM may spawn sub-agents to; `None` = nano-rlm's default (1).
61
+ Set 0 to disable recursion."""
50
62
  builtin_skills: list[BuiltinSkill] = Field(default_factory=list)
51
63
  """Built-in rlm skills to enable (RLM_SKILLS), e.g. `["edit"]`; empty enables none.
52
64
  The tool set is fixed (ipython); the base `skills` field takes SKILL.md paths."""
53
- compaction: CompactionConfig | None = None
54
- """Context compaction policy. Set an empty config to use automatic thresholds."""
65
+ compaction: CompactionConfig | bool | None = None
66
+ """Context compaction: a `[compaction]` section (or `true`) enables it with the
67
+ given settings, `false` disables it (an overflowing session then fails), and
68
+ unset defers to nano-rlm's default (on, automatic thresholds, bounded by its
69
+ default 1M tree-token budget)."""
70
+ max_concurrent_subagents: PositiveInt | None = None
71
+ """Sub-agents running at once per session tree; `None` = nano-rlm's default (4).
72
+ nano-rlm requires it to be at least `max_depth`."""
73
+ max_total_turns: PositiveInt | None = None
74
+ """Tree-total turn budget (one turn = one work-loop model call, any engine); every
75
+ engine stops before its next call once spent. `None` = uncapped."""
76
+ max_total_tokens: PositiveInt | None = None
77
+ """Tree-total budget of NEW tokens (completion + uncached prompt) across the session
78
+ tree; once spent every engine stops and no further sub-agents spawn. `None` = unbounded."""
79
+ max_tool_output_bytes: PositiveInt | None = None
80
+ """Byte budget for a single tool result entering the conversation (middle truncation);
81
+ overrides rlm's built-in 20KB default in either direction."""
82
+ append_to_system_prompt: str | None = None
83
+ """Appended to the root engine's system prompt, after the taskset's system prompt."""
84
+ subagent_append_to_system_prompt: str | None = None
85
+ """Append for sub-agent engines that can still delegate (depth >= 1, below
86
+ `max_depth`); unset falls back to `append_to_system_prompt`."""
87
+ leaf_append_to_system_prompt: str | None = None
88
+ """Append for depth-capped leaf engines; unset falls back to the sub-agent append."""
55
89
 
56
90
  @model_validator(mode="after")
57
91
  def reject_disabled_tools(self) -> "RLMHarnessConfig":
@@ -60,6 +94,15 @@ class RLMHarnessConfig(HarnessConfig):
60
94
  "the rlm harness has a fixed tool set (ipython) and does not support "
61
95
  "`disabled_tools`; use `builtin_skills` to enable built-in skills instead."
62
96
  )
97
+ if (
98
+ self.max_depth is not None
99
+ and self.max_concurrent_subagents is not None
100
+ and self.max_concurrent_subagents < self.max_depth
101
+ ):
102
+ raise ValueError(
103
+ "`max_concurrent_subagents` must be at least `max_depth` "
104
+ "(nano-rlm rejects the policy otherwise)."
105
+ )
63
106
  return self
64
107
 
65
108
 
@@ -109,6 +152,24 @@ class RLMHarness(ACPHarness[RLMHarnessConfig]):
109
152
  system_prompt: str | None,
110
153
  ) -> JsonObject:
111
154
  compaction = self.config.compaction
155
+ policy_knobs: dict[str, Any] = {
156
+ "max_depth": self.config.max_depth,
157
+ "max_concurrent_subagents": self.config.max_concurrent_subagents,
158
+ "max_total_turns": self.config.max_total_turns,
159
+ "max_total_tokens": self.config.max_total_tokens,
160
+ "max_tool_output_bytes": self.config.max_tool_output_bytes,
161
+ }
162
+ if isinstance(compaction, bool):
163
+ policy_knobs["compaction"] = compaction
164
+ elif compaction is not None:
165
+ policy_knobs["compaction"] = True
166
+ policy_knobs["summarize_at_tokens"] = compaction.summarize_at_tokens
167
+ policy_knobs["max_compactions"] = compaction.max_compactions
168
+ appends = [
169
+ text
170
+ for text in (system_prompt, self.config.append_to_system_prompt)
171
+ if text
172
+ ]
112
173
  payload = {
113
174
  "session_id": trace.id,
114
175
  "model": ctx.model,
@@ -116,16 +177,17 @@ class RLMHarness(ACPHarness[RLMHarnessConfig]):
116
177
  "base_url": endpoint,
117
178
  "api_key": secret,
118
179
  },
180
+ # None = passthrough: the key stays off the wire and nano-rlm's own
181
+ # default applies.
119
182
  "policy": {
120
- "max_depth": self.config.max_depth,
121
- "compaction": compaction is not None,
122
- "summarize_at_tokens": (
123
- compaction.summarize_at_tokens if compaction else None
124
- ),
125
- "max_concurrent_subagents": max(4, self.config.max_depth),
183
+ key: value for key, value in policy_knobs.items() if value is not None
126
184
  },
127
185
  "system_prompt_path": None,
128
- "append_to_system_prompt": system_prompt,
186
+ "append_to_system_prompt": "\n\n".join(appends) or None,
187
+ "subagent_append_to_system_prompt": (
188
+ self.config.subagent_append_to_system_prompt
189
+ ),
190
+ "leaf_append_to_system_prompt": self.config.leaf_append_to_system_prompt,
129
191
  "skills": list(self.config.builtin_skills),
130
192
  "kernel_env": runtime.env,
131
193
  "search_api_key": self.config.resolved_env.get("SERPER_API_KEY"),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: verifiers
3
- Version: 0.3.2.dev36
3
+ Version: 0.3.2.dev38
4
4
  Summary: Verifiers: Environments for LLM Reinforcement Learning
5
5
  Project-URL: Homepage, https://github.com/primeintellect-ai/verifiers
6
6
  Project-URL: Documentation, https://github.com/primeintellect-ai/verifiers
@@ -109,7 +109,7 @@ verifiers/v1/harnesses/pool/harness.py,sha256=HKAogPbyLK5QpvPQ1teHOh_IyRQX-or2JF
109
109
  verifiers/v1/harnesses/prime_agent/__init__.py,sha256=xfPC4RrlnyYWaf38tPAOZq4YL6M55lMpj5BoRLmaK8I,171
110
110
  verifiers/v1/harnesses/prime_agent/harness.py,sha256=byplbbIOFACCn2BvVZAxBSHdaPKBGERYz_hA1rgBj0E,11205
111
111
  verifiers/v1/harnesses/rlm/__init__.py,sha256=hwx51xTdEWzzYgMj-p4ETNcptoub3IPMDbEdJ4uB8Ns,122
112
- verifiers/v1/harnesses/rlm/harness.py,sha256=clbx7-HQtEyEiOYu3JPEH6LaH66VYgvG3k3qLn1Re_w,7062
112
+ verifiers/v1/harnesses/rlm/harness.py,sha256=1a88tUM8l4BRf-In-dPyhtW9ilyH2GJdbh1ezL2BRcQ,10297
113
113
  verifiers/v1/harnesses/terminus_2/__init__.py,sha256=l1pwfg1HyVDEqT9efdnFWcXqaZwtKwe7TrplkyxZSA0,166
114
114
  verifiers/v1/harnesses/terminus_2/harness.py,sha256=kXKhi-aqqsoXGnvet0Tq_v7LYYpRYEzARyQL2MTEGWs,3101
115
115
  verifiers/v1/harnesses/terminus_2/program.py,sha256=X8MZdyItU3gbXGXnGOlJ9LWcUTnqIDaxlhkZvoRiqKY,2703
@@ -185,8 +185,8 @@ verifiers/v1/utils/prime.py,sha256=UTYRjp9cbjNb6CVmBHda-1wWZAIIfxNOmTyNuT7_wL4,9
185
185
  verifiers/v1/utils/retries.py,sha256=Y2ZgrAjn-qNkRKZP_RVNL_7EK0iaRcZeCa404lpGYi4,5417
186
186
  verifiers/v1/utils/score.py,sha256=493yJVMw8teCu9JxapxMFPFzI0hNUqdo0Y2nGW4kckk,6200
187
187
  verifiers/v1/utils/version.py,sha256=-obEo_-l9-D8FLef4hYxncOe-uJpxrM1g2Hig_37Sgs,1607
188
- verifiers-0.3.2.dev36.dist-info/METADATA,sha256=CPiuEseqw899eF8UoezmBH1wUJVCm4_DB26wx4jIXnA,4065
189
- verifiers-0.3.2.dev36.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
190
- verifiers-0.3.2.dev36.dist-info/entry_points.txt,sha256=uqQje0TMsr7k6nXlWxlPs13Si0evb3pVCEDF6c-YL80,241
191
- verifiers-0.3.2.dev36.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
192
- verifiers-0.3.2.dev36.dist-info/RECORD,,
188
+ verifiers-0.3.2.dev38.dist-info/METADATA,sha256=XtmwcXdAJSovO0iDRdqt2zmGCOe8Mh7oaGIxQNa2Euo,4065
189
+ verifiers-0.3.2.dev38.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
190
+ verifiers-0.3.2.dev38.dist-info/entry_points.txt,sha256=uqQje0TMsr7k6nXlWxlPs13Si0evb3pVCEDF6c-YL80,241
191
+ verifiers-0.3.2.dev38.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
192
+ verifiers-0.3.2.dev38.dist-info/RECORD,,