liveBook · Manning

Chapter 9: Governance and operations

What you will learn in chapter 9 of Context Engineering

Introduces governance and operations as the assurance disciplines that help context-aware AI systems run reliably and responsibly in production.

After this chapter you will be able to

What it builds on

Section by section

Introduction

Introduces governance and operations as the assurance disciplines that help context-aware AI systems run reliably and responsibly in production.

Key terms: governance, operations, cross-cutting assurance disciplines

9.1 Governance

Defines AI governance, identifies complementary governance frameworks and six shared pillars, and explains why context pipelines must enforce access permissions.

Key terms: AI governance, structures, processes, guardrails, OECD AI Principles, NIST AI Risk Management Framework, WEF AI Global Alliance, ISO/IEC 42001, EU AI Act, governance pillars

9.1.1 Privacy

Explains where privacy risks arise in LLM systems and how to limit sensitive-data exposure across context assembly, testing, retention, logging, and provider use.

Key terms: privacy, personally identifiable information (PII), training-data memorization, runtime context exposure, data minimization, purpose limitation, scoped authorization, automated redaction, synthetic data generation, explicit retention limits

9.1.2 Safety and security

This section distinguishes AI safety from security, explains why prompt injection threatens both, and describes layered controls for context-aware systems.

Key terms: AI security, AI safety, guardrails, prompt injection, direct injection, indirect injection, untrusted context data, defense in depth, input and output guardrails, provenance labeling

9.1.3 Accountability

Explains how traceable, versioned records make organizations accountable for AI decisions and allow disputed outputs to be reconstructed.

Key terms: accountability, full traceability, version control, immutable audit traces, trace record

9.1.4 Transparency

Defines transparency in AI systems and shows how it serves users and operators.

Key terms: transparency, explainability, user-facing transparency, operator-facing transparency, execution traces, context lineage

9.1.5 Fairness

Defines fairness in AI outcomes and explains why fairness checks must examine the context that shapes those outcomes, not just final responses.

Key terms: fairness pillar, unjustified disparities, protected characteristics, context management layer, biased retrieval, discriminatory heuristics, intermediate context representations, memory entries

9.1.6 Human oversight

This section explains how to match human oversight to an AI action’s risk and how to make oversight actionable in a customer support assistant.

Key terms: human oversight, human-in-the-loop (HITL), human-on-the-loop (HOTL), human-out-of-the-loop (HOOTL), risk, impact, escalation routes, review queues, operator interfaces

9.1.7 Governance in practice

This subsection turns governance pillars into production-readiness checks and notes that some checks require human judgment.

Key terms: pillar, concrete control, production readiness gate, human judgment, technical guardrails

9.2 Human-in-the-loop

Explains how production AI systems use human-in-the-loop review to handle risky or ambiguous decisions while managing the cost of oversight.

Key terms: HITL, dynamic context injectors, authoritative fail-safes, policy engine, confidence and risk thresholds, review queue, trace store, output validation, ambiguity resolution, safety and approval gates

9.3 Operations

Introduces why production context-aware systems need operations that account for both changing context and the distinctive behavior of LLMs.

Key terms: operations, context-aware systems, infrastructure load, DevOps, nondeterminism, probabilistic outputs, evolving data dependencies

9.3.1 Adoption models

This section compares four ways organizations adopt generative AI by the control, trust boundaries, and operational responsibilities each gives them.

Key terms: adoption model, adoption posture, trust boundary, context artifacts, SaaS consumer, API integrator, LLM as a service, context stack, LLM off-the-shelf, model hoster

9.3.2 DevOps for AI systems

This section explains how DevOps branches into operational disciplines for model hosts and model consumers, with ContextOps organizing responsibilities around context sources.

Key terms: DevOps, MLOps, FMOps, LLMOps, model hosting side, model consumer side, GenAIOps, ContextOps, context sources, PromptOps

9.3.3 LLMOps

This section explains how LLMOps adapts a foundation model for a production context and keeps its serving, caching, releases, and behavior reliable and governed.

Key terms: LLMOps, foundation model, model serving, fine-tuning, parameter-efficient fine-tuning (PEFT), prompt learning, alignment optimization, cache-augmented generation (CAG), cached prompt prefix, time-to-live

9.3.4 PromptOps

Explains why production prompts need code-like management and describes the main PromptOps practices for changing, testing, and monitoring them.

Key terms: PromptOps, configuration artifacts, system prompt template, user prompt template, prompt versioning, automated evaluation, golden set, A/B testing, monitoring and logging, prompt regression suites

9.3.5 RAGOps

This section explains how RAGOps keeps production RAG systems reliable through connected query-processing and data-management workflows, evaluation, and runtime monitoring.

Key terms: RAGOps, runtime query-processing pipeline, data-management indexing pipeline, query reformulation, retriever execution, reranking, output validation, continuous telemetry, regression traces, ingestion and verification

9.3.6 AgentOps

This section explains why agentic systems need dedicated operations, how the AgentOps lifecycle handles failures, and how to govern tools that take external actions.

Key terms: AgentOps, state management, traceability, monitoring, agent-specific events, checkpoints, anomaly detection, root cause analysis, resolution, tool governance

9.3.7 Context as code

This section treats context configurations as software artifacts and explains the operational practices that make their changes testable, promotable, and auditable.

Key terms: context as code, context configurations, first-class software artifacts, context sources, version control, modularity and reusability, environment promotion, automated quality gates, CI/CD, version-controlling context artifacts

9.3.8 Deployment

This section explains what AI deployment includes, how deployment responsibilities vary by adoption model, and how controlled rollouts and release criteria reduce production risk.

Key terms: deployment, context sources, guardrails, orchestration workflow, SaaS consumers, API integrators, LLM off-the-shelf deployments, model hosters, blue-green deployment, canary release

9.4 Hands-on

This section introduces practical examples of governance and operational controls for context-engineered systems using open-source tools.

9.4.1 Automated PII redaction with Microsoft Presidio

This section shows how Microsoft Presidio redacts sensitive information and explains what affects redaction quality.

Key terms: Microsoft Presidio, analyzer engine, anonymizer, redaction policy, recognizer coverage, language support, false positives, false negatives, domain-specific recognizers, human review

9.4.2 Output validation with JSON Schema

Shows how structured output validation can combine schema requirements with business policy checks for AI-agent governance.

Key terms: JSON Schema, Pydantic, runtime validation, business policy checks, parsed, repair loops, retries

9.4.3 Bias detection for fairness

This section shows how group-level selection rates can reveal potential bias in credit approval recommendations and how to interpret a disparity signal cautiously.

Key terms: fairness audit, sensitive attributes, MetricFrame, selection rate, four-fifths rule, demographic parity ratio

9.4.4 Basic HITL interaction pattern

This section illustrates human-in-the-loop interaction through a story-writing assistant that pauses for user input after each AI-generated paragraph.

Key terms: HITL, initial premise, approve, new instructions

9.4.5 AI gateway with LiteLLM

This section uses a mocked LiteLLM example to show how an AI gateway gives an application one interface while routing requests and handling provider fallback.

Key terms: AI gateway, proxy, unified interface, model-agnostic, LiteLLM, primary model, primary-path failure, fallback routing, mocked responses, alternate provider

9.4.6 Context as code with versioned prompt templates

Shows how to treat a prompt template as versioned code, test changes in CI, and turn governance policies into executable checks.

Key terms: prompt_template.j2, Jinja2, source of truth, evaluation gate, GitHub Actions, CI, governance, pipeline, policy, versioned prompt templates

9.5 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 8: Evaluation and observability Chapter 10: AI frameworks for context engineering →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.