Overview

The Qhaway MLflow exporter sends agent telemetry to MLflow for experiment tracking. Each agent session becomes an MLflow run with metrics and parameters.

Installation

npm install @carloscortezcloud/qhaway

Usage

Batch Export

import { QhawayMLflow } from '@carloscortezcloud/qhaway/mlflow';

const mlflow = new QhawayMLflow({
  trackingUri: 'http://localhost:5001',
  experimentName: 'finops-agent',
  batchSize: 50,
});

// Export spans in batch
await mlflow.exportSpans([
  {
    id: 'span-1',
    timestamp: '2026-07-29T00:00:00Z',
    model: 'gpt-4o',
    provider: 'openai',
    latency_ms: 1234,
    tokens_in: 150,
    tokens_out: 42,
    cost_usd: 0.00063,
    agent_id: 'finops-agent',
    success: true,
  },
]);

Streaming Mode

const mlflow = new QhawayMLflow({
  trackingUri: 'http://localhost:5001',
});

// Use as QhawayStorage interface
const trace = new QhawayTrace(mlflow, { agent_id: 'my-agent' });
// Each span is flushed to MLflow automatically

MLflow Run Structure

Each session_id maps to an MLflow run:

MLflow Entity Value
Experiment experimentName (e.g., “finops-agent”)
Run ID Generated per session
Metrics cost_usd, latency_ms, iterations, prompt_tokens, completion_tokens, successful_calls, failed_calls
Parameters models, tools, session_id, agent_name
Tags provider, model, agent_id

Use Cases

  • A/B test models: Run the same agent with GPT-4o vs Claude vs Gemma, compare cost + quality
  • Cost tracking: Track cost per experiment version
  • Regression detection: Compare latency/error rates across versions