hermes - ✅(Solved) Fix [Feature]: Add Kimi backend support for web_search [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#11637Fetched 2026-04-18 05:59:39
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
cross-referenced ×1labeled ×1

Error Message

For unsupported operations such as web_extract or web_crawl, Hermes should return a clear error telling the user to switch to a backend like Firecrawl or Tavily.

Fix Action

Fixed

PR fix notes

PR #10874: feat(web_search): add Kimi global/CN web_search support

Description (problem / solution / changelog)

What does this PR do?

This PR improves Kimi web-search integration in tools/web_tools.py by adding robust dual-key support (KIMI_API_KEY or KIMI_CN_API_KEY) .

It fixes provider selection/credential-routing issues for Kimi web search and removes noisy serializer warnings caused by Kimi builtin tool calls (type="builtin_function"), while preserving backward compatibility for other web backends.

Related Issue

Resolves #11637

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • Updated Kimi backend availability checks to support both KIMI_API_KEY and KIMI_CN_API_KEY.
  • Added provider-aware Kimi credential resolution in:
    • tools/web_tools.py
  • Added Kimi China endpoint support (https://api.moonshot.cn/v1) for web search.
  • Updated Kimi chat-completion path to use OpenAI SDK for consistency with main agent/provider routing behavior.
  • Added standalone .env loading in tools/web_tools.py main entrypoint (aligns local testing behavior with runtime env loading).
  • Added/updated Kimi diagnostics in --show-env output (global key, CN key, resolved base URL).
  • Added standardized tool_error(...) helper usage path for web tool error responses.
  • Suppressed Pydantic serialization warnings for Kimi builtin tool calls using JSON-mode dumps with warnings disabled.
  • Removed unused helper _get_kimi_base_url.
  • Updated tests in:
    • tests/tools/test_web_tools_config.py
    • Added coverage for:
      • Kimi global-only and CN-only backend detection
      • dual-key routing preference behavior
      • Kimi credential resolution edge cases
      • required env metadata updates

How to Test

  1. Run targeted tests:

    source venv/bin/activate
    python -m pytest tests/tools/test_web_tools_config.py -q
    python -m pytest tests/tools/test_web_tools_tavily.py -q
  2. Configure Kimi web backend:

    ~/.hermes/config.yaml:

    web:
      backend: kimi

    ~/.hermes/.env (example):

    KIMI_CN_API_KEY=...
    # or KIMI_API_KEY=...
  3. Verify runtime behavior:

    source venv/bin/activate
    python tools/web_tools.py --show-env
    python tools/web_tools.py --query "Moonshot AI Context Caching 是什么" --limit 3

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Linux (local CLI environment)

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
    • N/A (no public docs changed in this PR)
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
    • N/A (no new config key added)
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
    • N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A
    • N/A (runtime behavior changed, schema contract unchanged)

Changed files

  • tests/tools/test_web_tools_config.py (modified, +85/-0)
  • tools/web_tools.py (modified, +291/-93)
  • website/docs/guides/automate-with-cron.md (modified, +9/-9)
  • website/docs/integrations/index.md (modified, +4/-3)
  • website/docs/reference/tools-reference.md (modified, +1/-2)
  • website/docs/user-guide/configuration.md (modified, +4/-3)
RAW_BUFFERClick to expand / collapse

Problem or Use Case

I'm trying to use Hermes with Kimi / Moonshot as my primary model provider, but currently there's no native way to use Kimi as a web search backend.

Today, Hermes supports web search backends like Firecrawl, Tavily, Exa, and Parallel, but users who already have Kimi API access cannot route web_search through Kimi's built-in search capability. This creates a few problems:

  • Kimi users need to configure and pay for an additional search provider even when their model platform already supports web search.
  • China-based users may prefer Moonshot / Kimi endpoints for reliability, latency, or regional availability.
  • The current setup makes Kimi feel incomplete compared with other supported providers in Hermes' web tooling.

Proposed Solution

Add kimi as a supported backend for Hermes web tools, specifically for web_search.

Proposed behavior:

  • Allow web.backend: kimi in Hermes config.
  • Support both global and China credentials:
    • KIMI_API_KEY
    • KIMI_CN_API_KEY
  • Automatically resolve the correct Kimi / Moonshot base URL from the configured key type.
  • Use Kimi's built-in $web_search capability to execute searches.
  • Normalize Kimi search responses into Hermes' existing standard web result schema so downstream behavior stays consistent.
  • Allow fallback backend detection to select kimi when Kimi credentials are present and no explicit backend is configured.
  • Add tests covering backend selection, credential resolution, and availability checks.
  • Document the setup in the user guide / tools reference / integrations docs.

To keep scope manageable, this feature can be limited to web_search only for now. For unsupported operations such as web_extract or web_crawl, Hermes should return a clear error telling the user to switch to a backend like Firecrawl or Tavily.

This would make Kimi a first-class option for users who want a simpler, more region-friendly web search workflow inside Hermes.

Alternatives Considered

No response

Feature Type

Configuration option

Scope

None

Contribution

  • I'd like to implement this myself and submit a PR

Debug Report (optional)

extent analysis

TL;DR

To add Kimi as a supported backend for Hermes web tools, implement the proposed solution by modifying the Hermes configuration to allow web.backend: kimi, supporting both global and China credentials, and normalizing Kimi search responses.

Guidance

  • Modify the Hermes configuration to accept kimi as a valid backend for web_search by adding web.backend: kimi to the config options.
  • Implement credential resolution to automatically detect the correct Kimi / Moonshot base URL based on the configured key type (KIMI_API_KEY or KIMI_CN_API_KEY).
  • Develop tests to cover backend selection, credential resolution, and availability checks to ensure the feature works as expected.
  • Update the user guide, tools reference, and integrations docs to include setup instructions for using Kimi as a web search backend.

Example

No code example is provided as the issue does not contain sufficient technical details to generate a specific code snippet.

Notes

The proposed solution is limited to web_search only, and unsupported operations like web_extract or web_crawl will return an error message instructing the user to switch to a different backend.

Recommendation

Apply the proposed workaround by implementing the suggested changes to add Kimi as a supported backend for Hermes web tools, as it addresses the current limitations and provides a more region-friendly web search workflow.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix [Feature]: Add Kimi backend support for web_search [1 pull requests, 1 participants]