CLI-specific rubric middleware customizations.
Checkpoint value meaning the rubric grader follows the active main model.
None cannot carry this: checkpoint reads go through state_values.get(),
which cannot tell an absent key from a key holding None. Absence has to keep
meaning "this thread never chose", because that is what falls back to the
startup grader model. /rubric model clear needs the stronger statement that
grading follows the active model, which this sentinel carries.
It cannot collide with a real spec: create_model resolves provider:model
(or a bare model name) and has no provider or model named __dcode_.... The
value stays plain ASCII for the same reason as INHERIT_CLASSIFIER_MODEL in
_cli_context — it is serialized to JSON and persisted, and Postgres
text/jsonb rejects NUL outright.
Declared context_schema for the agent graph.
Registered via context_schema= when the graph is built, so LangGraph
coerces each run's context= payload into this dataclass — in-process,
runtime.context is a CLIContextSchema instance.
It exists alongside CLIContext (below) because the payload is shaped
differently on each side of the API boundary: in-process it is coerced to
this dataclass, but over the LangGraph API server (RemoteGraph) it is
serialized to JSON and arrives as a plain dict. Consumers
(configurable_model._get_context, _should_interrupt_tool_call)
therefore accept both shapes. CLIContext is the client-facing builder for
constructing that payload.
Fields mirror CLIContext; see its per-field docstrings for semantics.
Rubric state carrying dcode's private runtime model selections.
These three channels are declared a second time here, because this
middleware's state_schema must list every channel it reads. Each
annotation has to stay identical to its original in
resume_state.GoalRubricChannels / resume_state.ResumeState: dropping a
PrivateStateAttr marker leaks the field into the public graph input and
output schema.
Nested-grader state used to scope verification-tool budgets.
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.