verifiers 0.2.2.dev59__py3-none-any.whl → 0.2.2.dev60__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.
verifiers/v1/agent.py CHANGED
@@ -25,7 +25,7 @@ from verifiers.v1.harness import Harness
25
25
  from verifiers.v1.interception import Interception, InterceptionServer
26
26
  from verifiers.v1.mcp import SharedToolServer
27
27
  from verifiers.v1.retries import backoff, trace_should_retry
28
- from verifiers.v1.rollout import RolloutRun, _as_messages
28
+ from verifiers.v1.rollout import RolloutRun, RolloutTimeouts, _as_messages
29
29
  from verifiers.v1.runtimes import (
30
30
  NetworkPolicyConfig,
31
31
  Runtime,
@@ -533,23 +533,23 @@ class Agent:
533
533
  "harness": self.harness,
534
534
  "ctx": self.ctx,
535
535
  "runtime_config": runtime_config,
536
- "setup_timeout": (
537
- self.timeout.setup
538
- if self.timeout.setup is not None
539
- else task.data.timeout.setup
540
- ),
541
- "agent_timeout": cap_remote_agent_timeout(
542
- agent_timeout, runtime_config, task
543
- ),
544
- "finalize_timeout": (
545
- self.timeout.finalize
546
- if self.timeout.finalize is not None
547
- else task.data.timeout.finalize
548
- ),
549
- "scoring_timeout": (
550
- self.timeout.scoring
551
- if self.timeout.scoring is not None
552
- else task.data.timeout.scoring
536
+ "timeouts": RolloutTimeouts(
537
+ setup=(
538
+ self.timeout.setup
539
+ if self.timeout.setup is not None
540
+ else task.data.timeout.setup
541
+ ),
542
+ agent=cap_remote_agent_timeout(agent_timeout, runtime_config, task),
543
+ finalize=(
544
+ self.timeout.finalize
545
+ if self.timeout.finalize is not None
546
+ else task.data.timeout.finalize
547
+ ),
548
+ scoring=(
549
+ self.timeout.scoring
550
+ if self.timeout.scoring is not None
551
+ else task.data.timeout.scoring
552
+ ),
553
553
  ),
554
554
  "limits": self.limits,
555
555
  "shared_tools": shared_tools,
verifiers/v1/rollout.py CHANGED
@@ -23,6 +23,7 @@ import logging
23
23
  import time
24
24
  from collections.abc import AsyncIterator, Callable
25
25
  from contextlib import AsyncExitStack, asynccontextmanager
26
+ from dataclasses import dataclass
26
27
 
27
28
  from verifiers.v1.clients import ModelContext
28
29
  from verifiers.v1.configs.agent import AgentConfig
@@ -57,6 +58,19 @@ from verifiers.v1.types import Messages
57
58
  logger = logging.getLogger(__name__)
58
59
 
59
60
 
61
+ @dataclass(frozen=True)
62
+ class RolloutTimeouts:
63
+ """Per-stage rollout timeouts in seconds (None = unlimited), each bounding one
64
+ lifecycle stage: `setup` covers task + harness setup in `open()`, `agent` is the
65
+ cumulative budget the run's segments draw down across `step()`s, `finalize` and
66
+ `scoring` bound their `close()` stages."""
67
+
68
+ setup: float | None = None
69
+ agent: float | None = None
70
+ finalize: float | None = None
71
+ scoring: float | None = None
72
+
73
+
60
74
  def _as_messages(raw: Messages) -> Messages:
61
75
  """A turn's messages may arrive typed or as wire dicts (env code naturally
62
76
  writes `{"role": "user", ...}`); the trace speaks typed, so normalize here."""
@@ -115,10 +129,7 @@ class RolloutRun:
115
129
  runtime_config: RuntimeConfig,
116
130
  wire_data: TaskData | None = None,
117
131
  has_user: bool = False,
118
- setup_timeout: float | None = None,
119
- agent_timeout: float | None = None,
120
- finalize_timeout: float | None = None,
121
- scoring_timeout: float | None = None,
132
+ timeouts: RolloutTimeouts | None = None,
122
133
  limits: RolloutLimits | None = None,
123
134
  shared_tools: dict[str, SharedToolServer] | None = None,
124
135
  interception: Interception | None = None,
@@ -130,11 +141,8 @@ class RolloutRun:
130
141
  self.ctx = ctx
131
142
  self.runtime_config = runtime_config
132
143
  self._has_user = has_user
133
- self._setup_timeout = setup_timeout
134
- self._agent_timeout = agent_timeout
135
- self._agent_time_remaining = agent_timeout
136
- self._finalize_timeout = finalize_timeout
137
- self._scoring_timeout = scoring_timeout
144
+ self._timeouts = timeouts or RolloutTimeouts()
145
+ self._agent_time_remaining = self._timeouts.agent
138
146
  self._shared_tools = shared_tools or {}
139
147
  self._interception = interception
140
148
  self.runtime = runtime
@@ -164,7 +172,7 @@ class RolloutRun:
164
172
  self.deadline_at: float | None = None
165
173
  """The active harness segment's absolute deadline (event-loop clock), or
166
174
  None between segments / when unbounded. An interaction spends one cumulative
167
- `agent_timeout` budget only while its own segments run, so time awaiting
175
+ `timeouts.agent` budget only while its own segments run, so time awaiting
168
176
  the caller (including another interleaved agent) cannot starve it."""
169
177
 
170
178
  @property
@@ -244,8 +252,8 @@ class RolloutRun:
244
252
  # Task setup and harness provisioning share one setup-stage deadline.
245
253
  setup_deadline = (
246
254
  None
247
- if self._setup_timeout is None
248
- else asyncio.get_running_loop().time() + self._setup_timeout
255
+ if self._timeouts.setup is None
256
+ else asyncio.get_running_loop().time() + self._timeouts.setup
249
257
  )
250
258
  async with (
251
259
  boundary(TaskError, "task setup"),
@@ -340,7 +348,7 @@ class RolloutRun:
340
348
  self.fail(
341
349
  HarnessError(
342
350
  f"agent timeout: rollout exceeded its "
343
- f"{self._agent_timeout:g}s budget"
351
+ f"{self._timeouts.agent:g}s budget"
344
352
  )
345
353
  )
346
354
  else:
@@ -406,7 +414,7 @@ class RolloutRun:
406
414
  invoke(
407
415
  self.task.finalize, {"trace": trace, "runtime": runtime}
408
416
  ),
409
- self._finalize_timeout,
417
+ self._timeouts.finalize,
410
418
  )
411
419
  now = time.time()
412
420
  trace.timing.finalize.end = now
@@ -418,7 +426,7 @@ class RolloutRun:
418
426
  self.task.score(trace, runtime),
419
427
  self.harness.score(trace, runtime),
420
428
  ),
421
- self._scoring_timeout,
429
+ self._timeouts.scoring,
422
430
  )
