Trace sources: score traces kept in MLflow
A TraceSource that reads an agent harness’s MLflow traces, scores them and writes the scores back.
Source: examples/sources. Read the guide for the concepts behind it.
clickhouse-scores.sql
Section titled “clickhouse-scores.sql”-- Execute in the same database as the Collector's otel_traces table.-- For a different trace table name, replace otel_traces in the table name.CREATE TABLE IF NOT EXISTS otel_traces_evalsi_scores ( TraceId String, Policy String, Metric String, Score Nullable(Float64), Value Nullable(String), Passed Nullable(Bool), Rationale String, Evaluator String, Judged Bool, Version UInt64) ENGINE = ReplacingMergeTree(Version)ORDER BY (TraceId, Policy, Metric);
-- Read with FINAL for one current row per trace/policy/metric, even before-- background merges. Replays can leave physical rows until those merges run.-- SELECT * FROM otel_traces_evalsi_scores FINAL;clickhouse.yaml
Section titled “clickhouse.yaml”apiVersion: evalsi.dev/v1alpha1kind: TraceSourcemetadata: name: support-clickhouse labels: {evalsi.dev/project: studio}spec: connector: clickhouse endpoint: https://clickhouse.example.com:8443 locations: [observability.otel_traces] credentials: {env: CLICKHOUSE_SOURCE_CREDENTIAL} backfill: {since: 720h} poll: {interval: 15s, maxRecordsPerSecond: 100} maxTraceDuration: 1h policies: [agent-health] writeBack: {enabled: true}studio-mlflow.yaml
Section titled “studio-mlflow.yaml”# A trace source: evalsid reads the traces an agent harness already keeps in# MLflow, scores them with the project's online policies, and writes the# scores back as MLflow assessments (docs/guides/trace-sources.md).## kubectl apply -f studio-mlflow.yaml # with the operator# evalsi source apply -f studio-mlflow.yaml --server $URLapiVersion: evalsi.dev/v1alpha1kind: TraceSourcemetadata: name: studio-mlflow labels: {evalsi.dev/project: support}spec: connector: mlflow endpoint: https://mlflow.example.com locations: ["1"] # MLflow experiment IDs # A Secret the chart mounts (sources.secrets), granted to the project for # this host in credentials.grants as file:mlflow-token/token. credentials: {file: mlflow-token/token} backfill: {since: 720h} # read 30 days of history first poll: {interval: 30s} maxTraceDuration: 30m # a trace running longer is missed policies: [support-agent] writeBack: {enabled: true}