Skip to content

[Agent Profile] Clients can't ask what tools an agent will get, or which tools are pickable #4958

Closed

Description

@simonrosenberg

A client building an Agent Profile editor has to answer two questions about tools, and the SDK can answer neither:

  1. What will this profile's agent actually get?
  2. Which tools may a user pick from?

Both are facts the SDK owns, so every client ends up guessing — OpenHands/OpenHands#17235 currently hardcodes a six-name allow-list and a copy of DEFAULT_EXEC_TOOL_NAMES to fill the gap.

1. materialize reports intent, not outcome

POST /api/agent-profiles/{name}/materialize runs resolve_agent_profile_dry_run and is otherwise the right endpoint for this. But _build_openhands_settings passes the field straight through ("tools": profile.tools), so a profile that leaves tools unset materializes as None — while the launch resolves it to four tools.

Verified against a live agent-server (1.46.0), same profile:

POST /api/agent-profiles/probe-default/materialize
  resolved_settings.tools : None

POST /api/conversations  {agent_profile_id: <that profile>}
  agent.tools : ['browser_tool_set', 'file_editor', 'task_tracker', 'terminal']

The gap is not just create_agent()'s defaulting. _resolve_agent_from_profile appends browser_tool_set after resolve_agent_profile returns, gated on is_tool_usable() and on profile.tools is None — a rule no client can reproduce without duplicating both the default names and the injection logic, and which drifts the moment either changes.

Ask

Have the dry-run also report the resolved outcome — the tool names the agent would actually be constructed with, after create_agent()'s defaulting and the serving layer's injections — alongside the stored tri-state, which is still what gets persisted.

A second, smaller ask that makes this usable in a create flow: let materialize accept a draft profile body, not only a saved profile by name, so an editor can preview before the first save.

Shape is up to you; something like AgentProfileDiagnostics.resolved_tool_names: list[str] next to the existing resolved_mcp_config_keys / resolved_skills, which already follow exactly this "what would actually resolve" pattern.

2. Nothing marks a tool as user-selectable

/server_info's usable_tools and /tools/ both return the process's tool registry. tool_router.py registers four presets unconditionally at import:

register_default_tools(enable_browser=True)
register_builtins_agents(enable_browser=True)
register_gemini_tools(enable_browser=True)
register_planning_tools()

so a stock agent-server advertises eighteen names, of which most should never appear in a profile editor:

Name Why not selectable
edit, read_file, write_file, list_directory Gemini preset — a parallel family to file_editor; no product path builds an agent from it
planning_file_editor planning agent's internal PLAN.md editor; needs a plan_path computed per launch, which a stored profile cannot supply
workflow low-level half of a pair whose own docstring says to prefer workflow_tool_set
task, task_tool_set delegation, owned by enable_sub_agents
FinishTool, ThinkTool, SwitchLLMTool, InvokeSkillTool, VisionInspectTool built-ins attached via include_default_tools
canvas_ui, canvas_ui_control client-defined, injected at launch

The agent settings schema does not help either: its tools field is value_type: array with choices: [].

So a client must maintain a hand-curated list and keep it in sync with SDK releases by hand — and getting it wrong is not cosmetic, since this picker decides what an agent is allowed to do.

Ask

Let a tool declare whether it is user-selectable, and expose that where the tool list is served.

There is a clean precedent: usability is already declared per tool (ToolDefinition.is_usable(), captured into _USABILITY_REG at register_tool time and surfaced through list_usable_tools()). A user_selectable classvar handled the same way would fit the existing shape, default True so nothing changes for third-party tools, and be set False on the built-ins, the delegation pair, the planning editor and the low-level workflow.

Whether the Gemini family is "not selectable" or "selectable but a distinct family" is a product call I would not presume — a family/group label might serve better than a boolean there.

Why both, together

They are the two halves of one question, and answering only the first still leaves clients curating a list by hand. With both, a profile editor becomes: ask the server what can be picked, ask the server what this selection resolves to, render both. No duplicated defaults, no drift on SDK upgrade.

It would also let a client show why a tool is present — default / server-injected / from MCP / attached by a skill — which is the honest answer to "which of these can I actually remove?". Today a user cannot tell an injected tool from a chosen one.

Desired Behavior

