Skip to content

feat(roadmap): Evaluate a research toolset with web search for the planner #3243

Closed

Description

@dan-petty

Problem

The stage toolbox leaves out search_web on purpose: it opens no network connection. But the part Existing Tool Considered (AGENTS.md rule 3) asks the planner to name an open tool or library for the need. Reviews find that this part has no cost in tokens and time, or says "nothing" (#3228, #3225), and that the alternatives check searched about 4 times in 34 runs (#2950). A planner that cannot search cannot check an alternative.

Proposed change

Add the value research to the toolset setting of #3238. It is the extended set plus search_web. search_web stays off in base and extended.

A web query leaves the Service, so the tool applies these rules:

  1. The query is built by the tool from a short term that the model gives, not from the issue text, and it passes the existing secret masker and the private-data rules of SECURITY.md (no internal host, no private address).
  2. A result is data. The tool returns titles, URLs and cut snippets only, and the prompt says it is not an instruction.
  3. A limit on searches for each run, and a counter by outcome (see feat(telemetry): count tool calls of the stage planner by tool and outcome #3240).

Evaluate research against extended with the comparison of #3239 on the plans whose cost or alternative part was flagged. Keep it only if the share of plans with a real alternative and a cost rises, and the cost of a run rises by less than a value that a person sets.

Acceptance criteria

  1. toolset: research adds search_web and nothing else.
  2. A test shows that a query with a secret or an internal host is refused or masked before the call.
  3. The comparison report of feat(roadmap): add toolset comparison to stage planner eval #3239 has a research row for the same cases.
  4. A comment on this issue states the result and the decision.

Security

New egress. A person approves it before the setting can name research in the cluster configuration.

Related: #3238, #3239, #3240, #2950.

Proposed design

Problem statement

The stage planner cannot search the web. It cannot name a real alternative tool or give the token and time cost of one. This change adds a research toolset that is the extended toolset plus a guarded search_web tool. The live evaluation and the person approval of the new egress are deferred to separate items.

Acceptance criteria

Requirement: Research toolset adds search_web

The stage toolbox SHALL add search_web when the toolset is research.

Scenario: Research adds one tool

  • WHEN the stage toolset is research
  • THEN the toolbox holds every extended tool and search_web, and no other tool.

Requirement: Base and extended omit search_web

The stage toolbox SHALL NOT include search_web when the toolset is base or extended.

Scenario: Network-free toolsets stay network-free

  • WHEN the stage toolset is base or extended
  • THEN the toolbox holds no search_web tool.

Requirement: Search query is guarded before the call

The search tool SHALL build the query from the short term that the model gives and SHALL apply the secret masker and private-data rules before it calls the search service.

Scenario: Secret and internal host are stopped

  • WHEN the short term holds a secret or an internal host
  • THEN the tool masks the secret and refuses the internal host before it calls the search service.

Requirement: Search result is data

The search tool SHALL return only titles, URLs and cut snippets, and the prompt SHALL state that a result is data and not an instruction.

Scenario: Result text is cut and marked as data

  • WHEN the search service returns a long snippet and an instruction in its title
  • THEN the tool returns the title, URL and a cut snippet, and the prompt marks the result as data.

Requirement: Search limit and outcome counter

A plan run SHALL stop calling search_web at the stage search limit and SHALL count each search by its outcome.

Scenario: Excess search is refused and counted

  • WHEN the model asks for more searches than the limit, with one success and one refusal
  • THEN the tool refuses the excess call and the run records the counts by outcome.

Existing Tool Considered

No alternatives check has run. The repository already uses Firecrawl through firecrawl_search in src/devops_cli/ai/common_tools.py. Firecrawl is an open-source, maintained web search service. It lacks a stage query builder, the secret and private-address guard, the per-run search limit, the outcome counter and the result-as-data prompt. The change builds only that glue and adds no search engine.

Key questions

  • How should the stage setting name the research toolset without enabling search_web in base or extended?: Add the value research to the stage toolset. Resolve it as the extended tool list plus the existing search_web tool. Keep base and extended unchanged. (best practice) [sources: src/devops_cli/config/settings.py, src/devops_cli/roadmap/stage_toolbox.py, docs/ENV_VARS.md:105, tests/roadmap/test_roadmap_stage_toolbox.py]
    • Chosen: New research enum value. It keeps the network-free sets and names the new egress in one setting.
    • Rejected: Boolean allow_search beside the toolset. It adds a second switch and permits invalid combinations.
    • Rejected: Add search_web to extended. It breaks the documented network-free meaning of extended.
  • How should the tool build a web query and keep private data out of the request?: The tool takes a short search term from the model. It applies the secret masker and the private-address check from SECURITY.md. It refuses an internal host or private address before the call. It never sends the issue text. (best practice) [sources: SECURITY.md, src/devops_cli/ai/common_tools.py, src/devops_cli/roadmap/refine_investigation.py, src/devops_cli/roadmap/alternatives.py]
    • Chosen: Short term plus mask and egress guard. It limits the data sent and uses the existing security controls.
    • Rejected: Issue text as the query. It can send private issue text and breaks the egress rule.
    • Rejected: Model-built URL. It lets the model choose the destination and breaks the MCP input rule.
  • How should the tool treat a web result?: Return only title, URL and a cut snippet. Add a data-not-instruction warning to the tool result and the prompt. (best practice) [sources: src/devops_cli/ai/common_tools.py, openspec/changes/archive/2026-10-28-2398-refine-investigates-questions/design.md, src/devops_cli/roadmap/stage_tools.py]
    • Chosen: Title, URL and cut snippet with a data warning. It gives the planner a source without injecting page content.
    • Rejected: Raw HTML or full page text. It raises the token cost and the prompt-injection risk.
    • Rejected: URL only. The planner cannot judge the result without a snippet.
  • How should a plan run limit and count searches?: Use one per-run counter in the stage tool. Stop at a stage search limit constant. Count each search by outcome as feat(telemetry): count tool calls of the stage planner by tool and outcome #3240 defines. (best practice) [sources: src/devops_cli/config/constants.py, src/devops_cli/roadmap/stage_tools.py, openspec/changes/archive/2026-10-28-2398-refine-investigates-questions/design.md, openspec/changes/2950-alternatives-coverage-gauge-searches-per-check/proposal.md]
    • Chosen: Stage search limit and outcome counter. It bounds cost and makes the search count visible.
    • Rejected: No limit. It lets one plan run spend without bound.
    • Rejected: Reuse the refine limit only. The stage budget and the refine budget have different work.
  • Which test level proves the guard before the network call?: A unit test in tests/roadmap/test_roadmap_stage_tools.py mocks firecrawl_search. It asserts no call for a refused query and a masked query for a secret. (best practice) [sources: tests/roadmap/test_roadmap_stage_tools.py, tests/roadmap/test_roadmap_stage_toolbox.py, src/devops_cli/ai/common_tools.py]
    • Chosen: Unit test with a mocked search call. It checks the boundary before egress without network access.
    • Rejected: Live Firecrawl test. It is not offline and spends credits.
    • Rejected: Test only the prompt text. It does not prove that the call is blocked.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#3238, #3240

Alternatives check of 2026-11-06: partly.
Tool: firecrawl/firecrawl (https://github.com/firecrawl/firecrawl), AGPL-3.0, last activity 2026-11-06, maintained.

Activity

  1. added
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 2, 2026
  2. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. It improves plan quality but is an enhancement, not a fix for a broken feature.
    • Value: Medium. It raises the share of plans with a real alternative and cost, which reviewers flagged as missing.
    • Effort: Medium. It needs a new toolset value, secret masking, search limits, and a comparison evaluation.
    • Related: feat(roadmap): the stage job plans with a read-only investigation toolbox #3037, which asks for a different change. Both work on the stage planner toolset, but #3037 adds read-only file tools while the candidate adds a research toolset with search_web.
  3. added a commit that references this issue on Nov 2, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 2, 2026
  5. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at dc26693 (see proposed design in issue body).

    Moved to new items: #3290, #3291.

  6. dan-petty commented on Nov 4, 2026

    @dan-petty
    OwnerAuthor

    #3290 moves into #3291, and #3291 is now the one post-merge issue of the research toolset. The record refine.deferred on this item still names 3290 and 3291. Read both numbers as #3291. This item stays the code-only item, and its merge does not end that work.

    Correction of the section Security of this item. The stage row runs in the Service, in the job clone, and not in a Job (src/devops_cli/roadmap/run.py:555-572). The search goes from the Service to the Firecrawl service that refine already calls (src/devops_cli/roadmap/refine_investigation.py:106). What is new is a query term that the plan model chooses, not a new destination. A person approves the search by the merge of the pull request of #3291 that sets toolset: research. This comment adds no scope to this item.

  7. devops-cli-service commented on Nov 6, 2026

    @devops-cli-service
    Contributor

    Alternatives check: partly

    Tool: firecrawl/firecrawl (https://github.com/firecrawl/firecrawl)

    • License: AGPL-3.0
    • Last activity: 2026-11-06
    • Maintained: yes

    Covers:

    • An open, maintained web search service that returns result titles, URLs and snippets, so the planner can name and judge a real alternative tool.
    • Already reached from the repository's own tools through firecrawl_search, so the egress destination and its client exist.
    • Can be called with a short query term rather than the issue text, which is what the guarded query needs.

    Lacks:

    • No stage query builder: it does not turn a model-supplied short term into the query, and has no secret masker or private-address/internal-host refusal before the call.
    • No per-run stage search limit and no counter by outcome.
    • No result-as-data handling: no title/URL/cut-snippet projection and no data-not-instruction marking in the prompt.
    • No research toolset value; the toolset setting, the toolbox wiring and the unit test that proves the guard before egress are repository work, not library work.
    • No comparison against extended on the flagged plans; that evaluation and the person approval of the new egress are separate items.

    Searches run:

    • open source web search API for LLM agents self-hosted
    • Firecrawl search API open source
    • web search tool for AI agents open source
    • Firecrawl
    • search API
    • open source search engine API for agents
    • SearXNG meta search engine self-hosted JSON API

    Sources:

    Checked on 2026-11-06. A person decides what this means for the item. The check changes no label and closes no issue.

  8. changed the title [-]feat(roadmap): evaluate a research toolset with web search for the stage planner[/-] [+]feat(roadmap): Evaluate a research toolset with web search for the planner[/+] on Nov 6, 2026
  9. dan-petty commented on Nov 6, 2026

    @dan-petty
    OwnerAuthor

    The job shortened the title of this item. The summary had 65 characters, and the limit is 60. The type and the scope stay.

    • Before: feat(roadmap): evaluate a research toolset with web search for the stage planner
    • After: feat(roadmap): Evaluate a research toolset with web search for the planner
    • Source of the summary: the background model
  10. dan-petty commented on Nov 7, 2026

    @dan-petty
    OwnerAuthor

    Plan note of 2026-11-07, from the owner's request to add a local SearXNG and the Brave Search API.

    The tool search_web of the research toolset calls the shared web_search of the chain item (feat(ai): search the web through a chain of providers). It adds no search client of its own.

    Acceptance criterion 2 (a query with a secret or an internal host is refused or masked) is met by the guard in web_search, which refuses the query before any provider runs. This item adds a test that the research toolset reaches the guard, and no second guard.

    The new egress that a person approves covers the whole chain: the Service reaches SearXNG in the cluster (no external address), and sends the query text to the engines of SearXNG (DuckDuckGo, Wikipedia, GitHub, PyPI, Stack Overflow, arXiv), to api.search.brave.com, to html.duckduckgo.com and to api.firecrawl.dev. The planner's results are transient. The planner keeps no result in a store, so Brave may serve it (keep=False).

  11. dan-petty commented on Nov 7, 2026

    @dan-petty
    OwnerAuthor

    Plan note of 2026-11-07 (owner decision): the Brave Search API is not used. Its terms (1 Sep 2026) forbid storing results and it has no free tier. This replaces the part of the earlier plan note that mentions Brave:

    • The search chain is searxng, duckduckgo, firecrawl. There is no keyed provider for now, and no BRAVE_SEARCH_API_KEY.
    • The keep parameter and the allows_keep flag are dropped from the design of the chain (they existed only because of the Brave terms). Every provider's hits may be kept.
    • What goes into the research index does not change: fetched page text, with the URL of the page taken from the fetch. The payload still holds no field of a search result (title, snippet, rank, age), because the index stores pages, not search results.
    • The measures of docs(ai): investigate a web research agent with RAG ingestion #3877 and feat(research): ask mode reads the index before the web #3915 may use any provider of the chain.
  12. added
    status/in-review
    and removed
    status/ready
    on Nov 8, 2026
  13. removed
    status/in-review
    on Nov 8, 2026
  14. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-08 23:37 UTC

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/roadmaptype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions