Add MLflow tracking hook#3433
Merged
jjallaire merged 1 commit intoMar 7, 2026
Merged
Conversation
Adds an MLflow tracking hook that logs Inspect evaluation runs as MLflow experiments. Creates a parent run per eval with nested child runs per task, logging parameters, scores, token usage, and timing. Integrates on_sample_event for real-time model call and tool usage tracking as step metrics during evaluation. Follows the same examples/hooks pattern as the existing W&B/Weave hook. Opt-in via MLFLOW_TRACKING_URI environment variable. Signed-off-by: debu-sinha <debusinha2009@gmail.com>
This was referenced Mar 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #3417
Adds an MLflow tracking hook that logs Inspect evaluations as MLflow experiments. Follows the same
examples/hooks/pattern as the existing W&B/Weave hook.Run hierarchy:
eval()callon_sample_event(model calls, tool usage)Usage
Set
MLFLOW_TRACKING_URIand import the hook:The hook activates automatically when
MLFLOW_TRACKING_URIis set. OptionalMLFLOW_EXPERIMENT_NAMEdefaults to"inspect_ai".What gets logged
on_run_starton_task_starton_sample_endon_sample_eventon_model_usageon_task_endon_run_endThe
on_sample_eventintegration tracksModelEvent(input/output tokens, call duration) andToolEvent(function name, error flag, duration) as they happen during evaluation, giving step-by-step visibility into model and tool behavior in the MLflow UI.Screenshots
Tested locally against a real MLflow server with
openai/gpt-4o-mini(2 tasks, 8 samples).Task run overview showing metrics (scores, token usage, event counts) and tags (task name, model, dataset size):
Model metrics tab showing real-time step charts from

on_sample_event(input/output tokens per model call, call duration):Parent run with nested child runs per task:
Testing
12 unit tests covering the full lifecycle, event handling, score conversion, and edge cases:
All 27 existing hooks tests continue to pass.