Skip to main content
Project 4 min read

Local LLM Tool Calling for Clawdbot

Enable tool calling for local LLMs in Clawdbot with sglang/vLLM support. Add free DuckDuckGo search without API keys.

Originally published:

GitHub by jokelord

Local Model Tool Calling Support for Clawdbot

This patch enables Clawdbot, the open-source AI agent framework, to support tool calling functionality for local inference models running on sglang and vLLM. It solves a critical gap where tool calling worked reliably with cloud providers (OpenAI, Anthropic) but failed with self-hosted models. The patch also introduces DuckDuckGo as a free, API-key-free web search provider with built-in anti-bot detection bypass.

Purpose and Significance

Developers running local AI inference pipelines face a structural limitation: Clawdbot's tool calling mechanism worked seamlessly with cloud APIs but had no way to declare tool support for self-hosted models like Qwen3-Coder or Mistral running on sglang/vLLM. This patch eliminates that bottleneck by introducing a declarative configuration system and automatic tool support detection. It's essential for organizations building private AI agents, running air-gapped systems, or optimizing inference costs through local deployment. The addition of free DuckDuckGo search removes another dependency barrier—users no longer need Brave Search or Perplexity API keys for web context.

Core Features

  • Local Model Tool Declaration: Add a supportedParameters field to model configuration to explicitly declare which API parameters your local model supports (e.g., tools, parallel_function_calling).
  • Automatic Tool Detection: New modelSupportsTools() function scans model configuration and inference server responses to determine tool capability without manual trial-and-error.
  • Free DuckDuckGo Search: Zero-API-key web search using curl implementation that bypasses anti-bot detection and respects system proxy settings automatically.
  • Backward Compatible: Existing cloud provider configurations continue working unchanged; tool support defaults to enabled for models without explicit supportedParameters declaration.
  • Coding Profile Integration: Ensures the coding profile includes web tools in its allow list, enabling autonomous web research alongside code generation.
  • Tested with Qwen3-Coder: Validated against Qwen3-Coder-30B-A3B-Instruct-FP8 with sglang's --tool-call-parser qwen3_coder.

Getting Started

Step 1: Launch sglang with Tool Parser
Start your inference server with the correct tool-call parser enabled:

python -m sglang.launch_server \
  --model-path /path/to/Qwen3-Coder-30B-A3B-Instruct-FP8 \
  --tool-call-parser qwen3_coder \
  --port 30000 \
  --host 0.0.0.0

Step 2: Configure Clawdbot
Update ~/.clawdbot/clawdbot.json with your local provider endpoint:

Step 3: Apply and Build
Copy patch files into Clawdbot source, then rebuild:

cd /path/to/clawdbot
pnpm install
pnpm build
sudo npm install -g .

How the Patch Works

The root problem stems from how Clawdbot detects tool support. For cloud providers, it parses API metadata to check the supported_parameters field. Local models have no equivalent mechanism. This patch adds three layers of support:

  1. Schema Extension: ModelCompatSchema now accepts a supportedParameters array, allowing users to declare capabilities in configuration.
  2. Detection Logic: model-compat.ts introduces modelSupportsTools() which checks declared parameters before sending tool requests.
  3. Web Search Enhancement: web-search.ts adds DuckDuckGo as a provider with curl-based HTTP requests that respect proxies and evade anti-bot detection better than undici/fetch.

Tool calling is now sent to local models only when supportedParameters includes "tools", preventing errors from unsupported inference servers.

Who This Is For

  • AI Engineers running private or on-premise LLM deployments needing agentic tool use without cloud dependencies.
  • Organizations with data sensitivity requirements or regulatory constraints preventing cloud API usage.
  • Cost-Optimization Teams leveraging local inference to reduce per-token costs while maintaining tool calling capabilities.
  • Clawdbot Users building coding agents who want free web search without API key friction.
  • Self-Hosted AI Stack Builders integrating sglang/vLLM backends into autonomous agent workflows.

Technical Modifications

The patch modifies nine files across configuration, type definitions, detection logic, and tool implementations. Key changes include:

  • src/config/zod-schema.core.ts — Add supportedParameters to model compatibility schema
  • src/config/zod-schema.agent-runtime.ts — Register DuckDuckGo as web search provider
  • src/agents/model-compat.ts — New function for tool support detection
  • src/agents/tools/web-search.ts — DuckDuckGo implementation with curl backend
  • src/agents/pi-embedded-runner/run/attempt.ts — Tool creation logic with support checks

Tested Configuration

Model: Qwen3-Coder-30B-A3B-Instruct-FP8 | Inference Server: sglang with qwen3_coder parser | Clawdbot Version: 2026.2.3s | Result: ✅ Tool calls execute successfully

Resources

  • Clawdbot Fork — Full fork with integrated patch
  • Patch Repository — This project on GitHub
  • README Files — English and Chinese documentation included

Source: GitHub repository jokelord/openclaw-local-model-tool-calling-patch (Updated Feb 2026)

Share:

Original Source

https://github.com/jokelord/openclaw-local-model-tool-calling-patch

View Original

Last updated: