liveBook · Manning

Chapter 2: Working with ADPs: Building a mortgage advisor tool

What you will learn in chapter 2 of Agent Design Patterns

This introduction frames a reliable mortgage-advisor agent as a case study and outlines its information-gathering, analysis, reporting, and compliance workflow using agent design patterns.

After this chapter you will be able to

What it builds on

Section by section

Introduction

This introduction frames a reliable mortgage-advisor agent as a case study and outlines its information-gathering, analysis, reporting, and compliance workflow using agent design patterns.

Key terms: mortgage advisor, generalist conversational assistant, specialized knowledge, standardized assessments, verified tools, financial advice regulations, advisory pipeline, kickoff message, analyses in parallel, aggregate

2.1 Agent Flow Diagrams

This section introduces Agent Flow Diagrams as a simple notation for visualizing agent behavior and uses one to outline the mortgage advisor workflow.

Key terms: agent flow diagrams, AFDs, deterministic behavior, nondeterministic behavior, contexts, filled circle, hollow circle, half-filled circle, solid line with an arrow end, dashed line with circular ends

2.2 Runtime and orchestration

This section defines the runtime and single stateful orchestrator that drive the mortgage advisor’s end-to-end workflow, including bounded report refinement.

Key terms: runtime, tool calls, intermediate agent states, orchestrator, stateful, distributed orchestration, current state, refinement feedback, compliance checks, Success

2.3 Gathering information with the Interlocutor

This section introduces the Interlocutor pattern as a proactive conversational agent that gathers and maintains the information needed before mortgage advice can be produced.

Key terms: Interlocutor, interlocutors, internal agenda, due diligence, shopping lists, mortgage advisory inquiry, net income, intended mortgage length, ideal monthly payment range, interest rate

2.4 Dispatching a team of analysts to produce advice

This section motivates replacing a single overloaded mortgage-advice agent with a supervised team of independent specialist agents.

Key terms: linear agentic workflow, context size, effective context-size limits, LMs, agent teams, multi-agent system, subagents, task specialists, orchestration, divide and conquer

2.4.1 Mortgage analysts as children of the ReAct abstraction

This section defines a reusable ReAct-based analyst agent and shows how specialized mortgage analysts are created by configuring it with prompts, payload information, and tools.

Key terms: ReAct agent, system prompt, user prompt template, payload, named callable tools, working loop, analyst persona, RateFairnessAnalyst, Interlocutor, messages

2.4.2 Bundling analysts into a supervised team

This subsection explains how the mortgage advisor combines specialized analyst agents under one supervisor to complete an aggregate analysis.

Key terms: supervisor, analyst ReAct agents, aggregate analysis, analysis stage, subtasks, subagents, tools, specialized expertise, supervisor agent

2.5 The report-writing errand

This section presents report writing as an Errand: a simple LM-based step that turns analyst outputs and prior feedback into the mortgage advisory report.

Key terms: errand, LM calls, deterministic code, payloads, response-processing code, report-writing errand, analysts' outputs, feedback, system prompt, report

2.6 Ensuring compliance with guardrails

This section adds a compliance guardrail to the mortgage advisor so that only compliant reports reach users and rejected reports can be refined.

Key terms: Guardrail pattern, verdict, pass/fail, accept/reject, feedback, ComplianceGuardrail, compliance guardrail, report-writing errand, errand, guardrail

2.7 Spotting the refinement loop

This section shows how a MortgageAdvisor forms a refinement loop by feeding ComplianceGuardrail feedback back to the ReportingErrand for limited report rewrites.

Key terms: MortgageAdvisor, ComplianceGuardrail, ReportingErrand, feedback, verdict, refinement loop, state machine, max_compliance_retries, retrials, aggregated feedback

2.8 Summary

This summary recaps how agent flow diagrams and composable design patterns structure the Mortgage Advisor agent into isolated, quality-focused components.

Where this is used later

Concepts explained in this chapter

← Chapter 1: When and why to use agent design patterns Chapter 3: Errand: Breaking complex workflows into units →

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.