refactor(interpreter): support backend-specific code execution - #75
Draft
isaacbmiller wants to merge 1 commit into
Draft
refactor(interpreter): support backend-specific code execution#75isaacbmiller wants to merge 1 commit into
isaacbmiller wants to merge 1 commit into
Conversation
Route CodeAct tools through the CodeInterpreter capability boundary, pass backend guidance through call-local signatures, support custom Parameter state loading, and make binary RLM payload transport portable across constrained interpreters. Amp-Thread-ID: https://ampcode.com/threads/T-019fb0dc-8d11-7510-abc9-4bc180e4e6e4 Co-authored-by: Isaac Miller <isaac@cmpnd.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes DSPy's existing code-execution modules work cleanly with constrained or remote
CodeInterpreterimplementations without adding a runtime abstraction or coupling core to any backend.CodeInterpreter.toolscapability boundary instead of copying host function source into the guestexecution_instructionsSandboxSerializabletransport independent of thebase64standard-library module by usingbytes.fromhexallow_unsafe_lm_stateto any customParameter.load_stateimplementation that accepts it, rather than special-casingPredictMotivation
Implementing a second real interpreter backend exposed places where RLM and CodeAct accidentally depended on Deno/Pyodide details despite already accepting a generic
CodeInterpreterfactory. These changes keep backend ownership behind the existing interpreter interface and are independently useful for constrained, remote, and capability-based interpreters.No Monty implementation or dependency is included in this PR.
Compatibility
execution_instructionsis optional and does not expand the required runtime-checkableCodeInterpreterprotocolValidation
120 passed, 58 skippedacross RLM, CodeAct, and BaseModule focused tests15 passedgit diff --checkpassedRepository-wide collection is blocked in this orb by unrelated missing optional dependencies:
numpy,datamodel_code_generator, and Pillow.Review setup
The GitHub App token cannot create a PR directly against
stanfordnlp/dspy. This fork draft targetsmonty-upstream-base, the exact upstream parent commit (0312f0d), so the diff contains only this upstreamable commit. The eventual target isstanfordnlp/dspy:main.