Skip to content

chore(oxylabs): allow the 3.x oxylabs SDK - #7330

Closed
oxy-giedrius wants to merge 2 commits into
crewAIInc:mainfrom
oxy-giedrius:chore/oxylabs-sdk-3x
Closed

chore(oxylabs): allow the 3.x oxylabs SDK#7330
oxy-giedrius wants to merge 2 commits into
crewAIInc:mainfrom
oxy-giedrius:chore/oxylabs-sdk-3x

Conversation

@oxy-giedrius

@oxy-giedrius oxy-giedrius commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Related to #7306.

Stacked on #7044, as requested in review — the failure-handling and base-tool work
stays there, this carries only the dependency bump.

Summary

oxylabs is pinned to exactly 2.0.0 in lib/crewai-tools/pyproject.toml, so
consumers can't take 3.0.0, released in March. This relaxes it to
oxylabs>=2.0.0,<4.

3.x keeps the RealtimeClient surface these tools use (RealtimeClient(username, password, **kwargs) with sdk_type, results[0].content, results[0].status_code,
and the universal / google / amazon namespaces), and adds sources rather than
removing any.

The lockfile keeps oxylabs at 2.0.0, so this permits the upgrade without forcing
it on anyone.

Testing

All four Oxylabs tools were verified against the live Oxylabs API on oxylabs
2.0.0 and 3.0.0, along with each failure path from #7044 (invalid credentials, a
config the source rejects, an upstream 404, and a timeout):

Tool 2.0.0 3.0.0
OxylabsUniversalScraperTool pass pass
OxylabsGoogleSearchScraperTool pass pass
OxylabsAmazonSearchScraperTool pass pass
OxylabsAmazonProductScraperTool pass pass

uv lock --check passes with uv 0.11.3, the version pinned in
.pre-commit-config.yaml and the CI workflows. The lockfile change is a single line —
the recorded specifier. Regenerating it wholesale also rewrote ~60 lines of unrelated
platform-marker churn and re-stamped the relative exclude-newer cutoff, so I applied
only the specifier change and verified the result is consistent.

Note on the diff

Because a PR from a fork can't target another fork branch, this is opened against
main and therefore also shows #7044's commit. Once #7044 merges, the diff here
reduces to the two-line dependency change. Happy to rebase it whenever that lands.

AI-generated contribution

Per CONTRIBUTING.md, this was authored with an AI coding assistant (Claude Code) and
needs the llm-generated label, which I can't apply from a fork — could a maintainer
add it?

oxy-giedrius and others added 2 commits September 8, 2026 09:41
The oxylabs SDK logs HTTP errors and returns an empty response rather than
raising, so the unchecked `response.results[0]` in every Oxylabs tool turned a
rejected request into `IndexError: list index out of range`. Invalid credentials
-- the most likely first-run mistake -- gave no indication of the cause. A
result carrying a non-2xx `status_code` had the same problem one level down: the
job ran, the page did not come back, and the tool returned its empty content as
though the scrape had succeeded, handing the agent "[]".

Both are now reported as a `ToolFailure` naming what went wrong, so the agent
gets something it can act on and the framework records the call as failed:

    401 Unauthorized
    400 Bad Request - Parameter `parsing_instructions` can be used just with
    `parse` parameter set to `true`.

Because the SDK keeps the cause only in its own log, the failing call is run
with a handler attached to the `oxylabs` logger and the status, the API's
explanation and timeouts are read back off it. `code` and `retryable` are set
from the status, so 429 and 5xx are marked worth retrying. Nothing about the
caller's logging configuration is changed; an application that has silenced the
SDK still gets the generic failure.

Content that is neither a string nor a dict is also serialized properly:
`parsing_instructions` commonly yields a list, and the previous `str()`
fallback produced a Python repr with single quotes instead of JSON.

The client construction and response handling these four tools duplicated
verbatim now live in a shared `OxylabsBaseTool`, following the existing
`SerpApiBaseTool` pattern, so the handling above exists in one place. The
generated tool specs change only by the new `locale` field, confirming the
tools' public surface is otherwise untouched.

