LangChain has introduced RubricMiddleware for Deep Agents, a self-evaluation loop that lets agents check their own work against defined criteria and iterate until they pass. You define a rubric (a checklist of success criteria), configure a grader sub-agent with its own model and optional tools (like a test runner), and attach it to your main agent. If the agent's output fails any criterion, the grader injects targeted per-criterion feedback and the agent retries, up to a configured iteration limit. The loop terminates on success, failure, max iterations, or grader error. This is particularly useful for tasks with verifiable success criteria like code generation with test suites, reducing the need for manual inspection and re-runs.

5m read timeFrom langchain.com
Post cover image
Table of contents
The problemHow it worksWiring it upSeeing it in practiceWhy it mattersLearn more