Skip to content

feat(ui): expose dynamic tool loader as a Beta toggle in Agent UI settings #1798

Description

@kovtcharov

The dynamic tool loader (#1449 + #1762) trims each turn's tool prompt to a semantically-matched subset to cut first-turn latency (TTFT numbers in #1449) — but it ships dark: reachable only via GAIA_DYNAMIC_TOOLS / config.dynamic_tools, with no Agent UI surface. Add a single Beta toggle in Settings so users can opt in without editing env vars. Stays off by default.

Code locations are as of this writing — confirm before editing.

Current state

Scope (keep it simple)

  • One toggle, marked Beta. No threshold/max controls in the UI (leave τ/max as env-var tuning).
  • Default OFF.

Implementation

  1. Schema — add dynamic_tools: bool to SettingsResponse + SettingsUpdateRequest (ui/models.py).
  2. Backend GET/PUT — persist via db.get_setting/set_setting("dynamic_tools", …) in ui/routers/system.py, mirroring agent_mode (only touch when in model_fields_set).
  3. Wire setting → agentcustom_model shows the pattern (read via db.get_setting, passed into ChatAgentConfig(...)). Set dynamic_tools at all three construction sites or the toggle silently won't apply on one path:
    • _chat_helpers.py ~L1230 (non-streaming chat)
    • _chat_helpers.py ~L1633 (streaming chat)
    • server.py:373 (scheduled-prompt agent)
      Cleanest: thread it through _session_agent_kwargs so all sites share one source.
  4. Frontend — small toggle with a Beta badge in SettingsPage.tsx, mirroring the existing custom_model control (useState + dirty-tracking + api.updateSettings). agent_mode is backend-only, so custom_model is the right precedent.

Precedence (decided — do not remove the env var)

Keep GAIA_DYNAMIC_TOOLS as the dev/CI/eval override; the UI toggle is the user-facing control, env var wins when set — same dual-surface pattern as context_sizeGAIA_CTX_SIZE and memory↔GAIA_MEMORY_DISABLED. Eval tooling (eval/tool_recall.py, tool_cost.py) and CI run headless and depend on the env var. UX nit: when the env override is set, the toggle should reflect/disable rather than silently no-op.

Tests

Files: ui/models.py · ui/routers/system.py · ui/_chat_helpers.py · server.py · SettingsPage.tsx(+.css) · tests. Follow-up to #1762.

Metadata

Metadata

Assignees

Labels

agent-uiAgent UI changesbetaBeta / experimental featureenhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions