Q:

Processing: QGIS Crash with new processing script format, QGIS 3.6.1

I've just started to use the new (3.6.1) processing script format (see https://github.com/qgis/QGIS-Enhancement-Proposals/issues/134 or https://anitagraser.com/2019/03/02/easy-processing-scripts-comeback-in-qgis-3-6/) and tried to put 2 processing algorithmen in it (centroid and buffer), but without success. The script stopped with a :( QGIS crashed. May be someone can help me to get the right idea to connect various processing steps within the new format. Here is my script:
from qgis.processing import alg
import processing
@alg(name="centroids_and_buffer", label=alg.tr("Centroids and buffer"), group="examplescripts", group_label=alg.tr("Example Scripts"))
@alg.input(type=alg.SOURCE, name="INPUT", label="Input layer")
@alg.input(type=alg.SINK, name="OUTPUT", label="Output layer") 
def testalg(instance, parameters, context, feedback, inputs):
    """
    Description goes here. (Don't delete this! Removing this comment will cause errors.)
    """
    source = instance.parameterAsVectorLayer(parameters, "INPUT", context)
    output = instance.parameterAsOutputLayer(parameters, "OUTPUT", context)

    centroids = processing.run("native:centroids", {'INPUT': source,'ALL_PARTS': True, 'OUTPUT': 'memory:'})
    #now the buffer
    alg_params = {'DISSOLVE': False,
        'DISTANCE': 0.001,
        'END_CAP_STYLE': 0,
        'INPUT': centroids['OUTPUT'],
        'JOIN_STYLE': 0,
        'MITER_LIMIT': 2,
        'SEGMENTS': 5,
        'OUTPUT': 'memory:'}
    buffer= processing.run("native:buffer", alg_params)
    print(buffer['OUTPUT'])
    #output = buffer['OUTPUT']
    return {"OUTPUT": buffer['OUTPUT']}

A:

Thanks to the qgis-user@lists.osgeo.org I could solve the problem. There is a brief description how to proceed with the new @alg decorator at: https://docs.qgis.org/testing/en/docs/user_manual/processing/scripts.html#the-alg-decorator. Finally the script looks like this:
from qgis.processing import alg
import processing

@alg(name="centroids_and_buffer", label=alg.tr("Centroids and buffer"), group="examplescripts", group_label=alg.tr("Example Scripts"))
@alg.input(type=alg.SOURCE, name="INPUT", label="Input layer")
@alg.input(type=alg.VECTOR_LAYER_DEST, name='BUFFER_OUTPUT', label='Buffer output')

def centroids_and_buffer(instance, parameters, context, feedback, inputs):
    """
    Description goes here. (Don't delete this! Removing this comment will cause errors.)
    """
    source = instance.parameterAsVectorLayer(parameters, "INPUT", context)
    if feedback.isCanceled():
        return {}

    centroids = processing.run("native:centroids", 
            {'INPUT': parameters['INPUT'],
            'ALL_PARTS': True, 
            'OUTPUT': 'memory:'},
            is_child_algorithm=True,
            context=context,
            feedback=feedback)

    if feedback.isCanceled():
        return {}   

    alg_params = {'DISSOLVE': False,
            'DISTANCE': 0.01,
            'END_CAP_STYLE': 0,
            'INPUT': centroids['OUTPUT'],
            'JOIN_STYLE': 0,
            'MITER_LIMIT': 2,
            'SEGMENTS': 5,
            'OUTPUT': parameters['BUFFER_OUTPUT']}

    buffer = processing.run("native:buffer", alg_params,
            is_child_algorithm=True,
            context=context,
            feedback=feedback)

    if feedback.isCanceled():
        return {}    

    return {'BUFFER_OUTPUT': buffer['OUTPUT']}