423
431
  trace.timing.scoring.end = time.time()
424
432
  except Exception as e: # noqa: BLE001 - finalize boundary records every rollout failure
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: verifiers
3
- Version: 0.2.2.dev59
3
+ Version: 0.2.2.dev60
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
@@ -168,7 +168,7 @@ verifiers/utils/tool_utils.py,sha256=gInWZODWQUZN4TyEMuuITyOUm9qlHJxtcvr1zZl_zJs
168
168
  verifiers/utils/usage_utils.py,sha256=Mw6WC78r6EsLyRFdP9ICveqptkjizbSkAC86ZH0geVU,3918
169
169
  verifiers/utils/version_utils.py,sha256=39gV8-mNF9GspAgKloLo8oy7_MVluMrwGPrntQv2hx4,2656
170
170
  verifiers/v1/__init__.py,sha256=Im5qTZy9mH6PRTUi-1V6W7EWKZzJyTWLGKMYALbWz_w,7467
171
- verifiers/v1/agent.py,sha256=t5Z_iI6Zyt0ieMDI7pfHUVYIKViuSXF-CI_rIApx3f4,32071
171
+ verifiers/v1/agent.py,sha256=ASbe6IHAYcwivzQkHunX3cGu-o10Gez8tlVhO-pLYyE,32134
172
172
  verifiers/v1/artifacts.py,sha256=5eKOjDSUWwj7GrhxILMHdz2ngEONWMdcTGlBcuGgrLU,5834
