File Structure
Evals are defined in YAML files. Each file can contain multiple eval definitions:Eval Definition
Required Fields
Optional Fields
Params Structure
Theparams field contains input parameters passed to your runnable:
Simple Prompt
With Messages
Usemessages to establish conversation history for multi-turn testing:
Additional Parameters
Pass any additional parameters your agent accepts:Validating Output
Theoutput section validates the final response from your agent:
Validating Timing
Theelapsed section validates total execution time in milliseconds:
Validating Tool Spans
Validate specific tools by their name:Validating Token Usage
Access usage metrics on LLM spans:The token field names depend on the model provider:
- OpenAI: Use
input_text_tokensandoutput_text_tokens(e.g.,input_text_tokens: lte!: 500,output_text_tokens: lte!: 1000) - Anthropic: Use
input_tokensandoutput_tokens(e.g.,input_tokens: lte!: 500,output_tokens: lte!: 1000)
Flow Validators
Sequence Validation
Useseq! to validate the order of tool execution:
Parallel Validation
Useparallel! to validate concurrent execution:
Nested Flow Validation
Combine sequence and parallel:Span Validation Within Sequence
Validate span inputs/outputs within the sequence:Complete Example
Wildcard Patterns in Sequences
Tags and Filtering
Use tags to organize and filter evals:Environment Variables
Set environment variables for specific evals:Best Practices
Use descriptive names
Use descriptive names
Names should clearly indicate what’s being tested:
Combine validators effectively
Combine validators effectively
Use multiple validators to thoroughly test behavior:
Validate both output and execution
Validate both output and execution
Don’t just check the output - validate how the agent got there:
Use LLM validators for natural language
Use LLM validators for natural language
For outputs that can vary in wording but should convey the same meaning:Prefer
prompt! (a verifiable statement about the output) for behavioral checks. Use semantic! when matching against a description of tone or style, e.g. semantic!: "A professional, empathetic response".Test edge cases
Test edge cases
Create specific evals for error conditions:
File Naming Conventions
Timbal discovers eval files matching these patterns:eval*.yaml- e.g.,eval_search.yaml,evals.yaml*eval.yaml- e.g.,search_eval.yaml,my_eval.yaml