Perplexity adds Code Mode to its Agent API
Models can write one JavaScript script that runs tools in parallel and returns only the results they need.
Code Mode is exposed in the API as programmatic_tool_calling. Perplexity says standard tool calling forces a full model round-trip after every search, fetch or API call, pulling raw payloads into the context window. With Code Mode, the model writes a script that calls its tools directly, runs them in parallel and keeps only what matters. Scripts run as JavaScript in an embedded QuickJS WebAssembly runtime inside the agent loop—no sandbox container required.
Where it’s available
Code Mode ships in the updated high, xhigh and ultra effort levels and can be enabled directly in custom requests. Web search, URL fetching, people search, finance search, MCP servers and sandbox file or shell tools can all be called from the same script.
Benchmark results
Perplexity reported these results on WANDR, its own benchmark for wide and deep research:
| Effort level | Models | Score | Cost per task |
|---|---|---|---|
| high | Newer mid-tier models | 47.7% | $0.38 |
| xhigh | Sol-6.2 | 80.5% | $3.85 |
| ultra | Opus 5.5 + 3 Sol-6.2 | 89.4% | $10.30 |
Perplexity says xhigh and ultra now cost 47% and 53% less per task than its earlier presets—gains that reflect both model upgrades and Code Mode.