How can I enable the sphere brush for 3d view in ‘erase’ option and control the sphere radius through the script?
You can find code examples to all commonly needed operations in the script repository - see how to adjust brush parameters here. List of all built-in Segment Editor effect parameters is available here.