3.0 Get Started

3.0.1 Part 0 : Setup Explanation of the case

Use case get started

The goal of this use case is to accompany you in the use of the platform with a simple and basic machine learning application. You can test this example directly in the platform to understand the mechanics presented.

The final goal of this get started will be to be able to generate predictions on the Craft AI platform from our personal computer. The model used to generate predictions will be the iris one, but you can use any Python code.

To achieve this goal, we will go through several parts:

Setup - part 0

This page is about the setup of the platform in your Python code and in the Craft AI platform UI in your browser. We will also explain to you how to retrieve your GitHub deploy key, which will be important for the creation of your steps and pipelines in the next part.


  • Python 3.8 or higher is required to be installed on your computer.

  • We strongly recommend the use of Google Chrome browser to use the UI of the platform.

  • You will need access to administrative setting on the GitHub repository, which contains the ML Python code you want to put on the platform.

3.0.2 Setup GitHub

The first thing to know is that the platform can only access code on GitHub. So you first need to have a GitHub repository with the code you want to run in it that the Craft AI platform can access.

In this section, you will create the repository that contains your Python code. You can create an empty GitHub repository on the GitHub website or use an existent repository.

If you had created a repository on GitHub, you can initialize your local folder and link it with GitHub by typing these commands in your terminal:

echo "# Get started - Craft AI platform" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/*GitHub_user*/*repository_name*.git
git push -u origin main

If you want to use an existing repository, make sure you have access to the administrative settings.

3.0.3 Get your credentials from the front-end App

There are 2 ways to access the platform:

  • With the Python SDK, in line of code

  • With the web interface, in a browser

To use the Python SDK (which will allow you to perform most actions) you will need an identification token. To do this, we use a token that is given to you on the web UI. You must therefore connect to it first.

You will have 2 connection methods, one for the UI with login and password and one for the SDK with a token. Access user interface

Go to https://mlops-platform.craft.ai and log in with your profile (if you don’t have already received link to create an account, please contact Craft AI team by Slack or by email).

If you cannot see any new page after logging in, it means that you don’t yet have access to the platform. Please contact the support team to grant you access to the platform.

When they let you know that you have access, log in again, and you should see a new page appear:

🎉 You are connected to the Craft UI ! Get token access

Once logged in, click on your name in the top right corner and then go to the “Parameters” page.

There you can generate and find your SDK token at the bottom.


The SDK token is strictly personal. You must keep it to yourself. Allow access to your GitHub repository

Now that you have access to the platform, the platform must have access to your code, which was previously or will be pushed to GitHub.

To get access to your GitHub project, the platform uses a Deploy Key with the RSA SSH KEY standard. The deploy key is a special key provided by GitHub that grants access to a specific repository; it is not the same as personal keys used commonly by users to access their repositories, although they are both SSH keys.

ℹ️ Note that this SSH key pair has no relationship to the UI login/password and SDK access token.

The login/password and SDK token are credentials between the user and the platform in general. The SSH key pair here serves as an identifier between a project (or step) and a GitHub repository.

For example, you can have 15 users, each with a different login/password and token, with just one project link to a repository with one SSH key pair.


The deploy key has two elements:

  • The public key, which must be added in the GitHub administration settings for the repository.

  • The private key, which must be sent to the Craft AI MLOps Platform, so it can access the repository.

Please follow these steps:

  1. You will need to generate an SSH key on your computer. You can skip this step if you received a public key via email from the Craft AI team.

    • On Linux and macOS

    Move to a new directory and run the following command in a terminal, by replacing *your-key-filename* by a name of your choosing. ssh-keygen -m PEM -t rsa -b 4096 -f *your-key-filename* -q -N "" -C "" This will generate two files:

    • A file named *your-key-filename* with the “private key” used by the platform to access to your GitHub repository.

    • And a file named *your-key-filename*.pub with the “public key” used to create the Deploy Key on GitHub.

    These files should not be included in the step’s directory. Only the type of SSH key generated by this command is accepted when creating the Step.

    Example on Linux / macOS :

    ssh-keygen -m PEM -t rsa -b 4096 -f **keyAccesPlatformCraftAI** -q -N "" -C ""
    • On Windows (version 10 or more)

    • Check that OpenSSH is installed and install it if it is not the case. (Go in Settings > Apps & features > Optional feature to get list of features and click on add feature to find and install OpenSSH)

    • Press the Windows key.

    • Type cmd.

    • Under Best Match, right-click Command Prompt.

    • Click Run as Administrator.

    • If prompted, click Yes in the ``Do you want to allow this app to make changes to your device?`` pop-up.

    • In the command prompt, type the following:

    • By default, the system will save the keys to C:\Users\your_username\.ssh\id_rsa. This can help distinguish between keys, if you are using multiple key pairs. To stick to the default option, press Enter.

    • You’ll be asked to enter a passphrase. Hit Enter to skip this step.

    • The system will generate the key pair, and display the key fingerprint and a random art image.

    • Open your file browser.

    • Navigate to C:\Users\your_username\.ssh.

    • You should see two files. The identification (private key) is saved in the id_rsa file and the public key is labeled id_rsa.pub. This is your SSH key pair.

  2. Head to the homepage of your repository on GitHub.

  3. Go to the Settings page.

  4. Once there, select the tab on the left named Deploy Keys

  5. Select Add deploy key on the Deploy Keys page.

  6. Insert the name you want for your deploy key.

  7. Copy/paste the public key (content of *your-key-filename*.pub) in the second text box.

  8. Click on “Add key” (you don’t need to allow write access)

    🎉 You can upload your code on the platform with the Python SDK and GitHub.


