mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-08-13 16:28:38 +00:00
get_model_config / get_tool_config / get_tool_group_config did a next(...) linear scan of self.models / self.tools / self.tool_groups on every call. These sit on hot paths: get_tool_config runs 2-3x per community-tool invocation (web_search etc.) and get_model_config several times per agent build, across 40+ call sites. Build name -> config dicts once in a mode="after" validator (stored as PrivateAttr), so each getter is an O(1) dict lookup. A config reload constructs a fresh AppConfig, which rebuilds the indexes; setdefault keeps first-match-wins on duplicate names, matching the prior next(...) semantics. Co-authored-by: ly-wang19 <ly-wang19@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>