before_agent(
self,
state: RubricState,
runtime: Runtime[ContextT]
) -> dict| Name | Type | Description |
|---|---|---|
state* | RubricState | |
runtime* | Runtime[ContextT] |
Detect a new grading run and reset iteration bookkeeping.
A "new grading run" is either a different rubric string than
_active_rubric, or the same rubric after the previous run
reached a terminal status (satisfied, max_iterations_reached,
or failed). In that case we mint a fresh _current_grading_run_id,
reset _rubric_iterations to 0, and clear _rubric_status so a
new run starts fresh.
If rubric is unset the middleware is a no-op for this run.
Agent state.
Agent runtime (unused).