feat(tools): add Xquik X research tools#5784
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (16)
🚧 Files skipped from review as they are similar to previous changes (7)
📝 WalkthroughWalkthroughAdds five Xquik tools for X/Twitter data retrieval, authenticated REST requests, validation and error handling, package exports, tests, README updates, and localized documentation with navigation entries. ChangesXquik X/Twitter Tool Feature
Sequence Diagram(s)sequenceDiagram
participant Agent as CrewAI Agent
participant XquikTool as Xquik Tool
participant API as Xquik REST API
Agent->>XquikTool: run with search, tweet, user, or trends arguments
XquikTool->>API: GET endpoint with API key and query parameters
API-->>XquikTool: JSON result or error response
XquikTool-->>Agent: tool result or RuntimeError
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
lib/crewai-tools/README.md (1)
29-29: ⚡ Quick winExpand the API integrations list to include all new Xquik tools.
Only
XquikSearchTweetsToolis listed, while this PR ships five Xquik tools. Updating this line improves discoverability.💡 Suggested update
-- **API Integrations**: `SerperApiTool`, `ExaSearchTool`, `XquikSearchTweetsTool` +- **API Integrations**: `SerperApiTool`, `ExaSearchTool`, `XquikSearchTweetsTool`, `XquikGetTweetTool`, `XquikGetUserTool`, `XquikGetUserTweetsTool`, `XquikGetTrendsTool`🤖 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/README.md` at line 29, Update the README line that lists API integrations to include all five Xquik tool class names (not just XquikSearchTweetsTool); locate the entry in lib/crewai-tools/README.md where "API Integrations" mentions `XquikSearchTweetsTool` and add the other four Xquik tool symbols (use the exact exported class names as defined in the diff) so the line enumerates all Xquik tools alongside `SerperApiTool` and `ExaSearchTool`, preserving the same inline code formatting and comma-separated style.lib/crewai-tools/tests/tools/xquik_tool_test.py (1)
87-95: ⚡ Quick winStrengthen encoding assertions with non-safe identifiers.
Line 87 and Line 98 claim path encoding behavior, but current inputs (
"123","crew_ai") don’t require encoding. Add at least one case with reserved characters (e.g., spaces,/,?,%) to verify actual percent-encoding and avoid false confidence in these tests.Also applies to: 98-106
🤖 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/tests/tools/xquik_tool_test.py` around lines 87 - 95, The test test_get_tweet_encodes_tweet_id currently uses safe identifiers ("123") so it doesn't verify URL percent-encoding; update this test (and the analogous one around lines 98-106 that checks user id encoding) to include at least one case with reserved characters (e.g., a tweet_id/user_id containing space, "/", "?", "%") and assert the HTTP GET URL built by XquikGetTweetTool.run (and the user-id test's tool) contains the percent-encoded form (and not the raw reserved characters); locate the code that inspects mock_get.call_args.args[0] and add assertions for the encoded substring (and/or absence of the raw substring) to prove real percent-encoding is applied.
🤖 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/xquik_tool/xquik_tool.py`:
- Around line 183-186: The woeid Field is unbounded and can be 0/negative; add
input validation so callers get a clear error before the API call. Update the
woeid Field declaration(s) (the woeid in the model around the shown block and
the similar Field at the later block) to require a minimum of 1 (e.g.,
Field(..., ge=1, description=...)) or add a pydantic `@validator`("woeid") that
raises ValueError if value < 1, and include a clear message like "woeid must be
>= 1 (use 1 for worldwide)". Ensure both occurrences use the same validation
approach.
- Around line 30-35: The function _normalize_path_identifier currently allows
values like "@" because cleaned.lstrip("@") can become empty; update the
validation to reject identifiers that become empty after stripping leading "@"
by computing stripped = cleaned.lstrip("@") and raising ValueError(f"{name} is
required") if not stripped before calling quote, so the function returns
quote(stripped, safe="") only for non-empty identifiers.
---
Nitpick comments:
In `@lib/crewai-tools/README.md`:
- Line 29: Update the README line that lists API integrations to include all
five Xquik tool class names (not just XquikSearchTweetsTool); locate the entry
in lib/crewai-tools/README.md where "API Integrations" mentions
`XquikSearchTweetsTool` and add the other four Xquik tool symbols (use the exact
exported class names as defined in the diff) so the line enumerates all Xquik
tools alongside `SerperApiTool` and `ExaSearchTool`, preserving the same inline
code formatting and comma-separated style.
In `@lib/crewai-tools/tests/tools/xquik_tool_test.py`:
- Around line 87-95: The test test_get_tweet_encodes_tweet_id currently uses
safe identifiers ("123") so it doesn't verify URL percent-encoding; update this
test (and the analogous one around lines 98-106 that checks user id encoding) to
include at least one case with reserved characters (e.g., a tweet_id/user_id
containing space, "/", "?", "%") and assert the HTTP GET URL built by
XquikGetTweetTool.run (and the user-id test's tool) contains the percent-encoded
form (and not the raw reserved characters); locate the code that inspects
mock_get.call_args.args[0] and add assertions for the encoded substring (and/or
absence of the raw substring) to prove real percent-encoding is applied.
🪄 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: b7366df4-4d6d-45b9-9aa7-36644bf15b67
📒 Files selected for processing (16)
docs/ar/tools/search-research/overview.mdxdocs/ar/tools/search-research/xquiktool.mdxdocs/docs.jsondocs/en/tools/search-research/overview.mdxdocs/en/tools/search-research/xquiktool.mdxdocs/ko/tools/search-research/overview.mdxdocs/ko/tools/search-research/xquiktool.mdxdocs/pt-BR/tools/search-research/overview.mdxdocs/pt-BR/tools/search-research/xquiktool.mdxlib/crewai-tools/README.mdlib/crewai-tools/src/crewai_tools/__init__.pylib/crewai-tools/src/crewai_tools/tools/__init__.pylib/crewai-tools/src/crewai_tools/tools/xquik_tool/README.mdlib/crewai-tools/src/crewai_tools/tools/xquik_tool/__init__.pylib/crewai-tools/src/crewai_tools/tools/xquik_tool/xquik_tool.pylib/crewai-tools/tests/tools/xquik_tool_test.py
0f5c31d to
fdda792
Compare
|
Maintenance update after the branch fell behind main. I rebased the PR on current Focused local validation passed: Ruff format check, Ruff lint, Xquik tool pytest (11 passed), docs JSON parse, and Git diff whitespace check. |
6e5ee0e to
4bdb60a
Compare
|
Maintenance update after the branch fell behind main. I rebased this PR on current Focused local validation passed: |
0bccde5 to
e82ea3e
Compare
e82ea3e to
5eac782
Compare
|
Maintenance update after upstream moved the docs tree. I merged current upstream Focused validation passed:
|
|
Maintenance update after the full review audit. I rebased this PR on current Focused validation passed: Ruff lint, Ruff format, strict mypy for the Xquik package, 12 targeted tests, targeted pre-commit hooks for all changed files, docs JSON parsing, and Git whitespace checks. This contribution used AI assistance. I cannot apply repository labels as an external contributor, so a maintainer must add the required The fresh CodeRabbit review finished successfully with no new actionable findings. |
✅ Action performedReview finished.
|
32ea29d to
9bef066
Compare
|
✅ Action performedReview finished.
|
Summary
crewai_toolsandcrewai_tools.tools.Review Repairs
mainas one signed commit.Validation
uv run ruff check lib/crewai-tools/src/crewai_tools/tools/xquik_tool lib/crewai-tools/tests/tools/xquik_tool_test.pyuv run ruff format --check lib/crewai-tools/src/crewai_tools/tools/xquik_tool lib/crewai-tools/tests/tools/xquik_tool_test.pyuv run mypy lib/crewai-tools/src/crewai_tools/tools/xquik_tooluv run pytest lib/crewai-tools/tests/tools/xquik_tool_test.py -q- 12 passedgit diff --checkThis contribution was prepared with AI assistance. External contributors cannot apply repository labels, so a maintainer must add the required
llm-generatedlabel.Xquik is an independent third-party service. Not affiliated with X Corp. "Twitter" and "X" are trademarks of X Corp.