AI product Open source

spec-ptc

spec-ptc is a Python library and demo implementing speculative programmatic tool calling (sPTC) for code-based tool-use harnesses such as Recursive Language Models (RLMs) and CodeAct. While a language model streams code for a REPL call, it identifies closed tool-call statements in the partial code, queues eligible calls as futures, and runs them in a shadow REPL so submodel or tool execution overlaps with continued code generation. When the completed code executes, speculative calls return stored results while non-speculatable or missed calls run normally; tools can be registered with decorators, including controls for speculation and purity. The repository also provides an out-of-process JSON-lines daemon with turn, token-feed, resolution, and cleanup operations, plus wrappers for Claude Code, OpenCode, and Pi-mono.

View repository Mentioned in 1 video ↓

What spec-ptc is used for

1 use taken from transcripts — each links to the moment in the video.

  • A library for speculative programmatic tool calling that launches model calls while code is still being generated. This allows submodel calls to run during generation rather than sequentially afterward.

Videos mentioning spec-ptc

1 in the library.