Table of Contents
- Type Aliases
- Data Types
- Classes
- Client Classes
- Configuration Types
- Prime CLI Plugin
- Decorators
- Utility Functions
Type Aliases
Messages
ChatMessage
role, content, and optional tool_calls / tool_call_id fields.
SystemMessage
vf.SystemMessage.from_path(...) to load a system prompt from a UTF-8 text file while preserving the file contents verbatim.
Info
SamplingArgs
temperature, top_p, max_tokens).
SystemPrompt
vf.SystemPromptConfig(path="system_prompt.txt") for file-backed prompts, or override load_system_prompt(config) when prompt construction belongs to the class. System prompt resolution is per task: task prompt overrides taskset prompt for the taskset side, then the harness applies system_prompt_strategy. The default strategy is HT.
RewardFunc
ClientType
Client implementation to use. Set via ClientConfig.client_type.
Data Types
State
dict subclass that tracks rollout information. Accessing keys in INPUT_FIELDS automatically forwards to the nested input object.
Fields set during initialization:
Fields set after scoring:
RolloutInput
RolloutOutput
dict subclass that provides typed access to known fields while supporting arbitrary additional fields from state_columns. All values must be JSON-serializable. Used in GenerateOutputs and for saving results to disk.
TrajectoryStep
RoutedExpertsPayload
TrajectoryStepTokens
TimeSpan
TimeSpans
RolloutTiming
total = scoring.end - generation.startoverhead = total - setup.duration - model.duration - env.duration - scoring.duration
generation.start is stamped at the top of the rollout (before setup_state), so total covers the entire rollout including setup, generation loop, finalize, and scoring. overhead captures any time not attributed to the named phases.
TokenUsage
In a single-turn rollout,
input_tokens == final_input_tokens and output_tokens == final_output_tokens. In a multi-turn rollout, input_tokens > final_input_tokens because earlier turns’ prompts are counted again.
The final_* metrics assume a single, continuously extended trajectory. Non-linear trajectories (multi-agent, context summarization, history rewriting) are not accounted for.
GenerateOutputs
Environment.generate(). Contains a list of RolloutOutput objects (one per rollout) and generation metadata. Each RolloutOutput is a serialized, JSON-compatible dict containing the rollout’s prompt, completion, answer, reward, metrics, timing, and other per-rollout data.
GenerateMetadata
base_url is always serialized as a string. For multi-endpoint runs (e.g., using ClientConfig.endpoint_configs), it is stored as a comma-separated list of URLs.
shuffle records whether evaluation inputs were shuffled before selecting examples. shuffle_seed records the seed used for that shuffle; when shuffle is enabled without an explicit seed, the saved value is 0.
version_info captures the verifiers framework version/commit and the environment package version/commit at generation time. Populated automatically by GenerateOutputsBuilder.
RolloutScore / RolloutScores
Classes
Environment Classes
Environment
Dataset methods:
Rollout methods (used internally or by subclasses):
Calling
generate_sync() from Jupyter or another active event loop requires uv add "verifiers[notebook]".
Configuration methods:
SingleTurnEnv
Single-response Q&A tasks. Inherits fromEnvironment.
MultiTurnEnv
env_response.
Abstract method:
has_error, prompt_too_long, max_turns_reached, timeout_reached, max_total_completion_tokens_reached, has_final_env_response
Hooks:
ToolEnv
no_tools_called (ends when model responds without tool calls)
Methods:
StatefulToolEnv
Tools requiring per-rollout state. Overridesetup_state and update_tool_args to inject state.
SandboxEnv
prime sandboxes.
Key parameters:
PythonEnv
Persistent Python REPL in sandbox. ExtendsSandboxEnv.
OpenEnvEnv
.build.json), supports both gym and MCP contracts, and requires a prompt_renderer to convert observations into chat messages.
SandboxDebugEnv
SandboxTaskSet instances. It creates the task sandbox, optionally runs task setup, runs one debug step (none, gold_patch, command, or script), and optionally runs tests and scores the result. SWEDebugEnv remains as a deprecated wrapper for older callers.
EnvGroup
info["env_id"] as internal routing metadata; it is not a top-level input, state, or output field.
Parser Classes
Parser
XMLParser
ThinkParser
</think> tag. For models that always include <think> tags but don’t parse them automatically.
MaybeThinkParser
Handles optional<think> tags (for models that may or may not think).
Rubric Classes
Rubric
1.0. Functions with weight=0.0 are tracked as metrics only.
Methods:
Reward function signature:
JudgeRubric
LLM-as-judge evaluation.MathRubric
Math-specific evaluation usingmath-verify.
RubricGroup
Combines rubrics forEnvGroup.
Client Classes
Client
vf types (Messages, Tool, Response) and provider-native formats. The client property exposes the underlying SDK client (e.g., AsyncOpenAI, AsyncAnthropic).
get_response() is the main public method — it converts the prompt and tools to the native format, calls the provider API, validates the response, and converts it back to a vf.Response. Errors are wrapped in vf.ModelError unless they are already vf.Error or authentication errors.
Abstract methods (for subclass implementors):
Built-in Client Implementations
All built-in clients are available as
vf.OpenAIChatCompletionsClient, vf.AnthropicMessagesClient, etc.
Response
Client implementations return Response from get_response().
Tool
Client converts them to its native format via to_native_tool().
Configuration Types
ClientConfig
extra_headers_from_state maps HTTP header names to state field names. For each inference request, the header value is dynamically read from the rollout state dict. For example, {"X-Session-ID": "trajectory_id"} adds a X-Session-ID header with the value of state["trajectory_id"], enabling sticky routing at the inference router level.
client_type selects which Client implementation to instantiate (see Client Classes). Use endpoint_configs for multi-endpoint round-robin. In grouped scoring mode, groups are distributed round-robin across endpoint configs.
preserve_all_thinking and preserve_thinking_between_tool_calls are forwarded to the underlying renderer when client_type == "renderer". They control whether past-assistant reasoning_content is re-emitted on subsequent renders — preserve_all_thinking keeps every past-assistant turn’s thinking, and preserve_thinking_between_tool_calls keeps thinking only inside the in-flight assistant→tool→…→assistant block after the most recent user turn (when that block contains at least one tool response). Both default to False (template default applies).
When api_key_var is "PRIME_API_KEY" (the default), credentials are loaded with the following precedence:
- API key:
PRIME_API_KEYenv var >~/.prime/config.json>"EMPTY" - Team ID:
PRIME_TEAM_IDenv var >~/.prime/config.json> not set
prime login.
EndpointClientConfig
ClientConfig.endpoint_configs. Has the same fields as ClientConfig except endpoint_configs itself, preventing recursive nesting.
EvalConfig
EndpointConfig
api_key_var is a credential reference. Endpoint configs never serialize the materialized API key.
Endpoints maps an endpoint id to one or more endpoint variants. A single variant is represented as a one-item list.
Prime CLI Plugin
Verifiers exposes a plugin contract consumed byprime for command execution.
PRIME_PLUGIN_API_VERSION
prime and verifiers.
PrimeCLIPlugin
build_module_command returns a subprocess command list for python -m <module> ....
get_plugin
prime.
Decorators
@vf.stop
is_completed().
@vf.cleanup
@vf.teardown
Utility Functions
Data Utilities
\boxed{} format. When strict=True, returns "" if no \boxed{} is found (used by MathRubric to avoid scoring unformatted responses). When strict=False (default), returns the original text as a passthrough.
#### marker (GSM8K format).
Environment Utilities
"primeintellect/gsm8k").
Configuration Utilities
MissingKeyError (a ValueError subclass) with a clear message listing all missing keys and instructions for setting them.
Logging Utilities
VF_LOG_LEVEL env var to change default.
vf.log_level("WARNING").