-
Notifications
You must be signed in to change notification settings - Fork 976
docs(add): add middleware execution flow diagram to custom.mdx #1521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(add): add middleware execution flow diagram to custom.mdx #1521
Conversation
|
Hiya! Thanks so much for your contribution. We're super excited about LangChain v1's middleware, and there's definitely a lot to learn in terms of expected flow w/ multiple nodes and wrap + hook style nodes. I think maybe what could be super helpful here is a few more simple diagrams. Perhaps one that touches on the wrap-style nature of middlewares, ex M1, M2, M3 means execution order looks like M1, M2, M3 (model) M3, M2, M1 I think another diagram that's helpful could help to explain the jump + exit conditions (loop entry node, loop exit node, etc). Happy to chat more about what might make the most sense here. |
|
Going to close this for now, but feel free to open a new PR w/ the above changes if you're interested. Thanks again for the contribution. |
|
Oh Thanks! Do you think it's worthy drawing figures with middleware execution flow or not? |
|
I think worth it, we probably just want to make them more simple, worth a shot! |
Overview
Adds a detailed
middleware execution flow diagramto the custom middleware documentation to help developers understand the complete agent execution lifecycle and all middleware hook points.Type of change
Type: Update existing documentation
Related issues/PRs
Checklist
docs devsrc/docs.jsonif needed(Internal team members only / optional): Create a preview deployment as necessary using the Create Preview Branch workflow
Additional notes
Changes Made
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.