Skip to main content
This feature is highly experimental and subject to change. The API, configuration, and behavior may evolve significantly based on feedback and testing.
A ready-to-run example is available here!

What is a Critic?

A critic is an evaluator that analyzes agent actions and conversation history to predict the quality or success probability of agent decisions. The critic runs alongside the agent and provides:
  • Quality scores: Probability scores between 0.0 and 1.0 indicating predicted success
  • Real-time feedback: Scores computed during agent execution, not just at completion
  • Iterative refinement: Automatic retry with follow-up prompts when scores are below threshold
You can use critic scores to build automated workflows, such as triggering the agent to reflect on and fix its previous solution when the critic indicates poor task performance.
This critic is a more advanced extension of the approach described in our blog post SOTA on SWE-Bench Verified with Inference-Time Scaling and Critic Model. For detailed evaluation metrics and methodology, see our technical report: A Rubric-Supervised Critic from Sparse Real-World Outcomes.

Quick Start

When using the OpenHands LLM Provider (llm-proxy.*.all-hands.dev), the critic is automatically configured - no additional setup required.

Understanding Critic Results

Critic evaluations produce scores and feedback:
  • score: Float between 0.0 and 1.0 representing predicted success probability
  • message: Optional feedback with detailed probabilities
  • success: Boolean property (True if score >= 0.5)
Results are automatically displayed in the conversation visualizer: Critic results in SDK visualizer

Accessing Results Programmatically

Iterative Refinement with a Critic

The critic supports automatic iterative refinement - when the agent finishes a task but the critic score is below a threshold, the conversation automatically continues with a follow-up prompt asking the agent to improve its work.

How It Works

  1. Agent completes a task and calls FinishAction
  2. Critic evaluates the result and produces a score
  3. If score < success_threshold, a follow-up prompt is sent automatically
  4. Agent continues working to address issues
  5. Process repeats until score meets threshold or max_iterations is reached

Configuration

Use IterativeRefinementConfig to enable automatic retries:

Parameters

ParameterTypeDefaultDescription
success_thresholdfloat0.6Score threshold (0-1) to consider task successful
max_iterationsint3Maximum number of iterations before giving up

Custom Follow-up Prompts

By default, the critic generates a generic follow-up prompt. You can customize this by subclassing CriticBase and overriding get_followup_prompt():

Example Workflow

Here’s what happens during iterative refinement:

Troubleshooting

Critic Evaluations Not Appearing

  • Verify the critic is properly configured and passed to the Agent
  • Ensure you’re using the OpenHands LLM Provider (llm-proxy.*.all-hands.dev)

API Authentication Errors

  • Verify LLM_API_KEY is set correctly
  • Check that the API key has not expired

Iterative Refinement Not Triggering

  • Ensure iterative_refinement config is attached to the critic
  • Check that success_threshold is set appropriately (higher values trigger more retries)
  • Verify the agent is using FinishAction to complete tasks

Ready-to-run Example

The critic model is hosted by the OpenHands LLM Provider and is currently free to use. This example is available on GitHub: examples/01_standalone_sdk/34_critic_example.py
This example demonstrates iterative refinement with a moderately complex task - creating a Python word statistics tool with specific edge case requirements. The critic evaluates whether all requirements are met and triggers retries if needed.
examples/01_standalone_sdk/34_critic_example.py
Running the Example

Example Output

Next Steps