Writes iteration data to JSON-lines files for post-hoc analysis.
Each line is a JSON object representing either: - Metadata (first line): Configuration and setup - Iteration: Complete iteration with prompt, response, code blocks, results
Beautiful, human-readable terminal output for debugging.
Simplified from rlmpaper’s version - focuses on core visibility without heavy styling.
VerbosePrinter
def VerbosePrinter( enabled:bool=True):
Console printer for RLM verbose output using Rich.
Provides real-time visibility into RLM execution with beautiful formatting. Falls back to simple print if Rich is not installed.
Example: verbose = VerbosePrinter(enabled=True) verbose.print_header(query=‘What is X?’, max_iters=5) verbose.print_iteration(iteration, 1)
Test VerbosePrinter:
# Test with Rich if availableverbose = VerbosePrinter(enabled=True)verbose.print_header( query="What is the Activity class in PROV?", context="PROV ontology loaded", max_iters=3)# Mock iterationresult = REPLResult( stdout="Activity: http://www.w3.org/ns/prov#Activity", stderr="",locals={}, execution_time=0.05)block = CodeBlock(code="search_by_label(prov_meta, 'Activity')", result=result)iteration = RLMIteration( prompt="Find Activity class", response="Let me search for the Activity class", code_blocks=[block])verbose.print_iteration(iteration, 1)verbose.print_final_answer("The Activity class represents processes in PROV.")verbose.print_summary(total_iterations=1, total_time=1.5)print("\n✓ VerbosePrinter works")