From this moment you can see the Python command in the notebook on GitHub repo link to this get started.

3.0.4 Organization on platform



Pipelines have one step for the moment. Multi-step pipelines will be available soon. Project

A project is a complete use case. From data import, through experimentation, testing and production, to performance monitoring over time.

If this is your first connection to your organization, we’ve already created a project with an environment setup in it. This project is a link to the public key you received via email from Craft AI. So you can link this project to any GitHub repository (following the previous part about it).

But you may need another project. If you want to do that, you can follow these instructions :

  • Create a project

  1. Click on “New project”

  2. Enter information for project creation:

    • Project name: Name of your project, here we choose “GetStarted”

    • Python version: Version of Python to run your ML code on the platform.

    • Repository URL: URL of your GitHub repository (for example: git@github.com:*your-organization*/*your-repository*.git).

      Warning : Choose the SSH format

    • Deploy key: It’s the private key you have just created.

      You need to keep the tags at the beginning and at the end, your private key should look like this :

    • Default branch: Enter the Git branch you want as default for this project. If this field is empty, we will use the default branch of your GitHub repository.

    • Folders: This is the list of folders that will be accessible by the platform. By default, just type / to have access to all the repositories.

    • requirements.txt: Path to the requirements.txt file containing the list of Python libraries to install. (you will create it later in the get started thus you can let it empty for now)

    • System dependencies: Enter the list the APT and/or APK packages that you want to install automatically on this project.

  3. Click on “Create project”. Environment

An environment is the infrastructure used by the platform to store data and run computation.

When you first try the platform, an environment has already been created in the existing project. The environment is the object associated with the SDK, and is identified by a URL (sent by email) that must be specified when you connect to the Python SDK.


Environnement URL is NOT the HTML address of the User Interface. Environnement URL as a format such as https://nice-odin-yellow-pi-32.mlops-platform.craft.ai

  • Process to ask for environment creation

If you have a project, you can ask for environments. To create an environment, you have to email the support team at Craft AI with your request. You can use this template email:

--------------------------------- My demand -------------------------------

Choose between :
- Create an env
- Edit an env
- Delete an env

-------------------------------- Env name -------------------------------

Precise the name of env to create or the name of existing env you
want to edit/delete

---------------------------------- Hardware -------------------------------

Choose between :
- CPU - Starter
- CPU - Standard
- CPU - Medium
- CPU - Large
- GPU - Standard

---------------------------------- Tag -----------------------------------

Choose between these tags to set an environnement type :
- Dev
- Pre-prod
- Prod
  • Example

    --------------------------------- My demand -------------------------------
    Create an env
    ------------------------------- Env name -------------------------------
    ---------------------------------- Hardware -------------------------------
    CPU - Starter
    ---------------------------------- Tag -----------------------------------

After a short period of time, you will receive confirmation by email from Craft AI. You will receive the URL of your new environment, keep it, you will need it.

3.0.5 Connect Python Craft AI SDK Set up the Python SDK

The Python SDK can be installed with pip from a terminal.

pip install craft-ai-sdk

For this use case, you also need NumPy if you don’t have already installed it on your machine.

pip install numpy Initialization of Python SDK

Run the following commands in a Python terminal to initialize the SDK.

  1. Set the value of CRAFT_AI_ENVIRONMENT_URL into a local environment variable with your environment URL (you should get it from Craft AI team). Also, set the value of CRAFT_AI_SDK_TOKEN into local environment variable with the deploy key, obtained from the Craft UI in the previous part.

    A good practice would be to create a script per environment that contains the setup of these 2 local environment variables. For example, you could create an .env-test-platform-craft-ai file.

    export CRAFT_AI_ENVIRONMENT_URL="*your-env-URL*"
    export CRAFT_AI_ACCESS_TOKEN="*your-token-acces*"
  2. Here, we use the source command to define the values of the variables written to the file.

    source .env-test-platform-craft-ai
  3. Execute the following Python code to set up SDK Python object.

    import os
    from craft_ai_sdk import CraftAiSdk
    sdk = CraftAiSdk(

    🎉 Well done! You’re ready to execute your first code on the platform! What’s next ?

Now that we have configured the platform, we can create our first objects and run a “Hello World” on the platform.

Next step: Part 1: Deploy a simple pipeline