Part II: Discovery Through Software Engineering and Vibe Coding
Chapter 22: MLOps, LLMOps, and AgentOps

MLOps, LLMOps, and AgentOps

"I trained a model that achieved state-of-the-art accuracy on the validation set, deployed it to production on a Tuesday, and by Thursday it was confidently classifying everything as 'cat.' Nobody changed the model. The world changed the data."

A Production ML Engineer Who Learned About Distribution Shift the Hard Way

Overview

Building a model is the easy part. Keeping it alive, honest, and cost-effective in production is where the real engineering begins. MLOps, LLMOps, and AgentOps represent three generations of operational discipline, each layered on the last: MLOps manages the lifecycle of trainable models (data pipelines, feature stores, experiment tracking, model registries, distribution shift monitoring). LLMOps extends the paradigm to large language models, where the "model" is a frozen API endpoint and the moving parts are prompts, retrieval contexts, evaluation harnesses, and token budgets. AgentOps adds another layer for autonomous agents, where a single user request triggers chains of tool calls, each with its own latency, cost, failure mode, and observability requirements.

This chapter traces the full lifecycle from data ingestion to retirement. We begin with model lifecycle management: data pipelines, feature stores, experiment tracking with MLflow and Weights & Biases, model registries, and the statistical machinery for detecting when production data drifts away from training data. We then move to LLMOps and AgentOps: prompt versioning, evaluation frameworks, cost optimization, trace logging with LangSmith and Arize Phoenix, tool-call monitoring, and governance through model cards and audit trails. Finally, we build a complete lifecycle tracking dashboard that integrates experiment tracking, prompt evaluation, agent tracing, and drift detection into a single Discovery Workbench component.

The connection to discovery is direct. Scientific models, like production ML models, degrade when the world changes. The distribution shift detection techniques from this chapter apply equally to a recommendation system seeing new user behavior and to a molecular property predictor encountering a novel chemical scaffold. The experiment tracking discipline connects to the provenance systems of Chapter 47. The DevOps pipelines from Chapter 21 become the deployment substrate for everything we build here. And the evaluation frameworks anticipate the agent evaluation methods of Chapter 23.

Prerequisites

Readers should have completed Chapter 21: AI for DevOps and Platform Engineering, which introduced CI/CD pipelines, infrastructure as code, and observability. Familiarity with Chapter 17: Multi-Agent Software Teams is helpful for understanding the agent orchestration patterns that AgentOps monitors. Basic knowledge of scikit-learn model training, REST APIs, and Docker containers is assumed. Experience with the Discovery Workbench from Chapter 6 is helpful for the dashboard recipe in Section 22.3.

Learning Outcomes

Sections

22.1 Model Lifecycle Management

Data pipelines and feature stores for reproducible training. Experiment tracking with MLflow. Model registries and lifecycle stages. Distribution shift detection with MMD and PSI. DVC for data versioning. Governance through model cards.

22.2 LLMOps and AgentOps

Prompt versioning and management. LLM evaluation frameworks: automated scoring, human preference, and LLM-as-judge. Cost optimization and token budgeting. Agent trace logging with LangSmith and Arize Phoenix. Tool-call monitoring, retry policies, and circuit breakers.

22.3 Building a Lifecycle Dashboard

Recipe: a complete lifecycle tracking dashboard integrating MLflow experiment data, prompt evaluation results, agent traces, and distribution shift alerts into a unified Discovery Workbench component.

What's Next

With the operational infrastructure for tracking, evaluating, and governing ML systems in place, the natural question becomes: how do we evaluate the AI coding agents themselves? Chapter 23: Evaluating AI Coding Agents takes the evaluation frameworks introduced here and specializes them for measuring code generation quality, task completion rates, and the subtle failure modes that emerge when agents write software autonomously. The tracing and monitoring patterns from AgentOps become the observability layer for those evaluations, and the model card governance framework extends to documenting agent capabilities and limitations.

Bibliography

Foundational Papers

Sculley, D., et al. (2015). Hidden technical debt in machine learning systems. Proc. NeurIPS 2015.

The foundational paper on ML systems debt, showing that the model training code is a small fraction of a production ML system. Motivates the entire MLOps discipline covered in Section 22.1.

Mitchell, M., et al. (2019). Model cards for model reporting. Proc. FAT* 2019.

Introduces the model card framework for documenting trained models, including intended use, performance metrics, and ethical considerations. Used in Section 22.1 for governance.

Shankar, S., et al. (2022). Operationalizing machine learning: An interview study. arXiv:2209.15003.

An interview study of ML practitioners documenting the gap between model development and production deployment, grounding the practical challenges addressed throughout this chapter.

Tools and Libraries

MLflow (2024). MLflow: An open-source platform for the machine learning lifecycle.

Experiment tracking, model registry, and deployment platform. Central to Sections 22.1 and 22.3 for lifecycle management and the dashboard recipe.

Weights & Biases (2024). W&B: The AI developer platform.

Experiment tracking, hyperparameter sweeps, and model evaluation platform with rich visualization. Used in Section 22.1 as an alternative to MLflow.

DVC (2024). Data Version Control: Version control for machine learning.

Git-based data and model versioning that tracks large files without storing them in the repository. Covered in Section 22.1 for data pipeline reproducibility.

LangChain (2024). LangSmith: A platform for building production-grade LLM applications.

Tracing, evaluation, and monitoring platform for LLM and agent applications. Used in Section 22.2 for agent observability.

Arize AI (2024). Phoenix: Open-source observability for LLM applications.

Open-source LLM observability with trace visualization, evaluation, and embedding analysis. Used in Section 22.2 alongside LangSmith.

Research Frontiers

Liu, Y., et al. (2024). Datasets for large language models: A comprehensive survey. arXiv:2401.14423.

Surveys the data management challenges specific to LLM development and deployment, connecting traditional MLOps data pipelines to the LLMOps paradigm.

Zheng, L., et al. (2023). Judging LLM-as-a-judge with MT-bench and Chatbot Arena. arXiv:2311.07911.

Establishes the LLM-as-judge evaluation paradigm and benchmarks for comparing judge models, foundational to the evaluation frameworks in Section 22.2.

Yao, S., et al. (2023). Retroformer: Retrospective large language model agents. arXiv:2309.05463.

Proposes agents that learn from their own execution traces, connecting the trace logging infrastructure of AgentOps to agent self-improvement.

Rasley, J., et al. (2023). The shift from models to compound AI systems. Stanford HAI blog.

Argues that modern AI applications are compound systems (retrieval + models + tools), requiring operational practices beyond single-model MLOps.