Message Helpers

utils.evals includes generic inspect_ai message transforms that are useful when building monitor prompts, e.g., to prevent a monitor from seeing chain-of-thought reasoning or the side-task instructions carried in specific tool calls.

For example, to filter reasoning and the submit tool call use:

from inspect_toolkit.utils.evals import (
    filter_reasoning_from_messages,
    filter_tool_calls_from_messages,
)

messages = filter_reasoning_from_messages(messages)                         # drop ContentReasoning
messages = filter_tool_calls_from_messages(messages, exclude=["submit"])    # drop named tool calls

Helpers include:

Both return a new list of messages, leaving the originals untouched.

See Also