| 1 | # search_engine.py DOX |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | - Own the `search_engine.py` agent tool. |
| 6 | - This module runs web search through the configured search helper. |
| 7 | - Keep this file-level DOX profile synchronized with `search_engine.py` because this directory is intentionally flat. |
| 8 | |
| 9 | ## Ownership |
| 10 | |
| 11 | - `search_engine.py` owns the runtime implementation. |
| 12 | - `search_engine.py.dox.md` owns durable notes about responsibilities, contracts, side effects, and verification for that implementation. |
| 13 | - Classes: |
| 14 | - `SearchEngine` (`Tool`) |
| 15 | - `async execute(self, query=..., **kwargs)` |
| 16 | - `async searxng_search(self, question)` |
| 17 | - `format_result_searxng(self, result, source)` |
| 18 | - Notable constants/configuration names: `SEARCH_ENGINE_RESULTS`. |
| 19 | |
| 20 | ## Runtime Contracts |
| 21 | |
| 22 | - Tool modules must define `helpers.tool.Tool` subclasses and return `helpers.tool.Response` from `execute(...)`. |
| 23 | - Update this file whenever tool arguments, output shape, `break_loop` behavior, intervention handling, prompt instructions, or side effects change. |
| 24 | - `SearchEngine` is a `Tool`. |
| 25 | - `SearchEngine` defines `execute(...)`. |
| 26 | - Imported dependency areas include: `asyncio`, `helpers`, `helpers.errors`, `helpers.print_style`, `helpers.searxng`, `helpers.tool`, `os`. |
| 27 | |
| 28 | ## Key Concepts |
| 29 | |
| 30 | - Important called helpers/classes observed in the source: `Response`, `self.format_result_searxng`, `join.strip`, `self.searxng_search`, `self.agent.handle_intervention`, `searxng`, `handle_error`, `join`. |
| 31 | - Keep request/response, tool, or helper semantics documented here at the same time as source changes. |
| 32 | |
| 33 | ## Work Guidance |
| 34 | |
| 35 | - Keep tool output concise, model-readable, and safe for history persistence. |
| 36 | - Coordinate argument or behavior changes with prompt tool instructions and skill guidance. |
| 37 | - Respect intervention flow for long-running, external, or user-visible operations. |
| 38 | |
| 39 | ## Verification |
| 40 | |
| 41 | - Run targeted tool and prompt-contract tests for changed behavior; smoke-test agent execution when no focused test exists. |
| 42 | - No direct test reference was found by name search; choose the nearest behavioral test or perform a focused smoke check. |
| 43 | |
| 44 | ## Child DOX Index |
| 45 | |
| 46 | No child DOX files. |