Skip to content

feat: add SkimReaderTool (x402-native clean web reader)#6264

Open
JessieJanie wants to merge 1 commit into
crewAIInc:mainfrom
JessieJanie:add-skim-reader-tool
Open

feat: add SkimReaderTool (x402-native clean web reader)#6264
JessieJanie wants to merge 1 commit into
crewAIInc:mainfrom
JessieJanie:add-skim-reader-tool

Conversation

@JessieJanie

@JessieJanie JessieJanie commented Jun 20, 2026

Copy link
Copy Markdown

What

Adds SkimReaderTool — a clean web reader for agents. Give it any URL and it returns agent-ready Markdown (nav, ads, and boilerplate stripped) plus structured metadata (title, byline, published date, language, excerpt).

It is built on the x402 payment protocol: each read costs $0.002 in USDC on Base, paid automatically by a wallet the user controls. There is no signup and there are no API keys — the wallet is the identity. The private key never leaves the user's machine; it only signs an EIP-3009 USDC authorization locally.

Why

CrewAI already ships several scraping/reader tools, but none are pay-per-call over an open payment rail. SkimReaderTool gives agents a no-signup, no-API-key way to read the web and pay only for what they use — a natural fit alongside the existing Firecrawl/Scrape tools.

Usage

from crewai_tools import SkimReaderTool

tool = SkimReaderTool()  # reads SKIM_WALLET_PRIVATE_KEY from the environment
tool.run(url="https://en.wikipedia.org/wiki/HTTP_402")

Install the x402 EVM client alongside crewai-tools:

pip install "x402[evm]" 'crewai[tools]'

Changes

  • New tool: src/crewai_tools/tools/skim_reader_tool/ (tool + README.md)
  • Registered in src/crewai_tools/tools/__init__.py and src/crewai_tools/__init__.py
  • Added optional skim extra in pyproject.toml (x402[evm], eth-account, requests); deps are imported lazily so the tool only requires them when run
  • Tests: tests/tools/skim_reader_tool_test.py (no network — a fake payment-aware session is injected)
  • Regenerated tool.specs.json to include the new entry

Notes

  • Heavy/payment deps (x402[evm], eth-account, requests) are imported inside _get_session(), so importing the tool has no new hard dependencies.
  • tool.specs.json was regenerated to match the existing format; if maintainers prefer, the Generate Tool Specifications workflow can re-run it on merge (it is gated to same-repo PRs, so it does not run on forks).
  • Docs: https://skim402.com · x402 protocol: https://x402.org

Summary by CodeRabbit

  • New Features

    • Added SkimReaderTool: Fetches any URL and converts it into clean, agent-ready Markdown with optional metadata in YAML frontmatter format.
    • Supports pay-per-call billing via x402/USDC on Base chain.
  • Documentation

    • Added comprehensive setup and usage documentation for SkimReaderTool.

Adds SkimReaderTool, a pay-per-call clean web reader for agents. Returns
agent-ready Markdown + structured metadata for any URL, paying $0.002/call
in USDC on Base over the x402 protocol (no API keys, no signup).

@corridor-security corridor-security Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corridor found no security issues!

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds SkimReaderTool, a new CrewAI tool that fetches arbitrary URLs through the Skim API using the x402/USDC payment protocol. The implementation includes lazy session construction with EVM payment signing, YAML frontmatter metadata rendering, package dependency declarations, public exports, a tool spec entry, README documentation, and pytest unit tests using fake HTTP session/response doubles.

Changes

SkimReaderTool: x402 Pay-per-call URL Reader

Layer / File(s) Summary
Tool schema, constants, and YAML scalar helper
lib/crewai-tools/src/crewai_tools/tools/skim_reader_tool/skim_reader_tool.py
Defines DEFAULT_BASE_URL, _TOOL_DESCRIPTION, the _yaml_scalar helper that collapses multi-line text and quotes ambiguous YAML values, and SkimReaderToolSchema with its url field.
SkimReaderTool class, session management, and run path
lib/crewai-tools/src/crewai_tools/tools/skim_reader_tool/skim_reader_tool.py
Defines the SkimReaderTool class with all configuration fields (base_url, max_price_usd, include_metadata, timeout, private_key) and SKIM_WALLET_PRIVATE_KEY env var declaration. Implements _get_session() to lazily import x402/EVM/requests deps, validate and load the wallet key, register an EVM client with a max-amount payment policy, and cache the wrapped session. Implements _run() to POST to /api/v1/read, handle HTTP and JSON errors as RuntimeError, and assemble the final Markdown with optional YAML frontmatter.
Package exports, optional deps, tool spec, and README
lib/crewai-tools/pyproject.toml, lib/crewai-tools/src/crewai_tools/__init__.py, lib/crewai-tools/src/crewai_tools/tools/__init__.py, lib/crewai-tools/tool.specs.json, lib/crewai-tools/src/crewai_tools/tools/skim_reader_tool/README.md
Adds the skim optional dependency group to pyproject.toml. Registers SkimReaderTool in both __init__.py import/__all__ locations. Adds a full tool spec entry to tool.specs.json with init/run parameter schemas. Adds the README documenting installation, wallet setup, and usage examples.
Unit tests with fake session and response doubles
lib/crewai-tools/tests/tools/skim_reader_tool_test.py
Introduces _FakeResp and _FakeSession test doubles and eight test functions covering YAML frontmatter rendering, metadata field omission, text fallback when markdown is absent, base_url routing, RuntimeError on HTTP errors and non-JSON responses, _yaml_scalar edge cases, and tool metadata assertions.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main change: introducing a new SkimReaderTool that uses x402 protocol for payment-based web reading.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
lib/crewai-tools/pyproject.toml (1)

