agrag.agents.middleware.RequireVerdictMiddleware
RequireVerdictMiddleware(max_reminders:int = 2) -> None
Bases: AgentMiddleware
Ask again when the verifier answers in prose instead of with its verdict.
A subagent that has tools stops as soon as the model replies without a tool
call, even when the reply is not the structured response. The planner then
reads prose where it expects a VerificationResult. This middleware sends a
short reminder and calls the model again, up to max_reminders times in one
subagent run, and then lets the run end as before.
Functions:
- after_model – Send a reminder and jump back to the model after a prose reply.
Parameters:
- max_reminders (
int) – How many reminders one subagent run may send.
after_model
after_model(state:Any, runtime:Any) -> dict[str, Any] | None
Send a reminder and jump back to the model after a prose reply.
Parameters:
- state (
Any) – The current agent state. - runtime (
Any) – The LangChain middleware runtime.
Returns:
dict[str, Any] | None– A reminder and model jump, orNonewhen no retry is needed.