[PR #1521] [CLOSED] docs(add): add middleware execution flow diagram to custom.mdx #1614

Closed
opened 2026-02-17 17:22:32 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/docs/pull/1521
Author: @dudududukim
Created: 11/18/2025
Status: Closed

Base: mainHead: add-middleware-execution-diagram


📝 Commits (10+)

  • 23ace67 add: agent middleware excution flow figure added
  • 7b61014 fix: agent middleware execution flow typo
  • b391fb4 docs: add middleware execution flow diagram
  • ea285af docs: add middleware execution flow diagram
  • 5a52a07 docs: add middleware execution flow diagram
  • 3b2e8e8 docs: add middleware execution flow diagram
  • 7338e65 docs: add middleware execution flow diagram
  • b9ca805 docs: add middleware execution flow diagram
  • f42e4da docs: add middleware execution flow diagram
  • aba6908 docs: add middleware execution flow diagram

📊 Changes

2 files changed (+16 additions, -0 deletions)

View changed files

src/oss/images/agent-middleware-execution-flow.svg (+2 -0)
📝 src/oss/langchain/middleware/custom.mdx (+14 -0)

📄 Description

Overview

Adds a detailed middleware execution flow diagram to the custom middleware documentation to help developers understand the complete agent execution lifecycle and all middleware hook points.

image

Type of change

Type: Update existing documentation

Related issues/PRs

  • GitHub issue: N/A
  • Feature PR: N/A
  • Linear issue: N/A
  • Slack thread: N/A

Checklist

  • I have read the contributing guidelines
  • I have tested my changes locally using docs dev
  • All code examples have been tested and work correctly
  • I have used root relative paths for internal links
  • I have updated navigation in src/docs.json if needed

(Internal team members only / optional): Create a preview deployment as necessary using the Create Preview Branch workflow

Additional notes

Changes Made

  • Added: SVG diagram (agent-middleware-execution-flow.svg) to /src/oss/images/
  • Updated: Added "Detailed execution flow" section under "Execution order" in custom.mdx

Motivations

The middleware documentation explains hooks conceptually but lacks a visual representation of how they interact during agent execution. This diagram visualizes:

Complete execution lifecycle from START to completion

Invocation order of all middleware hooks (before_agent, before_model, after_model, after_agent)

Relationship between hooks, model calls, and tool execution

For detailed background, see: What is Middleware in LangChain's createAgent?

Testing Results

make test passed (82 passed in 0.14s)
Locally verified SVG rendering without errors using docs dev
Image displays correctly at http://localhost:3000/oss/langchain/middleware/custom

Follows established patterns from overview.mdx (using tag with absolute path)

Alt text meets accessibility requirements

Feedback Welcome

If there are suggestions for improving the diagram content, styling, or placement, please provide feedback for a modified PR.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/docs/pull/1521 **Author:** [@dudududukim](https://github.com/dudududukim) **Created:** 11/18/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `add-middleware-execution-diagram` --- ### 📝 Commits (10+) - [`23ace67`](https://github.com/langchain-ai/docs/commit/23ace67c0971ccb883cf03c2d2e16bebffe717f6) add: agent middleware excution flow figure added - [`7b61014`](https://github.com/langchain-ai/docs/commit/7b61014622ea2135fc943cfa7e37efc4073417e3) fix: agent middleware execution flow typo - [`b391fb4`](https://github.com/langchain-ai/docs/commit/b391fb4ad2f696ca70dc13a96f7b057337b670fc) docs: add middleware execution flow diagram - [`ea285af`](https://github.com/langchain-ai/docs/commit/ea285af04d1219e0ac87ea932226b6e256d9c578) docs: add middleware execution flow diagram - [`5a52a07`](https://github.com/langchain-ai/docs/commit/5a52a07ceb782aad751a5c96030e46ffde534ba0) docs: add middleware execution flow diagram - [`3b2e8e8`](https://github.com/langchain-ai/docs/commit/3b2e8e83b0ed41e21418f5d6517e54d9f6afa205) docs: add middleware execution flow diagram - [`7338e65`](https://github.com/langchain-ai/docs/commit/7338e6598d0cef11b0e2898145ddf7dd7652bb3c) docs: add middleware execution flow diagram - [`b9ca805`](https://github.com/langchain-ai/docs/commit/b9ca8051bcff2cf5682313571d31e342f65d6548) docs: add middleware execution flow diagram - [`f42e4da`](https://github.com/langchain-ai/docs/commit/f42e4daee26737f4f9ac07b209c7adebea655e76) docs: add middleware execution flow diagram - [`aba6908`](https://github.com/langchain-ai/docs/commit/aba6908ece0ac227c1d5c5c2b2c545c9077d89e7) docs: add middleware execution flow diagram ### 📊 Changes **2 files changed** (+16 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `src/oss/images/agent-middleware-execution-flow.svg` (+2 -0) 📝 `src/oss/langchain/middleware/custom.mdx` (+14 -0) </details> ### 📄 Description ## Overview Adds a detailed `middleware execution flow diagram` to the custom middleware documentation to help developers understand the complete agent execution lifecycle and all middleware hook points. <img width="1822" height="1184" alt="image" src="https://github.com/user-attachments/assets/564c6810-5991-4024-bddb-db26770ccd8c" /> ## Type of change **Type:** Update existing documentation ## Related issues/PRs - GitHub issue: N/A - Feature PR: N/A - Linear issue: N/A - Slack thread: N/A ## Checklist - [x] I have read the [contributing guidelines](README.md) - [x] I have tested my changes locally using `docs dev` - [ ] All code examples have been tested and work correctly - [x] I have used **root relative** paths for internal links - [x] I have updated navigation in `src/docs.json` if needed (Internal team members only / optional): Create a preview deployment as necessary using the [Create Preview Branch workflow](https://github.com/langchain-ai/docs/actions/workflows/create-preview-branch.yml) ## Additional notes ### Changes Made - Added: SVG diagram (agent-middleware-execution-flow.svg) to /src/oss/images/ - Updated: Added "Detailed execution flow" section under "Execution order" in custom.mdx ### Motivations The middleware documentation explains hooks conceptually but lacks a visual representation of how they interact during agent execution. This diagram visualizes: Complete execution lifecycle from START to completion Invocation order of all middleware hooks (before_agent, before_model, after_model, after_agent) Relationship between hooks, model calls, and tool execution For detailed background, see: [What is Middleware in LangChain's createAgent?](https://www.linkedin.com/pulse/what-middleware-langchains-createagent-duhyeon-kim-8hgde) ### Testing Results ✅ make test passed (82 passed in 0.14s) ✅ Locally verified SVG rendering without errors using docs dev ✅ Image displays correctly at http://localhost:3000/oss/langchain/middleware/custom ✅ Follows established patterns from overview.mdx (using <img> tag with absolute path) ✅ Alt text meets accessibility requirements ### Feedback Welcome If there are suggestions for improving the diagram content, styling, or placement, please provide feedback for a modified PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-17 17:22:32 -05:00
yindo closed this issue 2026-02-17 17:22:32 -05:00
yindo changed title from [PR #1521] docs(add): add middleware execution flow diagram to custom.mdx to [PR #1521] [CLOSED] docs(add): add middleware execution flow diagram to custom.mdx 2026-06-05 18:13:56 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#1614