The SDK answers both questions, so a client renders what the server reports instead of curating its own lists:

  1. The dry run behind POST /api/agent-profiles/{name}/materialize reports the tool names the agent would actually be constructed with — after create_agent()'s defaulting and the serving layer's environment-dependent injections — alongside the stored tri-state, and can evaluate a draft profile body so an editor can preview before the first save.
  2. A tool declares whether it is user-selectable, and the served tool list reflects that declaration.

Status (2026-09-28)

Half of question 1 has landed in PR #5154 (the unified launch pipeline for #5141).
_resolve_agent_from_profile no longer exists: prepare_agent_launch materializes
tools into the resolved settings from an explicit browser_available runtime input,
and materialize calls that same function with this server's runtime. So the dry run now
reports the concrete tool list including the environment-dependent injection, and a test
plus a live e2e compare the preview against a real launch field by field.

Still open here, and what #5151 implements:

Note for whoever rebases #5151: its agent_server/profile_launch.py is superseded by
#5154's agent_server/agent_launch.py, which probes the container's browser
availability rather than the host's on the Docker path.

Acceptance Criteria

  • resolve_agent_profile_dry_run reports the tool names the agent would actually be constructed with, including the serving layer's environment-dependent injections.
  • A profile with tools: null reports the standard set; [] reports empty; an explicit list reports itself. The stored tri-state remains separately visible.
  • Materialize can evaluate a draft profile body, not only a saved profile by name.
  • A tool can declare that it is not user-selectable, and the served tool list reflects it.
  • The built-ins, the delegation pair, the planning file editor and the low-level workflow are marked accordingly; a third-party tool that declares nothing stays selectable.
  • A client that renders the reported lists needs no local copy of DEFAULT_EXEC_TOOL_NAMES and no hardcoded exclusions.

Relevant code

