liveBook · Manning

Chapter 14: Productionizing AI agents: Memory, guardrails, and beyond

What you will learn in chapter 14 of AI Agents and Applications

The chapter introduction explains why production agents need more than models and tools, and identifies memory and guardrails as two capabilities that support reliable behavior.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The chapter introduction explains why production agents need more than models and tools, and identifies memory and guardrails as two capabilities that support reliable behavior.

Key terms: production systems, safeguards, application boundaries, memory, past interactions, follow-up questions, guardrails, intended scope, policy framework

14.1 Memory

This section explains why memory matters for conversational AI agents: it preserves context across interactions so users can follow up naturally.

Key terms: memory, context, stateful workflows

14.1.1 Types of memory

Defines three scopes of AI-agent memory by how long information persists and who can use it.

Key terms: short-term memory, long-term user memory, long-term application-level memory

14.1.2 Why short-term memory is needed

The section explains how retaining conversation history lets a tool-calling assistant handle follow-up questions without losing context.

Key terms: stateless, conversation history, stateful, short-term memory, tool-calling protocol, tool calls, tool results

14.1.3 Checkpoints in LangGraph

Explains how LangGraph checkpoints save graph state and use thread IDs to restore the right state across invocations.

Key terms: checkpoint, checkpointer, super-step, graph state, configuration, thread, thread ID, state rehydration, human-in-the-loop workflows, multi-turn conversational context

14.1.4 Adding short-term memory to our travel assistant

The section adds short-term memory to a router-based travel assistant by identifying conversation threads, checkpointing graph state, and configuring the LLM to reference previous responses.

Key terms: thread ID, RunnableConfig, state, travel_assistant.invoke(), checkpointer, state snapshots, InMemorySaver, persistent storage backend, SqliteSaver, PostgresSaver

14.1.5 Executing the checkpointer-enabled assistant

This subsection shows that a checkpointer-enabled travel assistant can use conversation history to understand a follow-up question.

Key terms: LangGraph checkpointer, short-term conversational memory, full conversation history

14.1.6 Rewinding the state to a past checkpoint

This section uses a manual checkpoint rewind to show how LangGraph restores conversational context for a follow-up turn.

Key terms: state history, StateSnapshot, checkpoint, START node, checkpointer, thread_id, checkpoint_id, rehydrate, short-term conversational memory

14.2 Guardrails

This section explains what guardrails do, the main ways they make checks, and where those checks can fit in an agent workflow.

Key terms: guardrails, validation layers, rule-based, retrieval-based, model-based, pre-model checks, post-model checks, routing-stage checks, tool-level checks

14.2.1 Implementing guardrails to reject nontravel-related questions

This section adds a domain-relevance guardrail to a UK travel assistant so nontravel questions receive a refusal before reaching downstream agents.

Key terms: domain relevance check, prefilter, in-scope, GuardrailDecision, is_travel, reason, GUARDRAIL_SYSTEM_PROMPT, REFUSAL_INSTRUCTION, llm_guardrail, router agent

14.2.2 Implementing more restrictive guardrails at the agent level

This section adds Cornwall-specific input guardrails to two agents, supplementing the router’s broader travel filter.

Key terms: router-level, agent-level, input guardrails, fail-fast filter, Cornwall, travel information agent, accommodation booking agent, vector store, pre_model_guardrail(), pre_model_hook

14.3 Beyond this chapter

This section explains that memory and guardrails are important for production-ready agents, but deployment may require further work depending on the application.

Key terms: memory, guardrails, production-ready, domain, scale, compliance requirements

14.3.1 Long-term user and application memory

This section contrasts session-limited memory with persistent memory and identifies the benefits and planning challenges of retaining user information over time.

Key terms: short- to medium-term memory, long-term memory, personalization, dedicated vector stores, summarization and pruning, personally identifiable information (PII), privacy and compliance controls

14.3.2 Human-in-the-loop

This section explains when a travel assistant should involve a human expert and how human review can improve the assistant over time.

Key terms: human-in-the-loop, escalated, human travel expert, early production deployments, human reviews, guardrails, automated policies

14.3.3 Post-model guardrails

This section explains how post-model guardrails check a travel assistant’s output before it reaches a user or downstream service.

Key terms: post-model guardrails, final safety net, downstream service, filtering outdated or incorrect details, redacting sensitive information, brand tone and style, verifying structured output

14.3.4 Evaluation of AI agents and applications

This section explains what to evaluate in a production travel assistant and why evaluation must continue after launch.

Key terms: functional testing, behavioral testing, performance testing, regression testing, ground truths, systematic evaluation, continuous evaluation, production readiness

14.3.5 Deployment on the LangGraph platform and Open Agent Platform

This section compares deployment paths for production agents and explains how infrastructure and compliance needs shape the choice between managed hosting and greater operational control.

Key terms: SaaS, data residency, compliance, client’s own cloud environment, LangGraph Platform, horizontal scalability, persistent state management, LangSmith, Open Agent Platform, OAP

14.4 Summary

The summary connects conversational memory, guardrails, and production practices that help agents resume work, stay within scope, and operate reliably.

Concepts explained in this chapter

← Chapter 13: Building and consuming MCP servers

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.