Description
When running complex Python code inside the Code Interpreter, we’ve observed that warnings and errors from the Python runtime are streamed directly back to the agent—and consequently shown to the end-user.
Example
Query to the agent:
"Generate a sunburst chart based on job titles in the report."
Expected behaviour:
The agent explains what a sunburst chart is and the steps it will take to generate it.
Actual behavior:
While streaming the response, the agent emits chunks of messages that include internal warnings from the Code Interpreter, such as:
/home/sandbox/.local/lib/python3.11/site-packages/plotly/express/_core.py:1637: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead. df_all_trees = df_all_trees.append(df_tree, ignore_index=True) /home/sandbox/.local/lib/python3.11/site-packages/plotly/express/_core.py:1637: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead. df_all_trees = df_all_trees.append(df_tree, ignore_index=True)
(same warning message, duplicated)
Finally, the run fails with a non-intuitive error "Run failed with status: failed for agent GeneralAssistant and thread thread_PTCvyjhsL3dzqtASi7bH3TRp" with Last Error: Sorry, something went wrong.
Questions:
What is your recommendation to handle scenarios like this?
How we can avoid sending this kind of code interpreter error&warnings messages to the end-user? Ideally, such logs should be available for debugging but hidden from the user-facing interface.
Is there any mechanism available to intercept or filter the input/output of the Code Interpreter tool?
(e.g., something similar to the Filter concept used in Plugins?)
Semantic-kernel version: 1.29.0