Loading...
Loading...
Retrieves MLflow traces using CLI or Python API. Use when the user asks to get a trace by ID, find traces, filter traces by status/tags/metadata/execution time, query traces, or debug failed traces. Triggers on "get trace", "search traces", "find failed traces", "filter traces by", "traces slower than", "query MLflow traces".
npx skill4agent add mlflow/skills retrieving-mlflow-traces| You have... | Use | Command |
|---|---|---|
| Trace ID | Single fetch | |
| Session/user/filters | Search | |
mlflow traces get --trace-id tr-69f72a3772570019f2f91b75b8b5ded9mlflow traces search --experiment-id 1 --filter-string "metadata.\`mlflow.trace.session\` = 'session_abc'"trace_idstatustimestamp_msexecution_time_mstagsmetadataassessmentsnametypeattributesstart_timeend_timemlflow traces search --helpmlflow traces search --helpmlflow traces search# All traces for a run
mlflow traces search --run-id <run_id>
# Failed traces for a run
mlflow traces search --run-id <run_id> --filter-string "trace.status = 'ERROR'"
# Can combine with experiment-id
mlflow traces search --experiment-id 1 --run-id <run_id># All traces for a specific session (use backticks for special characters in key)
mlflow traces search --experiment-id 1 --filter-string "metadata.\`mlflow.trace.session\` = 'session_abc123'"
# All traces for a specific user
mlflow traces search --experiment-id 1 --filter-string "metadata.\`mlflow.trace.user\` = 'user_456'"
# Failed traces in a session (for root cause analysis)
mlflow traces search --experiment-id 1 --filter-string "metadata.\`mlflow.trace.session\` = 'session_abc123' AND trace.status = 'ERROR'"
# Session traces ordered by time (to see sequence of events)
mlflow traces search --experiment-id 1 --filter-string "metadata.\`mlflow.trace.session\` = 'session_abc123'" --order-by "timestamp_ms ASC"mlflow traces search --experiment-id 1 --filter-string "trace.status = 'ERROR'"
mlflow traces search --experiment-id 1 --filter-string "trace.status = 'OK'"# Timestamps are in milliseconds since epoch
# Get current time in ms: $(date +%s)000
# Last hour: $(( $(date +%s)000 - 3600000 ))
mlflow traces search --experiment-id 1 --filter-string "trace.timestamp_ms > $(( $(date +%s)000 - 3600000 ))"# Traces slower than 1 second
mlflow traces search --experiment-id 1 --filter-string "trace.execution_time_ms > 1000"# By tag
mlflow traces search --experiment-id 1 --filter-string "tag.environment = 'production'"
# By metadata
mlflow traces search --experiment-id 1 --filter-string "metadata.user_id = 'user_123'"
# Escape special characters in key names with backticks
mlflow traces search --experiment-id 1 --filter-string "tag.\`model-name\` = 'gpt-4'"
mlflow traces search --experiment-id 1 --filter-string "metadata.\`user.id\` = 'abc'"mlflow traces search --experiment-id 1 --filter-string "feedback.rating = 'positive'"mlflow traces search --experiment-id 1 --filter-string "trace.text LIKE '%error%'"# Limit results per page
mlflow traces search --experiment-id 1 --max-results 50
# Output includes "Next page token: <token>" if more results exist
# Use --page-token to fetch next page
mlflow traces search --experiment-id 1 --max-results 50 --page-token "eyJvZmZzZXQiOiA1MH0="# Output format (table or json)
mlflow traces search --experiment-id 1 --output json
# Include span details in output
mlflow traces search --experiment-id 1 --include-spans
# Order results
mlflow traces search --experiment-id 1 --order-by "timestamp_ms DESC"mlflow traces getmlflow traces get --trace-id <trace_id>WebFetch(
url: "https://mlflow.org/docs/latest/genai/tracing/search-traces.md",
prompt: "Extract the filter syntax table showing supported fields, operators, and examples."
)trace.statustrace.execution_time_mstrace.timestamp_msmetadata.\, tag.<key>metadata.<key>span.namespan.typefeedback.<name>expectation.<name>LIKEILIKERLIKEmlflow.search_traces()