Skip to content

feat(agents): dynamic tool-loader with bundle-gated activation for #688#958

Draft
theonlychant wants to merge 6 commits intoamd:mainfrom
theonlychant:feat/tool-loader
Draft

feat(agents): dynamic tool-loader with bundle-gated activation for #688#958
theonlychant wants to merge 6 commits intoamd:mainfrom
theonlychant:feat/tool-loader

Conversation

@theonlychant
Copy link
Copy Markdown
Contributor

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

  • Added src/gaia/agents/base/tool_loader.py - ToolLoader with bundle
    registration, keyword-based activation, and session/always/keyword policies
  • Added force_activate(bundle_name) public method to avoid direct _state access
  • Wired reset_session() into conversation-start path in ChatAgent
  • Tightened filesystem and browser keyword regexes to use word boundaries
  • Added src/gaia/agents/base/tool_loader.py unit tests

Test plan

  • pytest tests/unit/test_tool_loader.py - all passing
  • python util/lint.py --all - no failures
  • Manual: start a chat session and verify only relevant tool bundles
    activate based on conversation context

Checklist

  • I have linked a GitHub issue above (Closes #688).
  • I have described why this change is being made, not just what changed.
  • I have run linting and tests locally.
  • I have updated documentation if user-visible behavior changed.

…d#688

Signed-off-by: theonlychant <sacehenry@gmail.com>
@github-actions github-actions Bot added tests Test changes agents labels May 5, 2026
Signed-off-by: theonlychant <sacehenry@gmail.com>
Comment thread src/gaia/agents/chat/agent.py
Signed-off-by: theonlychant <sacehenry@gmail.com>
Signed-off-by: theonlychant <sacehenry@gmail.com>
Signed-off-by: theonlychant <sacehenry@gmail.com>
Copy link
Copy Markdown
Collaborator

@itomek itomek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread src/gaia/agents/chat/agent.py Outdated
Comment thread src/gaia/agents/chat/agent.py Outdated
Comment thread src/gaia/agents/chat/agent.py Outdated
Comment thread src/gaia/agents/base/tool_loader.py
Comment thread src/gaia/agents/chat/agent.py
…t_session

Signed-off-by: theonlychant <sacehenry@gmail.com>
@theonlychant theonlychant marked this pull request as draft May 5, 2026 16:08
@theonlychant
Copy link
Copy Markdown
Contributor Author

theonlychant commented May 5, 2026

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dynamic tool loading based on conversation context via memory

2 participants