MCPcopy Create free account
hub / github.com/ScaleML/AgentSPEX / _check_while

Method _check_while

src/harness/agentic_loop/verifier.py:247–268  ·  view source on GitHub ↗

Check 'while' type — requires condition, steps, max_iterations.

(self, body, errors, warnings, defined_vars, path)

Source from the content-addressed store, hash-verified

245 )
246
247 def _check_while(self, body, errors, warnings, defined_vars, path):
248 """Check 'while' type — requires condition, steps, max_iterations."""
249 if not isinstance(body, dict):
250 errors.append(f"{path}.while: body must be a dict")
251 return
252 if "condition" not in body:
253 errors.append(f"{path}.while: missing required field 'condition'")
254 if "steps" not in body:
255 errors.append(f"{path}.while: missing required field 'steps'")
256 else:
257 self._check_steps(
258 body["steps"],
259 errors,
260 warnings,
261 defined_vars.copy(),
262 f"{path}.while.steps",
263 )
264 if "max_iterations" not in body:
265 errors.append(
266 f"{path}.while: missing required field 'max_iterations'. "
267 "Without max_iterations, the loop may run indefinitely."
268 )
269
270 def _check_if(self, body, errors, warnings, defined_vars, path):
271 """Check 'if' type — requires condition, then."""

Callers

nothing calls this directly

Calls 1

_check_stepsMethod · 0.95

Tested by

no test coverage detected