Skip to main content

Install Python agent in a pipeline

Using the Agent Wizard is the simplest way to deploy a new agent by selecting Language-specific > Python > Install in a pipeline.

Select the installation method

Under Select method to deploy with pipelines, select GitHub or Bitbucket.

Configure the agent

Configure the Python agent.

A connection token is the recommended method. Set CONTRAST__API__TOKEN in the environment where you run your application.

Install the agent

  1. Install the agent as a dependency using your preferred package manager. The following example uses pip:

    • For GitHub:

      - name: Install Agent
        shell: bash
        run: pip install contrast-agent
    • For Bitbucket:

      - step:
        script:
          - pip install contrast-agent
  2. Add the following to the step running your application:

    • For GitHub:

        - name: Run with Contrast
             shell: bash
             env: env:
               CONTRAST__API__TOKEN: ${{ secrets.ContrastAPIToken }}
               CONTRAST__APPLICATION__NAME: ${{ secrets.ContrastApplicationName }}
               CONTRAST__APPLICATION__METADATA: ${{ secrets.ContrastApplicationMetadata }}
             run: contrast-python-run -- [original application startup command]
    • For Bitbucket:

      - contrast-python-run -- [original application startup command]

Verify the agent deployment

Interact with your application as you normally would. For example, interact with your application's web interface or send API commands.

  1. In the Agent Wizard, select View agent activity to verify that your agent appears in the agents list.

  2. Verify that you see the name of your application in the applications list.

    • In Northstar, select Applications from the left navigation.

    • In Contrast, select Applications from the header.

  3. Verify that you see the name of your local server in the servers list.

    • In Northstar, select Servers from the left navigation.

    • In Contrast, select Servers from the header.