ReliableRubricMiddleware(
self,
*,
model: str | BaseChatModel,
system_prompt: | Name | Type |
|---|---|
| model | str | BaseChatModel |
| system_prompt | str | None |
| tools | Sequence[BaseTool] | None |
| grader_middleware | Sequence[AgentMiddleware[Any, Any]] | None |
| grader_context_schema | type[Any] | None |
| grader_state_schema | type[AgentState[Any]] | None |
| prepare_messages_for_grader | Callable[[list[AnyMessage]], list[AnyMessage]] | None |
| build_grader_state | Callable[[RubricState, int], Mapping[str, Any]] | None |
| runtime_bootstrap_model | str | BaseChatModel | None |
| inherit_main_model | bool |
| max_iterations | int |
| on_evaluation | Callable[[RubricEvaluation], None] | None |
Run a context-aware nested grader with CLI verification middleware.
The nested grader receives Deep Agents Code's verification middleware and
runtime context without requiring those application-specific capabilities in
the SDK's RubricMiddleware. The grader middleware stack owns model retries,
so transient failures follow the same budget and taxonomy as every other
dcode model call without replaying completed grader tools.
The CLI configures the grader's CodeModelRetryMiddleware with hidden
stream output. Grader messages use a nested namespace that both clients
filter before rendering, so a dropped read or truncated body can retry the
failed model node without duplicating visible output or replaying completed
grader tools. Other model retry middleware instances keep the streamed-output
guard enabled.
The grader model is selected per request from thread state rather than
fixed at construction. inherit_main_model supplies the default for a
thread that has recorded no selection of its own.