Skip to content

Move model-backed tools from Sonar models to Agent API presets (v1.0.0) - #122

Merged
rbuchmayer-pplx merged 1 commit into
perplexityai:mainfrom
rbuchmayer-pplx:agent-api-migration
Jul 27, 2026
Merged

Move model-backed tools from Sonar models to Agent API presets (v1.0.0)#122
rbuchmayer-pplx merged 1 commit into
perplexityai:mainfrom
rbuchmayer-pplx:agent-api-migration

Conversation

@rbuchmayer-pplx

@rbuchmayer-pplx rbuchmayer-pplx commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Migrates the three model-backed tools to the Agent API (POST /v1/agent, the responses API) with managed presets. Tool names and output shape are unchanged.

  • perplexity_ask: sonar-pro -> fast preset
  • perplexity_reason: sonar-reasoning-pro -> medium preset
  • perplexity_research: sonar-deep-research -> high preset
  • perplexity_search: unchanged
  • Citations block kept, now keyed by the agent api's source ids; the answer body is never rewritten
  • All agent calls stream. Reasoning events become MCP progress notifications, MCP cancellation cancels the run server-side, and PERPLEXITY_TIMEOUT_MS now bounds the whole call instead of just time-to-headers
  • Dropped strip_thinking / reasoning_effort from the tool schemas; old clients still sending them are ignored gracefully (tested per tool). Recency/domain/context-size params on perplexity_ask and perplexity_reason map onto the web_search tool (perplexity_research takes messages only, same as before)
  • Bumps to 1.0.0 to signal the backend swap
  • Bumps @modelcontextprotocol/sdk to ^1.29.0 so the tested floor matches what npx installs already resolve (the old ^1.21.1 range meant users got 1.29 while the lockfile tested 1.27)

Measured on the same query set (avg):

  • ask: 15.3s/$0.030 -> 9.4s/$0.011
  • reason: 22.2s/$0.016 -> 14.4s/$0.030
  • research: 228.7s/$0.79 -> 115.6s/$0.62
  • Responses are more concise; research drops from ~87k chars to ~19-28k on the same prompts

82 unit tests plus e2e against prod: all 4 tools over stdio and streamable HTTP with the official MCP client, and a live claude code session. Independent of #121 (the HTTP-mode fix); both are needed for a working HTTP release. npm publish is a separate step; release notes should call out the response-length change and the removed params.

Fixes #110 (research runs now emit notifications/progress while streaming, so clients with request timeouts can keep the call alive).

@rbuchmayer-pplx
rbuchmayer-pplx force-pushed the agent-api-migration branch 6 times, most recently from 4535399 to 2bda500 Compare July 23, 2026 04:32
@rbuchmayer-pplx
rbuchmayer-pplx marked this pull request as ready for review July 23, 2026 19:31
…resets

The three model-backed tools now call the Agent API (POST /v1/agent) with
managed presets:

- perplexity_ask: sonar-pro -> fast preset
- perplexity_reason: sonar-reasoning-pro -> medium preset
- perplexity_research: sonar-deep-research -> high preset

perplexity_search is unchanged. Tool names and output shape are unchanged,
including the appended "Citations:" block: citation lines are keyed by the
Agent API's sequential source ids so inline references line up, and the
answer body is never modified (bracketed tokens also appear in code and
LaTeX). All agent calls stream; PERPLEXITY_TIMEOUT_MS bounds the whole
call, not just time-to-headers. Reasoning events are surfaced as MCP
progress notifications when the client requests progress, and MCP
cancellation aborts the run server-side via the cancel endpoint.

Removed params: strip_thinking (the Agent API emits no think tags) and
reasoning_effort (presets manage effort). Old clients that still send them
are ignored gracefully rather than rejected. search_recency_filter,
search_domain_filter, and search_context_size now map onto the web_search
tool override.

Measured on the same query set (avg): ask 15.3s/$0.030 -> 9.4s/$0.011,
reason 22.2s/$0.016 -> 14.4s/$0.030, research 228.7s/$0.79 -> 115.6s/$0.62.
Responses are more concise, most visibly for research.
@rbuchmayer-pplx
rbuchmayer-pplx merged commit 2011e91 into perplexityai:main Jul 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perplexity_research times out in MCP clients — server buffers full SSE stream, never emits notifications/progress

2 participants