173
173
  verifiers/v1/decorators.py,sha256=9CcCwgZlRjVGPqT5G1CFJUHP4OIMuBGkUJZkcI6dnbk,3865
174
174
  verifiers/v1/env.py,sha256=TGCq_rPp_VdyGAKpHuscSDyIxIGnim2N-dpKkG-J5p0,18175
@@ -181,7 +181,7 @@ verifiers/v1/legacy.py,sha256=ISk3Bix9Hy5EjZtyV9QO0LNyDNDklBHVjFokOrw_3U8,22628
181
181
  verifiers/v1/loaders.py,sha256=NSIBdNU3JVeyddL-dM4dJt6khCHyjCgzJuFtLrgiwD0,9989
182
182
  verifiers/v1/push.py,sha256=MWZmvyj0iyzNIO0xRhlkCXtFF1plq6EJi8rWlvrFtvI,11363
183
183
  verifiers/v1/retries.py,sha256=quUGVruUkZx-9WQcFiocMfL_M056voU8gwDqsuLR3f4,5412
184
- verifiers/v1/rollout.py,sha256=ehPoN6EnrIg_lvF1-pdf9pS8j47K3z6jDHc66MixzX0,20470
184
+ verifiers/v1/rollout.py,sha256=s8ji1W19FHZOn-Wn3_fjw-b1hhmi0EqZ7dZVntYK5pM,20732
185
185
  verifiers/v1/scoring.py,sha256=-R5Cog14r_tJ6Q_oOfGr5VPAm2CCUhofYZB6B9lm4wM,5787
186
186
  verifiers/v1/session.py,sha256=J6ZPuvsg6vMTJAs9dMUMtfdjCuvp6Hom877DVdKFKlY,6912
187
187
  verifiers/v1/state.py,sha256=pcpN2V6tX7rIO5XdtdUYay1j0ktEwrMtq7w1ApfsPdE,675
@@ -336,8 +336,8 @@ verifiers/v1/utils/logging.py,sha256=OcMHA6NsYux3oIzjPuI95rDWmFBHNcHDjZeNIhXTX-Y
336
336
  verifiers/v1/utils/memory.py,sha256=ZkIvGk6uITAH5sKon65LifKPbvZr8mJ__PVc23FZpOQ,1835
337
337
  verifiers/v1/utils/sampling.py,sha256=52TJ5-Hmpvp4YSgKNR-LmAPVwm4RDcH-o2-BnbVTmYQ,965
338
338
  verifiers/v1/utils/version.py,sha256=-obEo_-l9-D8FLef4hYxncOe-uJpxrM1g2Hig_37Sgs,1607
339
- verifiers-0.2.2.dev59.dist-info/METADATA,sha256=_zlzZC6PmnCHuYIWYn0fKecFkRUb2_ts5uzFM3yM_iQ,4545
340
- verifiers-0.2.2.dev59.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
341
- verifiers-0.2.2.dev59.dist-info/entry_points.txt,sha256=dF82JUYEFslR1AOW8LZfuBWeZeQoyX4wCRrduklg8-I,551
342
- verifiers-0.2.2.dev59.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
343
- verifiers-0.2.2.dev59.dist-info/RECORD,,
339
+ verifiers-0.2.2.dev60.dist-info/METADATA,sha256=aVyGlQcJ7KN2Qf6QMshBZTNvO6KN9rMYQNqpExl1EeY,4545
340
+ verifiers-0.2.2.dev60.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
341
+ verifiers-0.2.2.dev60.dist-info/entry_points.txt,sha256=dF82JUYEFslR1AOW8LZfuBWeZeQoyX4wCRrduklg8-I,551
342
+ verifiers-0.2.2.dev60.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
343
+ verifiers-0.2.2.dev60.dist-info/RECORD,,