Source code teardown of DeerFlow -- best middleware architecture I've seen in an agent framework #2006
NeuZhou
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've been reading through AI agent codebases and writing detailed teardowns. DeerFlow caught my eye because the middleware architecture is genuinely the cleanest I've seen across 12 projects.
16 middleware files, roughly 200 lines each, one concern per file. That's hard to do and most projects give up and end up with a 9000-line god object instead (looking at you, Hermes Agent).
The hash-based loop detection (warn at 3, kill at 5) is practical and catches a real problem that most agent loops silently burn tokens on forever.
A couple things I'd flag:
The orphan tool call bug (93 lines of code fix a crash that affects every LangGraph-based agent) was interesting -- if you use LangGraph, you probably have this bug too and don't know it.
The security story needs work though. No authentication, no RBAC, no rate limiting on the API endpoints. The security section of the docs says "improper deployment may introduce security risks" and stops there. For a project at 58K stars, that's a gap worth closing.
I rated DeerFlow B- overall. The middleware pattern is worth stealing, the security posture is not.
Full teardown: https://github.com/NeuZhou/awesome-ai-anatomy/tree/main/deer-flow
Happy to discuss any of the findings.
Beta Was this translation helpful? Give feedback.
All reactions