Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Lift-and-shift Python code with the @step decorator

Focus mode
Lift-and-shift Python code with the @step decorator - Amazon SageMaker AI

The @step decorator is a feature that converts your local machine learning (ML) code into one or more pipeline steps. You can write your ML function as you would for any ML project. Once tested locally or as a training job using the @remote decorator, you can convert the function to a SageMaker AI pipeline step by adding a @step decorator. You can then pass the output of the @step-decorated function call as a step to Pipelines to create and run a pipeline. You can chain a series of functions with the @step decorator to create a multi-step directed acyclic graph (DAG) pipeline as well.

The setup to use the @step decorator is the same as the setup to use the @remote decorator. You can refer to the remote function documentation for details about how to setup the environment and use a configuration file to set defaults. For more information about the @step decorator, see sagemaker.workflow.function_step.step.

To view to sample notebooks that demonstrate the use of @step decorator, see @step decorator sample notebooks.

The following sections explain how you can annotate your local ML code with a @step decorator to create a step, create and run a pipeline using the step, and customize the experience for your use case.

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.