Skip to content

Hooks

Hooks allow you to run custom logic at specific points in the evaluation pipeline.

Pre-Execution Hooks

Run before the AI agent executes. Use for environment setup, file preparation, and secret injection. Learn more →

Post-Evaluation Hooks

Run after evaluation completes. Use for result export, notifications, and custom analysis. Learn more →

┌─────────────────────┐
│ Workspace Setup │
└──────────┬──────────┘
┌─────────────────────┐
│ Pre-Execution Hooks │◄── Setup, inject secrets, modify files
└──────────┬──────────┘
┌─────────────────────┐
│ Agent Execution │
└──────────┬──────────┘
┌─────────────────────┐
│ Evaluators │
└──────────┬──────────┘
┌─────────────────────┐
│Post-Evaluation Hooks│◄── Export, notify, analyze
└──────────┬──────────┘
┌─────────────────────┐
│ Results │
└─────────────────────┘
AspectPre-ExecutionPost-Evaluation
WhenBefore agent runsAfter evaluators complete
PurposeSetup workspaceExport/notify
ExecutionSequential (one at a time)Parallel (all at once)
Failure behaviorStops evaluationNever fails main evaluation
AccessCan modify workspaceRead-only access to results
suite.yaml
pre_execution:
- name: script
config:
command: bash
args:
- "-c"
- |
echo "Setting up environment..."
mkdir -p ${WORKSPACE_DIR}/config
echo '{"apiKey": "test"}' > ${WORKSPACE_DIR}/config/secrets.json
post_evaluation:
- name: webhook
config:
url: ${SLACK_WEBHOOK_URL}
method: POST
HookDescription
scriptRun shell scripts for custom setup
HookDescription
databaseExport results to JSON/JSONL files
webhookPOST results to HTTP endpoints
scriptRun custom analysis scripts

All hooks have access to these variables:

VariableDescription
WORKSPACE_DIRWorkspace directory path
REPO_DIRRepository directory
ARTIFACTS_DIRArtifacts directory
TEST_CASE_NAMETest case name
REPO_URLRepository URL
BRANCHBranch being tested

Post-evaluation hooks also have:

VariableDescription
RESULTS_PATHPath to results.json