sPTC Open-Sourced: Speculative Programmatic Tool Calling Speeds Up Code Agents by ~1-1.2x
On Aug 25, Alex Zhang released and open-sourced Speculative Programmatic Tool Calling (sPTC), a harness-level optimization for code-centric agent frameworks such as RLM and CodeAct. Experiments show roughly 1-1.2x agent speedups, and the work has drawn repeated amplification and technical breakdowns from accounts like dair-ai and CShorten30.
Confirmed
- Core mechanism: while the LLM streams code REPL call blocks, a "Shadow REPL" speculatively queues and executes upcoming tool calls in parallel, caching results; once the prediction is validated, results are immediately available, overlapping tool-call time with token generation and REPL execution
- Motivation: in traditional harnesses, agents must wait for the model's streaming output to finish before invoking tools, making tool calling a new bottleneck in agent applications
- Inspired by CPU speculative execution and LLM speculative decoding; it is a harness-level optimization that requires no changes to the model
- The project is open-sourced on GitHub and applies to frameworks like RLM and CodeAct
Why it matters
- By overlapping tool execution with code generation, sPTC cuts end-to-end latency without touching the model—a practical acceleration technique
- Multiple technical accounts have reshared and analyzed it, indicating notable community interest
- Related discussions also mention speculative collaboration as an extension direction
2026-08-25 ~ 2026-08-26 · 13 related posts
Primary sources
- [source] Speculative Programmatic Tool Calling Overlaps Code Gen and LLM Inference — a1zhang · 2026-08-25
- [source] sPTC speeds up agents via speculative tool calling — a1zhang · 2026-08-25
- sPTC: Speculative Tool Calling Overlaps Execution With Token Generation — CShorten30 · 2026-08-25
- sPTC speculatively launches tool calls during code generation, speeding agents 1-1.2x — dair_ai · 2026-08-25
- Speculative Tool Calling Overlaps Gen and Execution for Faster Agents — CShorten30 · 2026-08-25
- Speculative Programmatic Tool Calling (sPTC) Accelerates Code Execution — eliebakouch · 2026-08-25
- Research: Speculative Programmatic Tool Calling Speeds Up Code Gen — a1zhang · 2026-08-25
- Speculative Programmatic Tool Calling Speeds Up Agents — CShorten30 · 2026-08-25
- Speculative Programmatic Tool Calling (sPTC) Explained — CShorten30 · 2026-08-26
- Explained: Speculative Programmatic Tool Calling (sPTC) — CShorten30 · 2026-08-26
- Speculative Programmatic Tool Calling Speeds Up Code Agents by 1.2x — a1zhang · 2026-08-26
2 near-duplicate retellings: eshorten300 · Saboo_Shubham_