Skip to content

symfonic.core.tools.web_tools

web_tools

Web tools — mediate between agent state and WebFetcher/WebSearcher.

All tool functions follow the Phase 2 access pattern

fetcher = state["deps"].get(WebFetcher)

No direct infrastructure imports (requests, httpx, aiohttp) allowed.

web_fetch async

web_fetch(
    state: dict[str, Any], url: str, timeout: float = 30.0
) -> FetchResult

Fetch a URL via the injected WebFetcher.

Source code in src/symfonic/core/tools/web_tools.py
async def web_fetch(
    state: dict[str, Any], url: str, timeout: float = 30.0
) -> FetchResult:
    """Fetch a URL via the injected WebFetcher."""
    fetcher = _get_web_fetcher(state)
    return await fetcher.fetch(url, timeout=timeout)
web_search(
    state: dict[str, Any],
    query: str,
    limit: int = 10,
    timeout: float = 30.0,
) -> list[SearchResult]

Search the web via the injected WebSearcher.

Source code in src/symfonic/core/tools/web_tools.py
async def web_search(
    state: dict[str, Any],
    query: str,
    limit: int = 10,
    timeout: float = 30.0,
) -> list[SearchResult]:
    """Search the web via the injected WebSearcher."""
    searcher = _get_web_searcher(state)
    return await searcher.search(query, limit=limit, timeout=timeout)