29-33: 💤 Low value

Inconsistent requests version lower bound.

The main dependencies (line 12) specify requests>=2.33.0, but the skim extra allows >=2.31.0. This inconsistency won't cause issues when both are installed together, but consider aligning versions or omitting requests from the extra since it's already a main dependency.

Suggested fix
 skim = [
     "x402[evm]>=2.0.0",
     "eth-account>=0.13.0",
-    "requests>=2.31.0",
 ]

Or align the version:

-    "requests>=2.31.0",
+    "requests>=2.33.0",
🤖 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 `@lib/crewai-tools/pyproject.toml` around lines 29 - 33, The skim extra
dependencies list includes requests>=2.31.0, but the main dependencies already
specify requests>=2.33.0, creating an inconsistency. Either remove the requests
dependency from the skim extra list entirely since it is already specified as a
main dependency, or if you must keep it in the skim extra, update it to
requests>=2.33.0 to align with the version constraint specified in the main
dependencies section.
🤖 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.

Inline comments:
In `@lib/crewai-tools/src/crewai_tools/tools/skim_reader_tool/README.md`:
- Around line 20-22: The fenced code blocks in the README.md file are missing
explicit language labels, which violates the MD040 markdown linting rule. Add
the language identifier `bash` to both unlabeled code blocks: change the opening
fence on line 20 (before the pip install command) from three backticks to three
backticks followed by `bash`, and similarly update the opening fence on line 27
(before the export SKIM_WALLET_PRIVATE_KEY command) to include the `bash`
language label.

---

Nitpick comments:
In `@lib/crewai-tools/pyproject.toml`:
- Around line 29-33: The skim extra dependencies list includes requests>=2.31.0,
but the main dependencies already specify requests>=2.33.0, creating an
inconsistency. Either remove the requests dependency from the skim extra list
entirely since it is already specified as a main dependency, or if you must keep
it in the skim extra, update it to requests>=2.33.0 to align with the version
constraint specified in the main dependencies section.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 38d0e104-48d8-46bb-91b7-004ea1990bc7

📥 Commits

Reviewing files that changed from the base of the PR and between 9db2d44 and e131793.

📒 Files selected for processing (8)
  • lib/crewai-tools/pyproject.toml
  • lib/crewai-tools/src/crewai_tools/__init__.py
  • lib/crewai-tools/src/crewai_tools/tools/__init__.py
  • lib/crewai-tools/src/crewai_tools/tools/skim_reader_tool/README.md
  • lib/crewai-tools/src/crewai_tools/tools/skim_reader_tool/__init__.py
  • lib/crewai-tools/src/crewai_tools/tools/skim_reader_tool/skim_reader_tool.py
  • lib/crewai-tools/tests/tools/skim_reader_tool_test.py
  • lib/crewai-tools/tool.specs.json

Comment on lines +20 to +22
```
pip install "x402[evm]" 'crewai[tools]'
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add explicit fence languages to satisfy Markdown linting

Line 20 and Line 27 use unlabeled fenced code blocks, which triggers MD040. Please label both as bash.

Suggested patch
-```
+```bash
 pip install "x402[evm]" 'crewai[tools]'

- +bash
export SKIM_WALLET_PRIVATE_KEY=0xYOUR_BASE_WALLET_PRIVATE_KEY

Also applies to: 27-29

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 20-20: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 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 `@lib/crewai-tools/src/crewai_tools/tools/skim_reader_tool/README.md` around
lines 20 - 22, The fenced code blocks in the README.md file are missing explicit
language labels, which violates the MD040 markdown linting rule. Add the
language identifier `bash` to both unlabeled code blocks: change the opening
fence on line 20 (before the pip install command) from three backticks to three
backticks followed by `bash`, and similarly update the opening fence on line 27
(before the export SKIM_WALLET_PRIVATE_KEY command) to include the `bash`
language label.

Source: Linters/SAST tools

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