feat(ensemble): add pyodide_safe_mode + async-DI to synthesize_panel (sy-huo)#454
Merged
Conversation
…(sy-huo) v1.2.0 lets Cloudflare Python Worker (pyodide) consumers — boardroom is the first — drive the judge call through their own async LLM stack end-to-end instead of crashing on synth_panel's threading-based client. Three additive kwargs on synthesize_panel: * judge_enabled=False — skip the judge LLM call entirely; returns a degenerate SynthesisResult synchronously. No thread spawn, no fetch deps, no LLM cost. * llm_client=<AsyncLLMClient> — inject a consumer-owned async client. Function returns a coroutine the consumer's event loop drives. * pyodide_safe_mode=True — hard guard; raises ValueError unless one of the safe paths is selected, instead of silently spawning a thread the runtime can't actually run. AsyncLLMClient is a runtime-checkable Protocol — one method, returning AsyncCompletion (text + optional usage). Any consumer's async LLM stack satisfies it with a 10-line adapter. Both exposed via synth_panel.ensemble.__all__. Default behavior unchanged — every v1.1.0 call site keeps working.
This was referenced May 12, 2026
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
v1.2.0 lets Cloudflare Python Worker (pyodide) consumers — boardroom is the
first — drive the judge call through their own async LLM stack end-to-end
instead of crashing on synth_panel's threading-based client. Three additive
kwargs on
synthesize_panel, all default-off; every v1.1.0 call site keepsworking.
New kwargs on
synthesize_paneljudge_enabled=False— skip the judge LLM call entirely; returns a degenerateSynthesisResultsynchronously. No thread spawn, no fetch deps, no LLM cost.llm_client=<AsyncLLMClient>— inject a consumer-owned async client. Function returns a coroutine the consumer's event loop drives.pyodide_safe_mode=True— hard guard; raisesValueErrorunless one of the safe paths is selected, instead of silently spawning a thread the runtime can't actually run.AsyncLLMClientis aruntime_checkableProtocol— one method, returningAsyncCompletion(text + optional usage). Any consumer's async LLM stacksatisfies it with a ~10-line adapter. Both
AsyncLLMClientandAsyncCompletionare exposed viasynth_panel.ensemble.__all__.Compatibility
Default behavior unchanged — every v1.1.0 call site keeps working. New
kwargs are opt-in.
Test plan
synth_panel.ensemblepublic-API tests continue to enforce the surface.References