[SCR-383] Auto-Mode (mode=auto) support#3
Open
kostas-jakeliunas-sb wants to merge 1 commit into
Open
Conversation
Auto-Mode (mode=auto) lets the ScrapingBee API pick the cheapest scraping config that succeeds (cheapest->expensive, stops at first success, charges only the winning config). The tools already pass arbitrary params straight through to the API, so this is a docs-only change so an LLM agent will actually choose it: - langchain_scrapingbee/tools.py: add `mode` and `max_cost` to ScrapeUrlTool's documented/allowed params (SUPPORTED PARAMS list + prose hint + ScrapeUrlInput.params example). Documents accurately: mode='auto' is GET-only, cheapest-first, charged only for the winning config (0 on full failure), reports credits in the Spb-auto-cost header, and must not be combined with render_js/premium_proxy/ stealth_proxy/transparent_status_code; max_cost (int >= 1) caps spend and requires mode='auto'. - README.md: add an Auto-Mode usage example mirroring the existing ones. - pyproject.toml / release_notes.md: bump 0.2.0 -> 0.2.1 + changelog entry (matches repo's version-field + release_notes convention). No request-code or architecture change; no validation added. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
marius-nemeiksis-sbee
approved these changes
Jul 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tl;dr
Docs-only change so a LangChain agent can choose ScrapingBee Auto-Mode (
mode=auto). The tools already spread arbitraryparamsinto the request, somode/max_costwork today — the LLM just won't select them until the tool docstring lists them. No request-code or architecture change; no validation added.Summary
langchain_scrapingbee/tools.py— addedmodeandmax_costtoScrapeUrlTool's LLM-facing docs so an agent will pick Auto-Mode:mode+max_costentries in theSUPPORTED PARAMSlist (the existingUNSUPPORTED PARAMS: anything not listedclause now permits them);mode='auto'…");{"mode": "auto", "max_cost": 25}example in theScrapeUrlInput.paramsfield description.mode='auto'is GET-only, cheapest→expensive, charges only the winning config (0 on full failure), reports credits via theSpb-auto-costresponse header, and must not be combined withrender_js/premium_proxy/stealth_proxy/transparent_status_code;max_cost(int ≥ 1) caps spend and requiresmode='auto'.README.md— added an Auto-Mode usage example (Test Case 1b) mirroring the existing examples, passingparams={"mode":"auto","max_cost":25}toScrapeUrlTool.pyproject.toml/release_notes.md— bumped0.2.0→0.2.1and added a changelog entry (matches the repo's version-field +release_notes.mdconvention; repo has no git tags).Test plan
pytest --disable-socketunit suite — 90 passed (no code path changed; docstrings/version only).python -c "ast.parse(...)"—tools.pycompiles.ruff check— net +3 E501 (long-line) only, matching this file's prevailing one-line-per-param docstring style (177 pre-existing E501; repo lint baseline is already non-clean and ungated). No new rule classes introduced.make integration_tests) require a liveSCRAPINGBEE_API_KEYand the server Auto-Mode flag enabled — run when the server feature ships (this is why the PR stays draft).mode='auto'for an unknown site andSpb-auto-costreflects the winning tier.🤖 Generated with Claude Code