# packtpublishing/ai-agents-in-practice architecture

> Architecture diagram of the GitHub repository packtpublishing/ai-agents-in-practice, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/packtpublishing/ai-agents-in-practice
- Repository: https://github.com/packtpublishing/ai-agents-in-practice

## Overview

This repository is a book companion containing independent AI-agent examples, not one integrated application. Its clearest end-to-end workflow is Chapter 6’s restaurant assistant: a customer chats in Streamlit, an agent uses conversation memory and tools to answer questions, search restaurant documents or product data, and add confirmed items to a cart. Other chapters demonstrate standalone external tools and an MCP stock-price server; Chapter 7 documents a multi-agent example. Connections for unsampled notebooks are not inferred.

Main entry points: [`Chapter 6/app.py`](https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%206/app.py) (Agent executor), [`Chapter 5/calendar_tool.py`](https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%205/calendar_tool.py) (Calendar lookup), [`Chapter 5/asynch_summarizer_tool.py`](https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%205/asynch_summarizer_tool.py) (Report batch), [`Chapter 8/server.py`](https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%208/server.py) (Stock MCP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_restaurant["Restaurant assistant"]
  node_chat_ui["Chat interface<br/>[app.py]"]
  node_agent["Agent executor<br/>[app.py]"]
  node_memory["Chat memory<br/>[app.py]"]
  node_model["Azure chat model<br/>[app.py]"]
  node_toolkit["Agent tools<br/>[app.py]"]
  node_sql_db[("Restaurant database<br/>[piadineria.db]")]
  node_documents["Restaurant PDFs"]
  node_retrieval["Document retrieval<br/>[app.py]"]
end

subgraph group_examples["Agent tool examples"]
  node_multiagent["Multi-agent example<br/>[multiagent.ipynb]"]
  node_calendar_tool["Calendar lookup<br/>[calendar_tool.py]"]
  node_report_tool["Sales report tool"]
  node_report_batch["Report batch"]
  node_temperature_tool["Temperature converter"]
end

subgraph group_mcp["MCP server"]
  node_mcp_server["Stock MCP server<br/>[server.py]"]
end

node_customer(("Customer"))
node_cart_api["Cart service"]
node_graph_api["Microsoft Graph"]
node_yahoo["Yahoo Finance"]

node_customer -->|"sends prompt"| node_chat_ui
node_chat_ui -->|"invokes"| node_agent
node_agent -->|"uses"| node_model
node_agent -->|"dispatches tools"| node_toolkit
node_agent -->|"uses"| node_memory
node_toolkit -->|"queries"| node_sql_db
node_toolkit -->|"includes"| node_retrieval
node_retrieval -->|"indexes"| node_documents
node_toolkit -->|"posts cart item"| node_cart_api
node_report_batch -->|"gathers reports"| node_report_tool
node_calendar_tool -->|"requests events"| node_graph_api
node_mcp_server -->|"fetches prices"| node_yahoo

click node_chat_ui "https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%206/app.py"
click node_agent "https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%206/app.py"
click node_memory "https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%206/app.py"
click node_model "https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%206/app.py"
click node_toolkit "https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%206/app.py"
click node_sql_db "https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%206/piadineria.db"
click node_documents "https://github.com/packtpublishing/ai-agents-in-practice/tree/main/Chapter%206/documents"
click node_retrieval "https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%206/app.py"
click node_multiagent "https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%207/multiagent.ipynb"
click node_calendar_tool "https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%205/calendar_tool.py"
click node_report_tool "https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%205/asynch_summarizer_tool.py"
click node_report_batch "https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%205/asynch_summarizer_tool.py"
click node_temperature_tool "https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%205/temperature_tool.py"
click node_mcp_server "https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%208/server.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_chat_ui,node_agent,node_memory,node_model,node_toolkit,node_sql_db,node_documents,node_retrieval toneBlue
class node_multiagent,node_calendar_tool,node_report_tool,node_report_batch,node_temperature_tool toneAmber
class node_mcp_server toneMint
class node_customer,node_cart_api,node_graph_api,node_yahoo toneIndigo
```

## Components

### Restaurant assistant

- [Chat interface](https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%206/app.py): `Chapter 6/app.py`
- [Agent executor](https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%206/app.py): `Chapter 6/app.py`
- [Chat memory](https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%206/app.py): `Chapter 6/app.py`
- [Azure chat model](https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%206/app.py): `Chapter 6/app.py`
- [Agent tools](https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%206/app.py): `Chapter 6/app.py`
- [Restaurant database](https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%206/piadineria.db): `Chapter 6/piadineria.db`
- [Restaurant PDFs](https://github.com/packtpublishing/ai-agents-in-practice/tree/main/Chapter%206/documents): `Chapter 6/documents`
- [Document retrieval](https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%206/app.py): `Chapter 6/app.py`

### Agent tool examples

- [Multi-agent example](https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%207/multiagent.ipynb): `Chapter 7/multiagent.ipynb`
- [Calendar lookup](https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%205/calendar_tool.py): `Chapter 5/calendar_tool.py`
- [Sales report tool](https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%205/asynch_summarizer_tool.py): `Chapter 5/asynch_summarizer_tool.py`
- [Report batch](https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%205/asynch_summarizer_tool.py): `Chapter 5/asynch_summarizer_tool.py`
- [Temperature converter](https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%205/temperature_tool.py): `Chapter 5/temperature_tool.py`

### MCP server

- [Stock MCP server](https://github.com/packtpublishing/ai-agents-in-practice/blob/main/Chapter%208/server.py): `Chapter 8/server.py`

### Other components

- **Customer**
- **Cart service**
- **Microsoft Graph**
- **Yahoo Finance**

## Connections

- Customer → Chat interface: sends prompt (evidence: `Chapter 6/app.py`)
- Chat interface → Agent executor: invokes (evidence: `Chapter 6/app.py`)
- Agent executor → Azure chat model: uses (evidence: `Chapter 6/app.py`)
- Agent executor → Agent tools: dispatches tools (evidence: `Chapter 6/app.py`)
- Agent executor → Chat memory: uses (evidence: `Chapter 6/app.py`)
- Agent tools → Restaurant database: queries (evidence: `Chapter 6/app.py`)
- Agent tools → Document retrieval: includes (evidence: `Chapter 6/app.py`)
- Document retrieval → Restaurant PDFs: indexes (evidence: `Chapter 6/app.py`)
- Agent tools → Cart service: posts cart item (evidence: `Chapter 6/app.py`)
- Report batch → Sales report tool: gathers reports (evidence: `Chapter 5/asynch_summarizer_tool.py`)
- Calendar lookup → Microsoft Graph: requests events (evidence: `Chapter 5/calendar_tool.py`)
- Stock MCP server → Yahoo Finance: fetches prices (evidence: `Chapter 8/server.py`)
