feat(experimental): add capability-limited Monty programs - #74
Closed
isaacbmiller wants to merge 2 commits into
Closed
feat(experimental): add capability-limited Monty programs#74isaacbmiller wants to merge 2 commits into
isaacbmiller wants to merge 2 commits 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>
Add an optimizable MontyProgram and persistent MontyInterpreter with real DSPy syntax, approved host capabilities, shared budgets, resource limits, and depth-two nested RLM execution. Amp-Thread-ID: https://ampcode.com/threads/T-019fb0dc-8d11-7510-abc9-4bc180e4e6e4 Co-authored-by: Isaac Miller <isaac@cmpnd.ai>
Author
|
Superseded by #75, which contains only the generic upstreamable DSPy interpreter changes. The Monty implementation remains available on feature/monty-rlm as a separate-library/reference branch and is intentionally not proposed for DSPy main. |
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
Adds an experimental Monty backend for optimizable, capability-limited DSPy programs and recursive code execution.
MontyProgram, an optimizable DSPyModule/Parameterwhose source composes realdspy.Predict,ChainOfThought,RLM,CodeAct,ProgramOfThought,ReAct, andReActV2syntaxMontyInterpreterwith stateful sessions, typed/untypedSUBMIT, recoverable guest errors, terminal worker failures, and resource limitsCodeInterpreter.toolsinstead of copying host source into the guestSandboxSerializabletransport portable withbytes.fromhexBaseModule.load_stateflag forwarding for customParameterimplementationsWhy Monty
Monty is constrained Python rather than full CPython. With warm caches in the development orb, a usable Monty session started in roughly 3 ms and used roughly 7.5 MiB per worker, versus roughly 2.4 seconds and 165 MiB for Deno/Pyodide. This makes nested interpreter trees practical while retaining Deno as the compatibility backend.
The guest receives copied values and explicit capabilities—not ambient DSPy objects, LM credentials, host filesystem, environment, network, or arbitrary imports.
Scope
This draft intentionally excludes filesystem mounts, network access, AsyncMonty, shared pools, snapshots, and broad CPython compatibility. Those remain use-case-driven follow-ups.
Validation
138 passed, 124 skipped271 passedwith three stale CodeAct expectations; after correcting them, Deno-enabled CodeAct passed15 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, which is the exact upstream parent commit (0312f0d), so the diff contains only the two intended commits. The eventual upstream target isstanfordnlp/dspy:main.