inspect_ai.review
Reviewers
human_reviewer
Interactive human reviewer.
Shows the operator the tool call together with the result it returned, on the same surfaces as human_approver() (an attached ACP client, the approvals panel in the full-screen display, or the console), and asks for a review decision. continue is offered as the surfaces’ “approve” choice.
@reviewer(name="human")
def human_reviewer(
choices: list[ReviewDecision] = ["continue", "terminate"],
) -> Reviewerchoiceslist[ReviewDecision]-
Choices to present to human.
read_review_policies
Read review policies from a JSON or YAML config file.
def read_review_policies(file: str) -> list[ReviewPolicy]filestr-
JSON or YAML config file with review policies.
review
Context manager to temporarily replace tool review policies.
@contextlib.contextmanager
def review(policies: list[ReviewPolicy]) -> Iterator[None]policieslist[ReviewPolicy]-
Review policies to use within the context.
Types
Reviewer
Review the result of a tool call that has executed.
class Reviewer(Protocol):
async def __call__(
self,
message: str,
call: ToolCall,
result: ChatMessageTool,
output: ToolResult,
view: ToolCallView,
history: list[ChatMessage],
) -> Reviewmessagestr-
Message generated by the model along with the tool call.
callToolCall-
The tool call that executed (as executed, after any call-stage modification by an approver).
resultChatMessageTool-
The tool result as the model will see it (after output truncation), including any tool error.
outputToolResult-
The tool’s untruncated return value.
viewToolCallView-
Custom rendering of tool context and call.
historylist[ChatMessage]-
The current conversation history (ending with the assistant turn that made the call).
Review
Review details (decision, explanation, etc.)
class Review(BaseModel)Attributes
decisionReviewDecision-
Review decision.
explanationstr | None-
Explanation for decision.
metadatadict[str, Any] | None-
Additional review metadata.
ReviewDecision
Represents the possible decisions in a review.
ReviewDecision = Literal["continue", "terminate", "escalate"]ReviewPolicy
Policy mapping reviewers to tools.
@dataclass
class ReviewPolicyAttributes
reviewerReviewer-
Reviewer for policy.
toolsstr | list[str]-
Tools to use this reviewer for (can be full tool names or globs).
Decorator
reviewer
Decorator for registering reviewers.
def reviewer(*args: Any, name: str | None = None, **attribs: Any) -> Any*argsAny-
Function returning Reviewer targeted by plain reviewer decorator without attributes (e.g.
@reviewer) namestr | None-
Optional name for reviewer. If the decorator has no name argument then the name of the function will be used to automatically assign a name.
**attribsAny-
Additional reviewer attributes.