feat(search): add firecrawl search provider#80
Conversation
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>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThis PR adds ChangesSearch priority and Firecrawl integration
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
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/Undefined/config/search.py (1)
7-7: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueImporting a private helper across modules.
_coerce_str_listis underscore-prefixed incoercers.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 outsidecoercers.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 winDuplicate 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]) intoUndefined/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
📒 Files selected for processing (22)
ARCHITECTURE.mdconfig.toml.exampledocs/configuration.mddocs/usage.mdsrc/Undefined/ai/prompts/system_context.pysrc/Undefined/config/config_class.pysrc/Undefined/config/env_registry.pysrc/Undefined/config/load_sections/network.pysrc/Undefined/config/search.pysrc/Undefined/skills/agents/README.mdsrc/Undefined/skills/agents/runner/context.pysrc/Undefined/skills/agents/runner/tools.pysrc/Undefined/skills/agents/web_agent/README.mdsrc/Undefined/skills/agents/web_agent/config.jsonsrc/Undefined/skills/agents/web_agent/prompt.mdsrc/Undefined/skills/agents/web_agent/tools/firecrawl_search/config.jsonsrc/Undefined/skills/agents/web_agent/tools/firecrawl_search/handler.pysrc/Undefined/skills/agents/web_agent/tools/grok_search/config.jsonsrc/Undefined/skills/agents/web_agent/tools/web_search/config.jsontests/test_config_env_registry.pytests/test_firecrawl_search_tool.pytests/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>
Summary
Tests
Summary by CodeRabbit
firecrawl_searchas an additional web search option, supporting both keyless and API-key modes.search.priority,search.firecrawl.*settings, environment-variable overrides, and the live update (no restart) behavior.