Also add the `locale` option to the Google Search config, which the docs
already documented but the config model silently dropped, and correct two
copy-paste errors in the docs across all four locales.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`oxylabs` was pinned to exactly 2.0.0, so consumers could not take 3.0.0, out
since March. 3.x keeps the `RealtimeClient` surface these tools use, and all
four tools plus their failure paths were verified against the live API on both
2.0.0 and 3.0.0.

The lockfile keeps oxylabs at 2.0.0, so this permits the upgrade rather than
forcing it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Thanks for the pull request.

First-time contributors need an associated open issue before we can review a PR.

  1. Open an issue with a template, or pick an existing open one.
  2. Open a new PR (or reopen this one) whose title or body mentions that issue, for example #123.

See the contributing guide.

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: cad2a4b4-e88b-4180-b1d0-b6cc5f299d22

📥 Commits

Reviewing files that changed from the base of the PR and between 7e18abd and 3460df8.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (13)
  • docs/edge/ar/tools/web-scraping/oxylabsscraperstool.mdx
  • docs/edge/en/tools/web-scraping/oxylabsscraperstool.mdx
  • docs/edge/ko/tools/web-scraping/oxylabsscraperstool.mdx
  • docs/edge/pt-BR/tools/web-scraping/oxylabsscraperstool.mdx
  • lib/crewai-tools/pyproject.toml
  • lib/crewai-tools/src/crewai_tools/tools/oxylabs_amazon_product_scraper_tool/oxylabs_amazon_product_scraper_tool.py
  • lib/crewai-tools/src/crewai_tools/tools/oxylabs_amazon_search_scraper_tool/oxylabs_amazon_search_scraper_tool.py
  • lib/crewai-tools/src/crewai_tools/tools/oxylabs_base_tool/__init__.py
  • lib/crewai-tools/src/crewai_tools/tools/oxylabs_base_tool/oxylabs_base_tool.py
  • lib/crewai-tools/src/crewai_tools/tools/oxylabs_google_search_scraper_tool/oxylabs_google_search_scraper_tool.py
  • lib/crewai-tools/src/crewai_tools/tools/oxylabs_universal_scraper_tool/oxylabs_universal_scraper_tool.py
  • lib/crewai-tools/tests/tools/test_oxylabs_tools.py
  • lib/crewai-tools/tool.specs.json

📝 Walkthrough

Walkthrough

Oxylabs scraper tools now share OxylabsBaseTool for SDK setup, credentials, scraping, response handling, and structured failures. Tests cover the new behavior. Tool specifications, dependency constraints, and multilingual documentation are updated.

Changes

Oxylabs scraper consolidation

Layer / File(s) Summary
Shared Oxylabs runtime
lib/crewai-tools/src/crewai_tools/tools/oxylabs_base_tool/oxylabs_base_tool.py
Adds shared credential handling, SDK initialization, scraping execution, response serialization, and ToolFailure generation.
Scraper tool delegation
lib/crewai-tools/src/crewai_tools/tools/oxylabs_*_scraper_tool/*.py
Updates the four scraper tools to inherit from OxylabsBaseTool and delegate requests through _scrape.
Failure coverage and tool contracts
lib/crewai-tools/tests/tools/test_oxylabs_tools.py, lib/crewai-tools/pyproject.toml, lib/crewai-tools/tool.specs.json
Adds failure and configuration tests, expands the Oxylabs dependency range, and adds the nullable Google Search locale parameter.
Oxylabs documentation corrections
docs/edge/{ar,en,ko,pt-BR}/tools/web-scraping/oxylabsscraperstool.mdx
Corrects the Google Search spelling and updates Amazon domain descriptions.

Sequence Diagram(s)

sequenceDiagram
  participant ScraperTool
  participant OxylabsBaseTool
  participant RealtimeClient
  participant ToolFailure
  ScraperTool->>OxylabsBaseTool: call _scrape with a scraper endpoint
  OxylabsBaseTool->>RealtimeClient: send authenticated request
  RealtimeClient-->>OxylabsBaseTool: return response or SDK logs
  OxylabsBaseTool->>ToolFailure: report diagnosed errors
Loading

Suggested reviewers: lorenzejay

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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