You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Python Code Interpreter Result drops non-standard MIME types instead of collecting them into extra #1984
Result in the Python Code Interpreter SDK (e2b_code_interpreter/models.py) declares an extra field for data "not part of the standard types", but __init__ drops unknown keys from the kernel message via **kwargs instead of collecting them into extra. Non-standard MIME types the IPython kernel sends — e.g. application/vnd.plotly.v1+json, application/vnd.bokeh+json, application/vnd.vega.v5+json — are silently lost. The JS SDK's Result constructor already sweeps these into extra.
To reproduce
importjsonfrome2b_code_interpreter.modelsimportExecution, parse_outputexecution=Execution()
parse_output(execution, json.dumps({
"type": "result",
"is_main_result": True,
"text": "hello",
"application/vnd.plotly.v1+json": {"data": [{"x": [1, 2]}]},
}))
result=execution.results[0]
print(result.extra) # None — the plotly payload is droppedprint(list(result.formats())) # ['text'] — the custom MIME is missingprint(execution.to_json()) # extra is absent from the serialized output
For comparison, the JS SDK's Result collects the same key into extra, lists it in formats(), and includes it in toJSON().
Expected behavior
result.extra holds the non-standard MIME payload, formats() lists the custom MIME type, and Execution.to_json() preserves it — matching the JS SDK.
Actual behavior
The non-standard MIME type is dropped at construction, so extra is None, formats() omits it, and to_json() loses the data.
Environment
SDK: e2b-code-interpreter (Python), current main
Additional context
The extra field is documented as "Extra data that can be included. Not part of the standard types." — the intent is to retain these, but __init__ never assigns **kwargs to it. IPython display data commonly carries non-standard MIME types for interactive plots, so this loses real user data.
This is the Python side of the Result serialization surface and is separate from the open cluster: #1939/#1971 (data in toJSON), #1948 (chart in toJSON), #1826/#1893 (chart deserialization). None touch Python Result.__init__'s extra collection.
summary: The Python Code Interpreter Result.__init__ discards unknown kernel keys passed via **kwargs instead of storing them in extra, so non-standard MIME outputs (e.g. Plotly/Bokeh/Vega JSON) are missing from extra, formats(), and Execution.to_json(), unlike the JS SDK. Assumes the fix is to bring Python in line with the JS SDK's behavior.
Hi, I would like to work on this. Plan: in the Python code interpreter Result model (e2b_code_interpreter/models.py), preserve non-standard MIME types instead of dropping them during Result construction, and add tests covering a non-standard MIME type end to end.
Activity
devin-ai-integration commentedon Oct 15, 2026
Triage
e2b_code_interpreter/models.pyResult.__init__)Result.__init__discards unknown kernel keys passed via**kwargsinstead of storing them inextra, so non-standard MIME outputs (e.g. Plotly/Bokeh/Vega JSON) are missing fromextra,formats(), andExecution.to_json(), unlike the JS SDK. Assumes the fix is to bring Python in line with the JS SDK's behavior.Written by Devin
CloudCorpRecords commentedon Oct 16, 2026
Hi, I would like to work on this. Plan: in the Python code interpreter Result model (e2b_code_interpreter/models.py), preserve non-standard MIME types instead of dropping them during Result construction, and add tests covering a non-standard MIME type end to end.
CloudCorpRecords commentedon Oct 16, 2026
Withdrawing my claim: PR #1985 already implements this fix. My check missed the cross-referenced PR. Good luck landing it.