Perplexity introduced Code Mode to its Agent API on Wednesday allowing models to execute parallel tool calls and reduce research costs by up to 53%, according to Unite.
The feature, identified in requests as programmatic_tool_calling, enables models to replace repetitive round-trips with JavaScript programs that filter and process data within the agent loop, unite.ai reported. This update changes how the Agent API manages tasks; instead of streaming entire reports into the context, a single script can perform parallel searches, deduplicate information, and store raw payloads on disk before returning only necessary summaries, Dev48 noted.
Custom functions pause the program until the developer returns function_call_output elements containing the original caller’s information. The feature allows models to replace repeated round-trips with JavaScript programs that run enabled tools in parallel and filter results.
QuickJS runtime cuts latency and cost versus earlier sandbox
The implementation relies on an embedded QuickJS WebAssembly runtime, which eliminates the need for the previously required Linux sandbox container used in the company’s earlier “Search as Code” system, according to Dev48. By allowing non-blocking execution, the system can return partial results after 10 seconds while scripts continue to run in the background, a change that reduced median task duration by 12.5% and 95-percentile latency by 40.9% in internal tests.
Perplexity reports two outcomes against its earlier presets: higher research scores and benchmark cost reductions of up to 53%. These figures are Perplexity’s own claims, and the 53% figure represents the upper bound of reported savings, meaning actual cost reductions will depend on the workload.

| Configuration | Soft Retrieval Rate | Avg. Cost Per Task |
|---|---|---|
| xhigh (Nov 5 Preset) | 76.5% | $7.30 |
| xhigh (Sol-6.2) | 78.7% | $5.57 |
| xhigh (Sol-6.2 + Code Mode) | 80.5% | $3.85 |
| ultra (Nov 5 Preset) | 85.9% | $21.71 |
| ultra (Opus 5.5 + 3 Sol-6.2) | 88.5% | $12.12 |
| ultra (Opus 5.5 + 3 Sol-6.2 + Code Mode) | 89.4% | $10.30 |
Code Mode enabled for high effort levels but libraries lack types
Code Mode is now enabled by default for high, xhigh, and ultra effort levels, Dev48 confirmed. While the system supports various tools including web search, MCP servers, and sandbox file tools, developers must currently use direct HTTP requests to implement the feature, as version 0.50.0 of the company’s Python library and version 0.45.0 of the TypeScript library lack Code Mode types, unite.ai reported.
Models improve performance with mid-tier integration
Perplexity’s latest expansion brings Code Mode to its high effort level, which previously struggled with syntax errors and inefficient recovery steps. According to Dev48, newer mid-tier models now reach a 47.7% soft retrieval rate at $0.38 per task, marking a 2.9 percentage point improvement over the baseline without requiring specialized prompts or manual research workflows.
This allows you to basically have zero switching cost between models while preserving your sessions, connectors, workflows, automations, persistent AI coworkers (teammates) in one place. No other product offers this with a simple self-serve product and reliable infrastructure.
— Post by @AravSrinivas on X
The company’s sequential testing, as reported by unite.ai, highlights that these gains stem from both model upgrades and the specific execution changes enabled by the QuickJS runtime. As Dev48 notes, the system handles custom functions by pausing the program until the developer returns the required output elements containing the original caller’s information.
Advanced configurations lower costs across benchmarks
Turning on Code Mode with updated reasoning models pushed performance frontiers further in Perplexity’s WANDR benchmark tests. As reported by Dev48, using Sol-6.2 with Code Mode achieved an 80.5% success rate at $3.85 per task, representing a 47% cost reduction compared to the November 5 xhigh preset.
Perplexity has established itself as a significant entity in the AI landscape, reaching a valuation of $21.21 billion as of early 2026. This scale positions the company as a major competitor in the search and synthesis market, supported by a $750 million agreement with Microsoft for cloud and model access.
The programs operate under strict limitations: they cannot import external modules, use fetch, or persist variables between separate script executions. Developers must define programmatic_tool_calling within the tool array of their POST requests to utilize the functionality. Perplexity said that the primary question for the rollout is whether these performance gains persist when users implement their own custom tool combinations and workflows, according to unite.ai.
Related reading