openclaw - 💡(How to fix) Fix feat(web_search): expose Perplexity `search_context_size` (low/medium/high content-budget)

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…

The web_search tool's JSON schema (in dist/openclaw-tools-*.jsWebSearchSchema) accepts: query, count, country, language, freshness, date_after, date_before, search_lang, ui_lang, domain_filter, max_tokens, max_tokens_per_page.

It does not expose Perplexity's search_context_size parameter (added by Perplexity in 2026) — the content-budget knob that controls how deeply Sonar searches: low, medium, high. When the active provider is Perplexity (e.g. sonar / sonar-pro / sonar-deep-research), agents have no way to ask for a deeper search via the tool surface.

Root Cause

In three-cubes/tc-agent-zone, agents doing research that requires depth (TAM analysis, competitor cards, regulatory review) end up issuing many shallow shotgun queries because they can't ask Sonar for a high content budget. Workarounds we use today: switch the agent's model mid-session to perplexity-proxy/sonar-deep-research, or fall back to manual Kairix + web_fetch against primary sources. Both work but neither is the right shape.

Fix Action

Fix / Workaround

In three-cubes/tc-agent-zone, agents doing research that requires depth (TAM analysis, competitor cards, regulatory review) end up issuing many shallow shotgun queries because they can't ask Sonar for a high content budget. Workarounds we use today: switch the agent's model mid-session to perplexity-proxy/sonar-deep-research, or fall back to manual Kairix + web_fetch against primary sources. Both work but neither is the right shape.

Code Example

search_context_size: {
  type: "string",
  enum: ["low", "medium", "high"],
  description: "Provider-specific content budget hint. For Perplexity (sonar/*) this maps to web_search_options.search_context_size. Other providers may ignore."
}
RAW_BUFFERClick to expand / collapse

Summary

The web_search tool's JSON schema (in dist/openclaw-tools-*.jsWebSearchSchema) accepts: query, count, country, language, freshness, date_after, date_before, search_lang, ui_lang, domain_filter, max_tokens, max_tokens_per_page.

It does not expose Perplexity's search_context_size parameter (added by Perplexity in 2026) — the content-budget knob that controls how deeply Sonar searches: low, medium, high. When the active provider is Perplexity (e.g. sonar / sonar-pro / sonar-deep-research), agents have no way to ask for a deeper search via the tool surface.

Effect we're seeing

In three-cubes/tc-agent-zone, agents doing research that requires depth (TAM analysis, competitor cards, regulatory review) end up issuing many shallow shotgun queries because they can't ask Sonar for a high content budget. Workarounds we use today: switch the agent's model mid-session to perplexity-proxy/sonar-deep-research, or fall back to manual Kairix + web_fetch against primary sources. Both work but neither is the right shape.

Proposed change

Add search_context_size to WebSearchSchema:

search_context_size: {
  type: "string",
  enum: ["low", "medium", "high"],
  description: "Provider-specific content budget hint. For Perplexity (sonar/*) this maps to web_search_options.search_context_size. Other providers may ignore."
}

Plumb it through to the Perplexity provider call as web_search_options.search_context_size. For non-Perplexity providers, the schema field can be silently ignored at the adapter level (or rejected with an actionable fix: per agent-actionable-feedback.md).

Reference

Happy to PR the schema + adapter plumbing if helpful.

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

openclaw - 💡(How to fix) Fix feat(web_search): expose Perplexity `search_context_size` (low/medium/high content-budget)