Repository navigation
feat(agents): dynamic tool-loader with bundle-gated activation for #688 - #958
theonlychant wants to merge 6 commits into
Conversation
…d#688 Signed-off-by: theonlychant <sacehenry@gmail.com>
Signed-off-by: theonlychant <sacehenry@gmail.com>
Signed-off-by: theonlychant <sacehenry@gmail.com>
Signed-off-by: theonlychant <sacehenry@gmail.com>
Signed-off-by: theonlychant <sacehenry@gmail.com>
itomek
left a comment
There was a problem hiding this comment.
Three of the prior #854 review items this PR's description claims are fixed are still present in the code. Inline comments mark each spot. Two ways forward: (A) land the fixes the prior review asked for; (B) update the PR description to match what actually shipped. I'd push for A — the regex false positives in particular will mis-route real conversations.
Generated by Claude Code
…t_session Signed-off-by: theonlychant <sacehenry@gmail.com>
I did that for both this PR and the other one in #854 to be honest I'm not sure if I need this PR right now or do I need to close this but I'll keep this for now if things get messy again |
|
@theonlychant based on comments, I'm closing the PR for now. If you find that we need to reopen it, let us know. |
…#688) (amd#1447) ## Why this matters Issue amd#688 (dynamic tool loading, p0/consumer) has burned **four PRs** (amd#811/amd#922/amd#957/amd#958), all closing unmerged on the same recurring gaps. The root cause isn't the contributors — it's that the spec in the issue body **drifted from the actual code**, so every attempt built against a stale picture and reviews kept catching it late. Before the next contributor (who's asked to take it) writes a line, this lands one canonical, code-accurate spec at `docs/spec/tool-loader.mdx` so design and implementation can't diverge again — it's reviewed in the same repo as the code that will implement it. It also reframes the **why**: not the discredited "~12K tokens" cleanup, but the two problems users and the architecture actually feel — **cold-start time-to-first-token** (the first query prefills the whole tool block) and **scaling slope** (every tool added taxes every turn forever). The most important correction: tool descriptions reach the model via **two render paths** (text prompt for non-tool-calling models; the native `tools=` schema param for tool-calling models). A selector that filters only the text path — as the original spec and prior PRs did — gives tool-calling models **zero** benefit. The spec makes filtering both a hard requirement, and documents the cache-thrash trap that turns a first-turn TTFT win into an every-turn tax if selection isn't stable. ## Test plan - [x] `python -c "import json; json.load(open('docs/docs.json'))"` — nav JSON valid - [x] New page `spec/tool-loader` registered under Core Framework in `docs.json` - [ ] Mintlify preview renders `docs/spec/tool-loader.mdx` (tables, `<Note>`/`<Warning>`, internal anchor link) - [ ] Maintainer sign-off on the design direction before implementation begins (open questions are left explicitly for the implementer's design sketch) --------- Co-authored-by: Ovtcharov <kovtchar@amd.com>
Summary
Implements dynamic tool-loader with bundle-gated activation for GAIA's
agent system, reducing token usage by only exposing tools relevant to
the current conversation context.
Why
The full tool registry is passed to the LLM on every turn, consuming
tokens for tools that are unlikely to be used. Bundle-gated activation
loads tools on-demand based on keyword matching and activation policies
(always, session, keyword), reducing context window pressure and
improving response quality.
Linked issue
Closes #688
Changes
src/gaia/agents/base/tool_loader.py-ToolLoaderwith bundleregistration, keyword-based activation, and session/always/keyword policies
force_activate(bundle_name)public method to avoid direct_stateaccessreset_session()into conversation-start path inChatAgentsrc/gaia/agents/base/tool_loader.pyunit testsTest plan
pytest tests/unit/test_tool_loader.py- all passingpython util/lint.py --all- no failuresactivate based on conversation context
Checklist
Closes #688).