News · Perplexity AI · 2 min read
Event date: · Published:
Perplexity adds Code Mode to its Agent API, cutting agentic task cost by up to 53%
Perplexity's new Code Mode lets models write JavaScript that runs Agent API tool calls in parallel, cutting costs by up to 53% on its WANDR benchmark suite.
Perplexity AI introduced Code Mode, a new programmatic tool calling feature in its Agent API, on December 2, 2026. The feature lets models write JavaScript that executes tool calls in parallel inside a QuickJS sandbox instead of making sequential round trips, and Perplexity's own benchmarks show the approach cutting agentic task costs by up to 53% on its WANDR task suite, according to Perplexity's announcement.
What's changing in the Agent API
programmatic_tool_calling, known as Code Mode, lets models write JavaScript that runs tool calls in parallel instead of one by one, executing inside a QuickJS WebAssembly sandbox that can batch calls, save raw payloads to disk, and emit compact summaries.- Supported tools include
web_search,fetch_url,people_search,finance_search, MCP servers, and sandbox file and shell tools. - Code Mode is available at the high, xhigh, and ultra effort levels, and for custom requests, of the Agent API.
- On the WANDR benchmark, the Sol-6.2 tier with Code Mode scores 80.5% at $3.85 per task, a 47% cost cut versus the November baseline.
- A combined Opus 5.5 plus 3x Sol-6.2 configuration with Code Mode scores 89.4% at $10.30 per task, a 53% cost cut versus the November baseline.
- A new
exec_waitfeature cuts median task runtime by 12.5%, p95 runtime by 40.9%, and maximum runtime by 56.6%.
What it means for AI builders
Letting agents batch tool calls as executable code rather than firing them one by one is a direct, measurable way to cut the cost of running agentic workflows at scale. The WANDR results suggest that teams running high-volume agent tasks, such as research lookups or multi-step queries through web_search, fetch_url, or MCP servers, could see both lower per-task spend and faster completion once Code Mode is turned on at the high, xhigh, ultra, or custom effort levels of the Agent API. The exec_wait runtime gains compound that benefit by shrinking the tail latency of the slowest tasks.
Sources
- Introducing Code Mode in the Agent API (Perplexity AI, December 2, 2026, official)
Written with AI assistance, strictly from the sources listed above. Before it went live, automated checks verified its dates, sources and every language edition.