MCPcopy Create free account
hub / github.com/modelscope/ms-agent / _parse_sandbox_result

Method _parse_sandbox_result

ms_agent/skill/container.py:833–850  ·  view source on GitHub ↗

Parse sandbox execution results into stdout, stderr, exit_code.

(self,
                              results: Dict[str, Any])

Source from the content-addressed store, hash-verified

831 return '\n'.join(lines)
832
833 def _parse_sandbox_result(self,
834 results: Dict[str, Any]) -> tuple[str, str, int]:
835 """Parse sandbox execution results into stdout, stderr, exit_code."""
836 stdout_parts = []
837 stderr_parts = []
838 exit_code = 0
839
840 for executor_type in ['python_executor', 'shell_executor']:
841 if executor_type in results:
842 for result in results[executor_type]:
843 if result.get('output'):
844 stdout_parts.append(result['output'])
845 if result.get('error'):
846 stderr_parts.append(result['error'])
847 if result.get('status', 0) != 0:
848 exit_code = result.get('status', -1)
849
850 return '\n'.join(stdout_parts), '\n'.join(stderr_parts), exit_code
851
852 async def _execute_in_sandbox(
853 self,

Callers 4

execute_python_scriptMethod · 0.95
execute_python_codeMethod · 0.95
execute_shellMethod · 0.95
execute_javascriptMethod · 0.95

Calls 1

getMethod · 0.80

Tested by

no test coverage detected