feat(xai): add x_search tool — search X via xAI Responses API#12528
Closed
Julientalbot wants to merge 2 commits into
Closed
feat(xai): add x_search tool — search X via xAI Responses API#12528Julientalbot wants to merge 2 commits into
Julientalbot wants to merge 2 commits into
Conversation
Extracted and standalone-ified from Jaaneek's PR NousResearch#10600 / Teknium's split PR NousResearch#10786. The x_search tool is the smallest, most self-contained piece of that work and doesn't depend on image/video generation changes, so it ships cleanly on its own while NousResearch#10786 rebases. ## What New tool `x_search` backed by xAI's built-in `x_search` Responses API tool. Searches X (Twitter) posts with configurable model, timeout, retry count, handle filtering, and citation extraction. ## Why split PR NousResearch#10786 bundles x_search + video_generation + image_generation xAI backend in ~2k lines across 8 files. Tests on that branch currently regress (mostly unrelated flake from Discord/Telegram suites on CI, plus xai_media asserts drifted vs evolving main). Shipping x_search alone gets 351 LOC of production + 207 LOC of tests into main while the heavier media pieces are rebased. Co-authored credit preserved. ## Scope - tools/x_search_tool.py — tool implementation (351 LOC) - tests/tools/test_x_search_tool.py — unit tests (207 LOC, 6 tests) - toolsets.py — add x_search to _HERMES_CORE_TOOLS + new TOOLSETS entry - hermes_cli/tools_config.py — add x_search to CONFIGURABLE_TOOLSETS Deliberately **not** changing: image_generation_tool.py, video_generation_tool.py, browser_cdp (preserved), xAI TTS wiring (already on main via NousResearch#10783). ## Tests - tests/tools/test_x_search_tool.py — 6 passed - tests/ -k toolset — 126 passed, 4 skipped - tests/ -k tools_config — 91 passed, 4 skipped - Registry smoke: x_search registered, browser_cdp preserved ## Config Reads optional `x_search` section from user config: ```yaml x_search: model: grok-4.20-reasoning # default timeout_seconds: 180 # default retries: 2 # default ``` ## Requirements Gated on `XAI_API_KEY` (already wired by PR NousResearch#10783). Co-authored-by: Jaaneek <Jaaneek@users.noreply.github.com> Co-authored-by: Teknium <127238744+teknium1@users.noreply.github.com>
Add a short subsection under xAI provider docs explaining how to enable the x_search toolset, its optional config (model/timeout/retries), and what it returns. Co-located with the other xAI wiring docs. Co-authored-by: Jaaneek <Jaaneek@users.noreply.github.com>
Contributor
Author
|
Heads up on CI — |
Contributor
Author
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.
What does this PR do?
Adds a new standalone
x_searchtool that queries X (Twitter) posts using xAI's built-inx_searchResponses API tool. This is the smallest, most self-contained chunk extracted from Jaaneek's PR #10600 / Teknium's split PR #10786 and ships cleanly against current main.Related
Type of Change
Why standalone
PR #10786 bundles x_search with video_generation and image_generation xAI backend changes (~2k LOC across 8 files). Its CI currently fails on a mix of unrelated test drift (Discord/Telegram harness) and xai_media mock assertions that need rebasing against evolving main. Shipping x_search alone:
Co-authored-bytrailers.Media tools (
video_generation_tool.py,image_generation_tool.pyxAI backend) intentionally not in this PR — happy to send follow-ups once #10786 lands or once the community decides on its rebase path.Changes
tools/x_search_tool.pytests/tools/test_x_search_tool.pytoolsets.pyx_searchto_HERMES_CORE_TOOLS+ newTOOLSETSentry.browser_cdppreserved (unlike the #10786 diff which accidentally dropped it — that entry was added to main after the PR branched).hermes_cli/tools_config.pyx_searchentry toCONFIGURABLE_TOOLSETSHow to test
Requires
XAI_API_KEYin~/.hermes/.env(get one at https://console.x.ai/).End-to-end:
Verify the response includes an answer with citations to X posts.
hermes toolsconfigurator should show "🐦 X (Twitter) Search" entry.Configuration
Optional
x_searchsection in user config:Checklist
Code
pytestand all relevant tests pass (x_search: 6/6, toolsets: 126/126, tools_config: 91/91)Documentation & Housekeeping
website/docs/covering x_search + the feat(xai): upgrade to Responses API, add TTS provider #10783 xAI additionshermes_cli/tools_config.pyfor the new toolset entryx_searchCo-authored-by: Jaaneek Jaaneek@users.noreply.github.com
Co-authored-by: Teknium 127238744+teknium1@users.noreply.github.com