Documentation Index
Fetch the complete documentation index at: https://mintlify.com/primeintellect-ai/verifiers/llms.txt
Use this file to discover all available pages before exploring further.
TextArenaEnv
Wrapper environment for TextArena text-based games.Overview
TextArenaEnv wraps TextArena game environments for multi-turn interaction with language models. It automatically converts TextArena games into Verifiers datasets and handles game state management.
Key features:
- Automatic dataset generation from TextArena word lists
- Efficient memory sharing for parallel rollouts
- Custom feedback transformation via
feedback_fn - Built-in XML parser for structured responses
Installation
Install with TextArena support:Inheritance
Constructor
Parameters
TextArena game ID (e.g., “Wordle-v0”, “TwentyQuestions-v0”).
Number of training examples to generate.
Number of evaluation examples to generate.
System prompt for the model. If None, uses default from MultiTurnEnv.
Parser for model responses. If None, uses
XMLParser(fields=["think", "guess"], answer_field="guess").Rubric for scoring. If None, uses default rubric.
Function to transform TextArena observations before presenting to the model. Use this to filter or reformat game state messages.
Random seed for dataset generation.
Additional arguments passed to MultiTurnEnv.
Key Methods
setup_state
- Creates a deep copy of the TextArena environment with memory sharing optimization
- Sets the secret word from
state["answer"] - Stores environment in
state["ta_env"]
env_response
- Parse guess from latest message using
parser.parse_answer() - Step the TextArena environment with the guess
- If game is done, set
state["final_env_response"]and return terminal message - Otherwise, get observation and apply
feedback_fnbefore returning
cleanup_ta_env
ta_env from state.
Example Usage
Basic Wordle Environment
Custom Feedback Function
Custom Parser and Rubric
TwentyQuestions Game
Memory Optimization
TextArenaEnv usesbuild_shared_memo() to share immutable data across environment copies:
- Problem: TextArena’s EnglishDictionary holds ~430K strings in 4 sets (~38MB). Without sharing, each rollout copies this data (~120ms + 38MB per copy).
- Solution: The shared memo dict allows deep copying to share these immutable objects, saving significant memory and time during parallel rollouts.
Available Games
Some popular TextArena games:Wordle-v0- Classic word guessing gameTwentyQuestions-v0- 20 questions gamePoker-v0- Poker game- Many more available in the TextArena repository
See Also
- TextArena Integration Guide - Setup and configuration details
- MultiTurnEnv - Base class documentation
- XMLParser - Parser for structured responses
- Wordle Example - Complete example environment