Skip to content

Toggle agent tools during an active agent session#5856

Merged
timothycarambat merged 6 commits into
masterfrom
feat/toggle-tools-during-agent-session
Jul 17, 2026
Merged

Toggle agent tools during an active agent session#5856
timothycarambat merged 6 commits into
masterfrom
feat/toggle-tools-during-agent-session

Conversation

@shatfield4

@shatfield4 shatfield4 commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Pull Request Type

  • ✨ feat (New feature)
  • 🐛 fix (Bug fix)
  • ♻️ refactor (Code refactoring without changing behavior)
  • 💄 style (UI style changes)
  • 🔨 chore (Build, CI, maintenance)
  • 📝 docs (Documentation updates)

Relevant Issues

resolves #5855

Description

  • Adds the ability to enable or disable an agent's tools while an agent session is already active
  • Toggles are sent over the existing agent websocket and applied live, taking effect on the agent's next turn with no session restart
  • The agent rebuilds the tools it can call from a map on every tool-call turn, so toggles apply on the next turn
  • Disabling moves a tool out of the active map into a removed map so it is skipped that turn; enabling moves it back, preserving the definition so re-enabling never reloads the plugin
  • Works across every tool type: default skills, configurable skills, app integrations, custom skills, agent flows, MCP tools, and sub-skills
  • Multi-tool skills are resolved server-side so the whole skill toggles correctly (SQL tool)
  • Removes the old behavior that disabled the tools menu during an agent session, and the unused tooltip
  • Tool toggles continue to persist to the global agent skill settings

Visuals (if applicable)

Additional Information

  • Prune translations for the agent-skill-disabled-tooltip translation key
  • Possibly add a needs setup hint to certain skills that are not setup yet but enabled in the menu? (Currently fails gracefully and skips the failed tool call if not setup in agent skills settings page)

Developer Validations

  • I ran yarn lint from the root of the repo & committed changes
  • Relevant documentation has been updated (if applicable)
  • I have tested my code functionality
  • Docker build succeeds locally

@shatfield4 shatfield4 self-assigned this Jun 17, 2026
@timothycarambat

Copy link
Copy Markdown
Member

@shatfield4 Quick feedback just from a glance - the relayToSocket interception should be handled likely within the websocket tool or something provided it can access aibitat.

Second, you can inspect agentHandler.aibitat.functions for the list of active plugins on an instance. THen from here it is a matter of finding and popping off the right function from the Map.

Then vice versa for adding plugins back - which must be done via the aibitat.use(plugin) caller. We would need another helper for remove(skillname) which could do the deletion off of aibitat.functions and the skill would not longer be available.

The frontend<>backend skill name resolutions + all the tricks will be annoying. Things like sql-agent are not granular so we may need some special cases for that - or maybe even a way to determine if an enabled/disabled skill is a parent or child function and turn on/off accordingly.

I believe you can get the unresolved function names from agentHandler.aibitat.agents.get("@agent") and it should list them IIRC

@angelplusultra angelplusultra left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice job.

I left one comment about auth check for toggling tools via the socket since that's an admin action.

Comment thread server/utils/agents/aibitat/plugins/websocket.js

@angelplusultra angelplusultra left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@timothycarambat timothycarambat added the PR: Ready for QA Indicates that a PR is ready for QA and the GH image may build the image label Jul 17, 2026
@timothycarambat
timothycarambat merged commit eec3e73 into master Jul 17, 2026
4 checks passed
@timothycarambat
timothycarambat deleted the feat/toggle-tools-during-agent-session branch July 17, 2026 23:06
@The-SMG

The-SMG commented Jul 18, 2026

Copy link
Copy Markdown
  - name: Delete PR tag from GHCR
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    run: |
      # 1. Define variables (adjust package name to match yours)
      PACKAGE_NAME="your-image-name"
      TAG_NAME="pr-${{ github.event.pull_request.number }}"
      OWNER="${{ github.repository_owner }}"

      echo "Searching for version ID for tag: $TAG_NAME..."

      # 2. Fetch the Version ID using GitHub CLI
      VERSION_ID=$(gh api orgs/$OWNER/packages/container/$PACKAGE_NAME/versions \
        --paginate \
        --jq ".[] | select(.metadata.container.tags[] | contains(\"$TAG_NAME\")) | .id" | head -n 1)

      if [ -z "$VERSION_ID" ]; then
        echo "No package version found with tag $TAG_NAME. Nothing to delete."
      else
        echo "Found Version ID: $VERSION_ID. Proceeding with deletion..."
        # 3. Execute the delete operation
        gh api --method DELETE orgs/$OWNER/packages/container/$PACKAGE_NAME/versions/$VERSION_ID
        echo "Successfully deleted $TAG_NAME from GHCR!"
      fi

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

Labels

PR: Ready for QA Indicates that a PR is ready for QA and the GH image may build the image

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT]: Ability to toggle agent skills in live agent session

4 participants