Example
This example demonstrates how to validate complex execution flows with parallel tool execution and sequential processing using nestedseq! and parallel! validators.
Eval Configuration
evals.yaml
Agent Implementation
agent.py
Running Evaluations
How It Works
- Initial Processing: The agent starts with an LLM call to understand the request.
-
Parallel Execution: Two tools (
get_datetimeandget_weather) execute in parallel usingparallel!, improving efficiency by fetching independent data simultaneously. -
Sequential Processing: After parallel execution completes,
search_flightsruns sequentially, as it may depend on the previous results. - Final Processing: A final LLM call synthesizes all the gathered information into a response.
-
Validation: The
seq!validator ensures:- Tools execute in the correct order
- Parallel tools run simultaneously (overlapping execution times)
- Tool inputs match expected values using nested validators
Evaluation Results
Successful Validation
When the agent follows the expected workflow with parallel and sequential execution:Failed Validation
When the agent doesn’t follow the expected execution pattern:Key Features
- Nested Flow Validation: Combine
seq!andparallel!to validate complex execution patterns - Parallel Execution: Use
parallel!to ensure independent tools run simultaneously for better performance - Sequential Processing: Use
seq!to enforce order when tools depend on previous results - Tool Input Validation: Validate tool input parameters using nested validators within flow validators
- Span Validation: Validate individual span properties (input, output, elapsed, usage) within sequences
- Workflow Compliance: Ensure agents follow expected execution patterns and optimize tool usage