Activity

  1. added
    enhancement
    architecture
    on Sep 11, 2026
  2. github-actions commented on Sep 11, 2026

    @github-actions
    Contributor

    ✅ ready-for-dev label applied

    This issue meets the readiness criteria and is ready for contribution.
    A contributor can now open a PR that links this issue (Fixes #<number>).

    This is an automated check — no AI was used to generate this comment.

  3. changed the title [-]Profile clients can't ask what tools an agent will get, or which tools are pickable[/-] [+][Agent Profile] Clients can't ask what tools an agent will get, or which tools are pickable[/+] on Sep 11, 2026
  4. simonrosenberg commented on Sep 17, 2026

    @simonrosenberg
    MemberAuthor

    Where an agent's tools come from, and a proposed catalog design

    I built SDK main (365ceb3, agent-server 1.49.1) and Agent Canvas main (07590fd). I ran canvas against the local SDK build with the e2e mock LLM, which records every completion request, and opened agents from the canvas home page and through the API. The tables below compare what was stored, what the server set up, and the tools array the LLM actually received.

    What an agent actually gets

    Launch Stored tools Tool names the server set up (agent.tools) Tools the LLM received
    Canvas home, default profile (canvas uses the agent_settings path) null terminal, file_editor, task_tracker, browser_tool_set, canvas_ui_control, launch_child_conversation canvas_ui_control, file_editor, finish, invoke_skill, launch_child_conversation, switch_llm, task_tracker, terminal, think
    Canvas home, named profile (agent_profile_id), enable_sub_agents: true [glob, grep] glob, grep, canvas_ui_control, launch_child_conversation canvas_ui_control, finish, glob, grep, invoke_skill, launch_child_conversation, switch_llm, think. No task tool.
    API, profile with enable_sub_agents: true, enable_switch_llm_tool: false null terminal, file_editor, task_tracker, task_tool_set, browser_tool_set file_editor, finish, invoke_skill, task, task_tracker, terminal, think
    API, profile + one MCP server (fetch) in settings [] (empty) fetch, finish, invoke_skill, switch_llm, think

    What these runs show, beyond what the issue already describes:

    • materialize reports what is stored, not what launches. It returned tools: null for the default profile and tools: [] for the last row, whose agent had five tools.
    • enable_sub_agents is silently ignored once tools is an explicit list (row 2). create_agent() only adds task_tool_set when tools is None (settings/model.py#L1403-L1409). The UI shows sub-agents as on, but the agent can't delegate.
    • usable_tools is a static check, not a guarantee. Chromium was detected, so the server added browser_tool_set. The browser then failed to start inside the server, and BrowserToolSet.create() returned zero tools with only a log warning. The same startup worked in a standalone process, so I have not found the cause.
    • The advertised tool list depends on what the server process has already run.
      • At boot, /api/tools/ listed 18 names. Two of them, canvas_ui and FinishTool, come from canvas's own tools/canvas_ui_tool.py, which canvas loads with --import-modules. An SDK-only server lists 16.
      • After a few canvas launches it listed 20: register_client_tools registers each client tool name for the life of the process.
      • After one API conversation whose tool_module_qualnames named apply_patch and tom_consult, it listed 23 (apply_patch, tom_consult, sleeptime_compute added).
      • /server_info.usable_tools follows the same list, so it can't serve as a picker catalog as-is.
    • A correction to the issue's table: ThinkTool, SwitchLLMTool, InvokeSkillTool and VisionInspectTool are never in that list. Built-ins are found through BUILT_IN_TOOL_CLASSES, not the registry. FinishTool only appears because canvas registers it.

    Where tools come from

    1. Named tools looked up in the server-wide registry (agent.tools: list[Tool{name, params}]).
      • A tool registers itself when its module is imported (registry.py#L113). On the agent-server, the imports come from:
        • tool_router.py#L15-L18, which loads four presets:
          • default: terminal, file_editor, task_tracker, browser_tool_set
          • gemini: edit, read_file, write_file, list_directory
          • planning: glob, grep, planning_file_editor
          • built-in sub-agents
        • The openhands.tools package __init__: ask_oracle, task, task_tool_set, workflow, workflow_tool_set.
        • The --import-modules startup flag.
        • Each conversation's tool_module_qualnames (conversation_service.py#L1759). RemoteConversation sends every tool registered in the client process, and the server keeps those registrations for good. Conversations being resumed re-import theirs.
      • apply_patch, tom_consult and sleeptime_compute ship in openhands-tools but only appear once something imports them.
      • One stored name can become several tools: browser_tool_set becomes 14 browser_* tools, task_tool_set becomes task, workflow_tool_set becomes workflow. A catalog therefore has to be keyed by the name a profile stores, not by the names the LLM sees.
    2. Who picks the names today. There are four independent copies of the default list:
      • create_agent() defaults (DEFAULT_EXEC_TOOL_NAMES + task_tool_set).
      • The agent-server adds browser, on the profile path only (conversation_service.py#L446-L455).
      • Canvas builds its own list on the agent_settings path: DEFAULT_TOOL_NAMES plus browser/task gating in getAgentTools.
      • Cloud builds its own list and currently does not apply a profile's tools.
    3. Built-ins, which bypass the registry (include_default_tools):
      • FinishTool and ThinkTool: always.
      • SwitchLLMTool: when enable_switch_llm_tool is on.
      • InvokeSkillTool: added automatically whenever an invocable AgentSkills-format skill is loaded, which is almost always the case.
      • VisionInspectTool: added automatically when the model can't read images and a saved vision-capable profile exists (agent/base.py#L570-L599).
      • filter_tools_regex does not apply to built-ins.
    4. Client-defined tools (client_tools, conversation_service.py#L1788):
      • Canvas sends canvas_ui_control and launch_child_conversation on both launch paths (agent-server-adapter.ts#L1241).
      • They are added after profile resolution and executed in the browser. Only the client knows about them.
    5. MCP tools:
      • Servers come from settings mcp_config (filtered by mcp_server_refs), plus MCP servers from plugins: explicitly attached, marketplace auto-loaded, and installed/user/project plugins (local_conversation.py#L1083, #L1133), plus load_plugin() mid-conversation.
      • Tool names are only known after connecting, and can change during a conversation (tools/list_changed).
      • Cloud also adds its own system MCP server.
    6. Indirect capabilities: sub-agents build their tools from their own definitions ([Agent Profile] Sub-agent delegation bypasses a profile's tool and MCP restrictions #4953), and canvas's launch_child_conversation starts new conversations.
    7. OpenHands/extensions adds no Python tools, and its plugins currently declare no MCP servers, hooks or agents. Its integration catalog only produces mcp_config entries.

    ACP profiles are out of scope for this: ACP agents own their tooling, and only mcp_config is forwarded.

    Proposal

    The only party that can answer "what can be picked" and "what will this resolve to" is the server that builds the agent. Clients should render its answer rather than recompute it. Concretely:

    1. Tools declare catalog metadata.

    • Add class-level fields to ToolDefinition: user_selectable: ClassVar[bool] = True, plus a static title, a short summary, a group, and requires (e.g. chromium, or the oracle LLM profile for ask_oracle, which today is listed as usable even when no such profile exists).
    • register_tool records them the same way it records usability today.
    • Set user_selectable = False on:
      • the built-ins
      • task and task_tool_set (owned by enable_sub_agents)
      • planning_file_editor
      • the low-level workflow
      • ClientTool
      • the legacy canvas_ui
    • Whether the gemini tools are hidden or shown as their own group is a product call.
    • A third-party tool that declares nothing stays selectable.

    2. The catalog is fixed once the server has started.

    • Snapshot the registry when startup finishes (presets plus --import-modules).
    • Anything registered later by a conversation (client_tools, tool_module_qualnames) is scoped to that conversation and never listed.
    • This gives deployments an extension story: add a tool with --import-modules, and it shows up in profile editors.

    3. GET /api/tools/catalog, announced as tool_catalog_v1 in server_info.capabilities.

    {
      "tools": [
        {"name": "terminal", "title": "Terminal", "group": "core", "selectable": true, "available": true},
        {"name": "browser_tool_set", "group": "web", "selectable": true, "available": false,
         "unavailable_reason": "chromium not found", "requires": ["chromium"]},
        {"name": "task_tool_set", "selectable": false, "controlled_by": "enable_sub_agents"}
      ],
      "defaults": {
        "tool_names": ["terminal", "file_editor", "task_tracker"],
        "injected_when_unset": [{"name": "browser_tool_set", "when": "available"}],
        "enable_sub_agents_adds": "task_tool_set"
      },
      "builtins": [
        {"name": "FinishTool", "always": true},
        {"name": "ThinkTool", "always": true},
        {"name": "SwitchLLMTool", "controlled_by": "enable_switch_llm_tool"},
        {"name": "InvokeSkillTool", "controlled_by": "skills"},
        {"name": "VisionInspectTool", "controlled_by": "vision_profile"}
      ]
    }
    • MCP stays selectable per server (mcp_server_refs), not per tool. Tool names per server can be shown on demand with the existing POST /api/mcp/test.

    4. One tool-planning function shared by launch and dry run.

    • Move the browser injection out of _resolve_agent_from_profile into an SDK function that both resolve_agent_profile and resolve_agent_profile_dry_run call.
    • AgentProfileDiagnostics then gains resolved_tools: [{name, source}]. Sources: default, profile, server_injected, enable_sub_agents, builtin, skills, mcp_server, plugin_mcp.
    • The stored tri-state stays separately visible.
    • Add a draft-body materialize (e.g. POST /api/agent-profiles/materialize with the profile in the body).
    • Apply the same defaulting on the agent_settings launch path, so canvas can drop getAgentTools as well as profile-tools.ts.

    5. Make enable_sub_agents apply even when tools is explicit.

    • create_agent() would add task_tool_set (de-duplicated) whenever the flag is on, so the flag is the only owner of delegation and editors don't need to re-add it on save.
    • This changes behaviour for saved profiles that have an explicit list and the flag on: they would start getting task. That matches what the toggle already shows the user.

    6. Clients render, they don't compute. Canvas's editor would:

    Cloud can call the same SDK catalog function for the static part. Availability has to come from the runtime, not the app server, and cloud needs to honour profile.tools before a picker there does anything.

    Tool selection does not make an agent restricted

    This affects how the picker should be presented, especially for a "read-only explorer" profile:

    Suggested order

    1. SDK: catalog metadata, startup snapshot, GET /api/tools/catalog and the capability flag.
    2. SDK: shared tool planning, resolved_tools with sources, draft materialize, the enable_sub_agents fix.
    3. Canvas: consume the catalog; delete DEFAULT_TOOL_NAMES and profile-tools.ts.
    4. Cloud: honour profile.tools and serve the catalog.
  5. added
    ready-for-dev
    on Sep 17, 2026
  6. added a commit that references this issue on Sep 17, 2026
    2bfeff6
  7. added a commit that references this issue on Sep 28, 2026
    6e8b7b6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

architectureenhancementready-for-dev

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions