Skip to content

feat(search): add firecrawl search provider#80

Merged
69gg merged 2 commits into
mainfrom
feature/firecrawl-search
Jul 4, 2026
Merged

feat(search): add firecrawl search provider#80
69gg merged 2 commits into
mainfrom
feature/firecrawl-search

Conversation

@69gg

@69gg 69gg commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • add Firecrawl search as a web_agent search tool with keyless/API key support
  • add configurable search.priority prompt guidance while keeping disabled search tools hidden
  • update config template, WebUI-rendered comments, docs, and tests

Tests

  • uv run pytest tests/
  • uv run ruff check .
  • uv run ruff format --check .
  • uv run mypy .

Summary by CodeRabbit

  • New Features
    • Added configurable search-tool priority for the web agent, with ordered tool selection and automatic hiding of disabled tools.
    • Added firecrawl_search as an additional web search option, supporting both keyless and API-key modes.
  • Documentation
    • Updated configuration/usage docs to cover search.priority, search.firecrawl.* settings, environment-variable overrides, and the live update (no restart) behavior.
    • Refreshed web-agent prompt/tool guidance for the new priority and search call patterns.
  • Tests
    • Added/expanded tests for configuration parsing, priority ordering, and end-to-end Firecrawl search behavior.

Add configurable web search priority and Firecrawl search support for web_agent.

Keep disabled search tools hidden from the web_agent tool schema and document the new config/WebUI fields.

Tests: uv run pytest tests/; uv run ruff check .; uv run ruff format --check .; uv run mypy .

Co-authored-by: GPT-5 <noreply@openai.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 35fedb85-d906-4f7f-842f-7592ff908e82

📥 Commits

Reviewing files that changed from the base of the PR and between fb7464d and 980a415.

📒 Files selected for processing (5)
  • src/Undefined/ai/prompts/system_context.py
  • src/Undefined/config/coercers.py
  • src/Undefined/config/search.py
  • src/Undefined/skills/agents/runner/context.py
  • tests/test_search_config.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • tests/test_search_config.py
  • src/Undefined/skills/agents/runner/context.py
  • src/Undefined/ai/prompts/system_context.py

📝 Walkthrough

Walkthrough

This PR adds firecrawl_search, introduces configurable search.priority and Firecrawl settings, wires web_agent runtime filtering and prompt generation to enabled tools, and updates configuration, documentation, and tests to reflect the new search behavior.

Changes

Search priority and Firecrawl integration

Layer / File(s) Summary
Search priority and Firecrawl config schema
src/Undefined/config/search.py, src/Undefined/config/coercers.py, src/Undefined/config/config_class.py, src/Undefined/config/env_registry.py, src/Undefined/config/load_sections/network.py, tests/test_config_env_registry.py, tests/test_search_config.py
Adds search-tool constants and normalization helpers, expands config and env mapping fields for search priority and Firecrawl, loads those values from TOML and environment variables, and verifies the resulting config behavior.
Firecrawl search tool implementation
src/Undefined/skills/agents/web_agent/tools/firecrawl_search/config.json, .../handler.py, tests/test_firecrawl_search_tool.py
Adds the firecrawl_search tool schema and async handler for Firecrawl requests, including runtime checks, request/auth handling, response formatting, and execution tests.
Runtime tool filtering and web_agent prompt priority
src/Undefined/skills/agents/runner/tools.py, src/Undefined/skills/agents/runner/context.py, src/Undefined/ai/prompts/system_context.py, tests/test_firecrawl_search_tool.py
Filters web_agent tools by runtime flags, appends search-priority guidance to the web_agent system prompt, updates the联网搜索 status string, and tests the resulting filtering and prompt text.
Tool descriptions, README, prompt, and architecture docs
ARCHITECTURE.md, config.toml.example, docs/configuration.md, docs/usage.md, src/Undefined/skills/agents/README.md, src/Undefined/skills/agents/web_agent/README.md, .../web_agent/prompt.md, .../web_agent/config.json, .../tools/grok_search/config.json, .../tools/web_search/config.json
Updates architecture, example config, documentation, and tool descriptions to describe search.priority, Firecrawl settings, and revised web_agent search selection guidance.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant web_agent
  participant runner
  participant firecrawl_search.handler
  participant Firecrawl API

  User->>web_agent: search request
  web_agent->>runner: prepare_agent_run(tools, runtime_config)
  runner->>runner: filter tools and append priority prompt
  runner-->>web_agent: filtered tools + updated prompt
  web_agent->>firecrawl_search.handler: execute(args, context)
  firecrawl_search.handler->>Firecrawl API: POST /v2/search
  Firecrawl API-->>firecrawl_search.handler: results or error
  firecrawl_search.handler-->>web_agent: formatted output
  web_agent-->>User: search response
Loading

Possibly related PRs

  • 69gg/Undefined#69: Also changes the web_agent search-tool contract and guidance, especially around grok_search usage and prompt/tool behavior.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: adding Firecrawl as a new search provider.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/firecrawl-search

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (2)
src/Undefined/config/search.py (1)

7-7: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Importing a private helper across modules.

_coerce_str_list is underscore-prefixed in coercers.py, signaling module-private intent, yet it's imported here. Consider exporting it as a public helper (e.g. coerce_str_list) if it's meant to be reused outside coercers.py.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Undefined/config/search.py` at line 7, The issue is that search.py
imports the private helper _coerce_str_list from coercers.py, which conflicts
with its module-private naming. Update coercers.py to expose a public helper
name such as coerce_str_list if this utility is intended for reuse, and then
change the import in search.py to use that public symbol. Keep the existing
behavior intact while making the shared coercion helper part of the module’s
public API.
src/Undefined/skills/agents/runner/context.py (1)

39-64: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate priority-ordering logic with system_context.py.

This "filter by priority order, then append remaining available items" pattern is re-implemented almost identically in src/Undefined/ai/prompts/system_context.py (lines 89-112) with different variable names. Consider extracting a shared helper (e.g., order_by_priority(priority, available) -> list[str]) into Undefined/config/search.py, which already hosts the priority constants/normalization helper, and have both call sites use it.

♻️ Proposed shared helper
# in Undefined/config/search.py
def order_by_priority(priority: list[str], available: set[str] | list[str]) -> list[str]:
    available_set = set(available)
    ordered = [name for name in priority if name in available_set]
    ordered.extend(
        name for name in DEFAULT_SEARCH_PRIORITY
        if name in available_set and name not in ordered
    )
    return ordered
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Undefined/skills/agents/runner/context.py` around lines 39 - 64, The
priority ordering logic in _build_web_agent_search_priority_prompt is duplicated
in system_context.py and should be centralized. Extract a shared helper such as
order_by_priority(priority, available) into Undefined/config/search.py alongside
the search priority constants/normalization, then update
_build_web_agent_search_priority_prompt and the matching system_context.py
prompt builder to call it. Keep the existing fallback behavior to
DEFAULT_SEARCH_PRIORITY and preserve the current filtering/append semantics.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/Undefined/config/search.py`:
- Line 7: The issue is that search.py imports the private helper
_coerce_str_list from coercers.py, which conflicts with its module-private
naming. Update coercers.py to expose a public helper name such as
coerce_str_list if this utility is intended for reuse, and then change the
import in search.py to use that public symbol. Keep the existing behavior intact
while making the shared coercion helper part of the module’s public API.

In `@src/Undefined/skills/agents/runner/context.py`:
- Around line 39-64: The priority ordering logic in
_build_web_agent_search_priority_prompt is duplicated in system_context.py and
should be centralized. Extract a shared helper such as
order_by_priority(priority, available) into Undefined/config/search.py alongside
the search priority constants/normalization, then update
_build_web_agent_search_priority_prompt and the matching system_context.py
prompt builder to call it. Keep the existing fallback behavior to
DEFAULT_SEARCH_PRIORITY and preserve the current filtering/append semantics.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 66d72a7b-cbe3-43f3-8f17-b61553156d6d

📥 Commits

Reviewing files that changed from the base of the PR and between adb2686 and fb7464d.

📒 Files selected for processing (22)
  • ARCHITECTURE.md
  • config.toml.example
  • docs/configuration.md
  • docs/usage.md
  • src/Undefined/ai/prompts/system_context.py
  • src/Undefined/config/config_class.py
  • src/Undefined/config/env_registry.py
  • src/Undefined/config/load_sections/network.py
  • src/Undefined/config/search.py
  • src/Undefined/skills/agents/README.md
  • src/Undefined/skills/agents/runner/context.py
  • src/Undefined/skills/agents/runner/tools.py
  • src/Undefined/skills/agents/web_agent/README.md
  • src/Undefined/skills/agents/web_agent/config.json
  • src/Undefined/skills/agents/web_agent/prompt.md
  • src/Undefined/skills/agents/web_agent/tools/firecrawl_search/config.json
  • src/Undefined/skills/agents/web_agent/tools/firecrawl_search/handler.py
  • src/Undefined/skills/agents/web_agent/tools/grok_search/config.json
  • src/Undefined/skills/agents/web_agent/tools/web_search/config.json
  • tests/test_config_env_registry.py
  • tests/test_firecrawl_search_tool.py
  • tests/test_search_config.py

Expose a public string-list coercion helper and reuse shared search priority ordering in prompt builders.

Tests: uv run pytest tests/test_search_config.py tests/test_firecrawl_search_tool.py tests/test_prompt_builder_message_order.py; uv run ruff check .; uv run ruff format --check .; uv run mypy .

Co-authored-by: GPT-5 <noreply@openai.com>
@69gg 69gg merged commit 10b7aaa into main Jul 4, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant