← The Protocol Lab — all BIOVIA Pipeline Pilot guides

Custom Components & Subprotocols

Extending Pipeline Pilot when the built-in library runs out.

The built-in component library covers roughly 80% of what you need in production. The other 20% — bespoke business logic, specialized API integrations, complex algorithms, company-specific calculations — that is where custom components come in. I have built Python custom components at Pfizer, and packaging them correctly as platform capabilities is what separates a one-off script from something the whole team can depend on.

Two ways to extend Pipeline Pilot

Before writing a single line of code, pick the right extension mechanism for your need:

  • Subprotocol — a protocol embedded inside another protocol. No custom code required — you compose existing components into a named, reusable block with its own configurable properties. Best when the logic can be expressed with existing components.
  • Custom Component (Python) — a real code artifact registered with the server that appears in the component library exactly like any built-in component. Best for algorithms, external API calls, complex transforms, or any operation that no built-in component handles.
  • Decision rule: if you can build it cleanly with 10 or fewer connected components, make it a subprotocol. If you are stacking 20+ components to do what 30 lines of Python would express clearly, write a custom component.

Creating a subprotocol — step by step

  1. Build and test the component chain you want to reuse as a standalone protocol first. Make sure it runs correctly with representative data before packaging it.
  2. Select all the components that should live inside the subprotocol (drag-select or Ctrl+click each one), then right-click → Create Subprotocol.
  3. Pipeline Pilot wraps your selection in a new subprotocol component. A dialog appears — give it a meaningful name, description and category.
  4. Open the subprotocol (double-click it on the canvas) and identify which internal properties should be configurable from outside. Right-click each one → Promote to External Property.
  5. Save the subprotocol. It now appears in the component library under your chosen category and can be dragged into any protocol across the server.
  6. When you update and save the subprotocol, every protocol that uses it picks up the change on their next run — this is the maintenance win that makes subprotocols worth the packaging effort.

Python custom components — structure

Python custom components are the most flexible type. They bring any Python library — pandas, numpy, requests, boto3, cx_Oracle — into a first-class Pipeline Pilot component:

# Pipeline Pilot Python Custom Component
# Each method below is called by the Pipeline Pilot runtime

def Initialize(self, cxt):
    """Called ONCE when the protocol starts. Use for setup, caching."""
    self.threshold = float(self.GetPropValue("GlobalThreshold") or "50.0")
    self._cache = {}

def Execute(self, cxt):
    """Called ONCE PER RECORD flowing through this component.
       Return True  → pass the record to the next component.
       Return False → filter this record out (it goes nowhere)."""

    # Read input properties from the current record
    raw_value  = self.GetPropValue("InputValue")
    multiplier = float(self.GetPropValue("Multiplier") or "1.0")

    # Guard: filter out nulls rather than crashing
    if raw_value is None:
        return False

    # Your custom logic — any Python you need
    result = float(raw_value) * multiplier
    status = "HIGH" if result > self.threshold else "NORMAL"

    # Write computed values back to the record
    self.SetPropValue("OutputValue", result)
    self.SetPropValue("StatusFlag", status)

    return True  # pass this record downstream

def Finalize(self, cxt):
    """Called ONCE when all records are processed. Use for cleanup."""
    pass

Real-world example — enriching records via REST API

Here is a pattern I use to enrich records with data from an internal REST service — something no built-in component handles:

import requests

# Module-level cache avoids repeated API calls for the same key
_status_cache = {}

def Execute(self, cxt):
    batch_id = self.GetPropValue("BatchID")
    api_url  = self.GetPropValue("APIURL")
    token    = self.GetPropValue("BearerToken")

    # Serve from cache when possible
    if batch_id in _status_cache:
        self.SetPropValue("APIStatus", _status_cache[batch_id])
        return True

    try:
        resp = requests.get(
            f"{api_url}/batches/{batch_id}",
            headers={"Authorization": f"Bearer {token}"},
            timeout=10
        )
        resp.raise_for_status()
        status = resp.json().get("status", "UNKNOWN")
        _status_cache[batch_id] = status

    except Exception as exc:
        # Log but do not crash — flag the record and continue
        self.SetPropValue("APIError", str(exc))
        status = "ERROR"

    self.SetPropValue("APIStatus", status)
    return True

Packaging and documenting custom components

A custom component only you can use is a personal script, not a platform capability. What makes it genuinely reusable:

  • Fill in the Description, Properties tooltip and Hint fields completely. Include what the component does, what each property means, expected input format and output format. Future colleagues will not ask you to explain it if the documentation is already there.
  • Group related components into a named Collection (File → Manage Collections). All company-specific components go into one shared collection the team manages together.
  • Version the Python source files in Git alongside your application code. Tag releases that match what is deployed on production vs. development servers.
  • Write a test protocol that exercises every code path — including null input, empty strings, API timeouts and invalid values. Run it after every Pipeline Pilot Server upgrade.

Tip: Register your component on the development server first, test it thoroughly, then promote to production through the same change-control process you use for protocols. A broken custom component can take down every protocol that uses it — treat it with the same care as a database stored procedure.