Writing custom Shuffle apps in Python

Python apps let you build Shuffle integrations that need custom logic, multi-step calls or libraries the App Creator cannot express. This page covers the directory layout, SDK helpers, dependencies and how the app becomes a versioned container.

On this page

When a Python app is the right way to extend Shuffle

When Shuffle's catalog has no app for an internal or niche system, the first decision is whether to build it in the App Creator or write it in Python. Shuffle apps run as versioned Docker containers, and both routes end in the same place: an app with actions that workflows can call. The difference is how the app is authored. The App Creator builds apps from an OpenAPI specification, which suits a REST API with clear endpoints, parameters and authentication. Python, using the Shuffle app SDK, is the route when the work goes beyond calling endpoints, such as parsing non-standard responses, running local logic, handling several calls in sequence, or working with a system that does not describe itself in OpenAPI.

Choose Python when the integration needs code that an OpenAPI definition cannot express. Before writing anything, check three things with your team: whether the target system publishes a usable OpenAPI or Swagger file, how much custom logic each action needs, and who will maintain the app after it ships. A Python app adds a Dockerfile, a dependency list and an app.py entry point that your team must version, build and patch, so the recurring cost of ownership is higher than a generated app. Confirm with the Shuffle release you run which SDK version and base image your build uses, since the docs describe the Python route without pinning these details in the sections we reviewed. Check the current app development guidance in the Shuffle apps documentation before you commit to the layout.

Choosing Python over the App Creator

The App Creator turns a plain REST API into a Shuffle app quickly, but some integrations need logic it cannot express. The cards below describe the situations that favor a Python app, the ones where the App Creator is still the better fit, and what to check before you commit to either.

Custom logic between calls

Many integrations need to act on one response before making the next request, such as choosing an endpoint based on a field, merging results from two calls or retrying with a different parameter set. The App Creator maps each action to a single HTTP operation, so this branching has to live in a workflow or in code. If the branching is part of the vendor's own protocol, put it in a Python action where it can be tested in isolation. Check how many decisions sit between the first and last call before you choose.

Pagination and polling

Vendor APIs often return results in pages, with cursors, offsets or link headers, and some report job status that must be polled until completion. A Python action can loop through pages, respect rate limits and stop on a defined condition, returning one consolidated result to the playbook. Ask whether the vendor's pagination model is documented and whether it changes between API versions, because that affects how much code you maintain.

Non-HTTP work

Some integrations do not talk to a web API at all. They may query a database over a driver, parse a file format, run a local command in the worker, or read from a message queue. The App Creator is built around OpenAPI definitions, so these cases need Python. Confirm which network paths and client libraries the app container will need, because a database driver or certificate bundle changes the image you build and how you test it.

Dependencies beyond the HTTP layer

Integrations that depend on signing libraries, XML parsers, cryptographic helpers or vendor SDKs need packages that the generated App Creator app does not include. Python lets you declare those dependencies and pin their versions in the app's requirements. Each added package widens the container image and its vulnerability surface, so record why each dependency is there and plan to scan the image as part of its release.

Reuse of internal libraries

Security teams often already maintain internal Python libraries for ticketing, asset lookup or enrichment that other tools use. Wrapping those libraries in a Shuffle app avoids copying logic into a second codebase that drifts over time. Decide who owns the library, how its version is pinned in the app, and whether it needs credentials handled through Shuffle's stored authentication rather than values hard-coded in source.

When the App Creator still fits

A plain REST API with standard authentication, such as an API key header or a bearer token, and a stable OpenAPI description is usually faster to build and maintain with the App Creator. It needs less code to review and fewer dependencies to pin. Before choosing Python, check whether every action you need is a single documented request. If most actions are, start with the App Creator and move only the exceptions into Python code.

Shuffle apps docs

How a Python app runs inside a workflow

The path starts when a workflow execution reaches a Python app action in the Shuffle backend, which queues a job on the Go backend API. Orborus polls that queue, starts a worker for the execution, and the worker launches the app's versioned container, which runs app.py with its dependencies. Credentials are read from the OpenSearch store, where they are encrypted with AES-256 using SHUFFLE_ENCRYPTION_MODIFIER. Check that Orborus can reach the backend, that the app image is present on the runtime host, and that the encryption modifier has not changed.

Hand-offs from a workflow action to the Python app container.

Laying out the app directory with api.yaml and app.py

A Python app for Shuffle is a directory with two files that do different jobs: api.yaml declares what the app is and what it can do, and app.py contains the code that does the work. Keep that split in mind when you lay out the directory, because Shuffle reads the definition to build the actions a workflow editor shows, while the Python file only runs when an action is executed. The definition file is the contract between the app and every workflow that uses it, so changes to action names, parameters or authentication fields affect existing playbooks even when the code looks correct.

In api.yaml, each action is described with a name, the parameters it accepts and the authentication fields the app needs, such as a base URL, a token or an API key. Each action name in the definition must match a Python function in app.py, and the parameter names must match the arguments that function receives. A mismatch usually shows up as a failed execution rather than a validation error at save time, so write a small test run for every action after you edit either file. Confirm the exact key names, required top-level fields, the expected name of the app file and any folder conventions against the apps documentation before you build the directory structure for your team's standard template.

Treat the directory as a versioned artifact from the first commit. Record the app version in the definition, keep the two files in the same repository, and avoid editing one without reviewing the other. Ask your team to decide early who owns the definition and the code, how authentication fields will change when a vendor rotates its API, and whether actions will be split across several apps. These decisions are cheaper to make before the first workflow depends on the app than after several playbooks have been built on its current action names.

Using the Shuffle SDK helpers in app code

Most app actions take input from a workflow, build an HTTP call to a vendor API, and turn the reply into something a playbook can use. The request and response helpers in the SDK are meant to keep that path consistent across actions, so the HTTP details live in one place instead of being copied into every function. Keep the parsing of vendor replies close to the call that produced them, so a change in the vendor's response format shows up in one spot.

  • Building the request: Use the SDK's request helper for outbound calls rather than hand-rolled connection code, so timeouts and error paths behave the same way across actions.
  • Setting timeouts explicitly: Set a timeout on every outbound call. A workflow waiting on a hung vendor endpoint is harder to recover than one that fails quickly.
  • Handling pagination: Vendor APIs often return results in pages. Loop until the cursor or page marker ends, and cap the total so one action cannot run indefinitely.
  • Parsing replies safely: Check the status code and content type before parsing JSON, and keep the raw body available in logs for troubleshooting.
  • Keeping transport out of business logic: Put the vendor-specific mapping in small functions that take plain Python data, which makes them easy to unit test without a live endpoint.

Before relying on any helper, confirm its name, arguments and return type in the current SDK, since these change between releases.

Building, testing and versioning the app container

This sequence takes a Python app from an empty directory to a versioned container image that workflows can call. Each step ends with a check, so a failure is caught at the stage where it was introduced rather than in a production playbook.

  1. Scaffold the app directory

    Create the app folder with the files the Shuffle runtime expects: an api.yaml that describes the app, an app.py that holds the action code, and a Dockerfile for the container build. Keep the folder name, app name and version in step with each other, because the version you set here is the one workflows will later reference. Done means the folder has all three files and the api.yaml parses as valid YAML, which a plain YAML linter can confirm before any Shuffle component is involved.

  2. Define actions in api.yaml

    List each action the app exposes in api.yaml, with its name, description, parameters, whether each parameter is required, and the expected output shape. Define authentication fields here if the target system needs them, and keep sensitive values as parameters that Shuffle stores encrypted rather than hard-coded values in the file. Done means every action you plan to call from a workflow appears once, with unique names and parameter types that match what app.py will read.

  3. Implement actions in app.py

    Write one Python function per action in app.py, using the Shuffle SDK helpers for the common tasks such as reading the app's authentication and returning results in the standard format. Keep each function to one external call and one clear return value so that workflow branches stay simple. Done means each function runs locally against a test instance or a mocked response, and each returns the structure described in api.yaml without raising errors on the happy path.

  4. Declare dependencies

    List every third-party Python package the app imports in the requirements file, and pin versions so the image built next month behaves like the one you tested today. Avoid importing packages that are not declared, because the container will fail at runtime even when the code looks correct on a developer workstation. Done means a clean virtual environment installs from the requirements file alone and the app module imports without errors.

  5. Build the image with a version tag

    Build the container image from the Dockerfile and tag it with the app version, not only with latest, so each build can be traced to the code that produced it. Push the image to the registry your Shuffle runtime pulls from, and record the image digest alongside the tag. Done means the runtime can pull that exact tag and start the container, which you confirm by checking the app appears in the Shuffle app list after it is loaded. Confirm with your team how the image reaches the runtime in your environment, since that path varies by deployment.

  6. Run a test workflow against the app

    Build a small test workflow that calls each action once with known inputs, using a test credential rather than a production one. Run it and compare the output to the expected result you wrote down before the run. Done means every action returns the expected fields and values, and any execution error is traced to either app.py or the workflow mapping before anything moves forward. A check that only confirms the workflow finished is not enough, because a finished run can still contain wrong data.

  7. Record the version used by workflows

    Write down which app version and image tag each production workflow is set to use, and keep that record in the team's change log or source control alongside the app code. When you publish a new version, update workflows deliberately and note the change, so a later failure can be traced to a specific version rather than to a silent update. Done means every workflow that calls the app names a version you can find in your records, and a reviewer can answer which code ran in a given execution without asking the author.

Dependency and packaging options and when each fits

This table compares four ways a custom Python Shuffle app can get its libraries: standard library only, pinned third-party packages, vendored internal libraries and a shared base image. Read each row as a choice you make once per app, then check the trade-off column against your patching and image scanning process before you pick one.

OptionWhen it fitsTrade-off for maintenance and security scanning
Standard library onlyThe app calls a simple HTTP or JSON API and the standard library covers TLS, parsing and retries without extra codeSmallest image and fewest dependencies to scan, but you write and maintain any helper logic the vendor SDK would have provided
Pinned third-party packagesThe target API needs a maintained client, such as a well-known HTTP or auth library, and you want reproducible buildsEvery pinned package adds CVE exposure to track; pins must be updated deliberately and re-scanned on each image build
Vendored internal librariesSeveral in-house apps share the same parsing, logging or auth helper and you need that code frozen with each app versionCopies drift apart over time, and a fix must be applied to every vendored copy, so the scan result covers code your team owns
Shared base imageMany custom apps need the same runtime, certificates and corporate CA trust, and your platform team controls the baseOne base image update reaches all apps, but a flaw in the base affects every app, and the base needs its own owner and rebuild schedule
Confirm before you chooseThe Shuffle SDK and the base image your Shuffle version uses are the starting point for any dependency setAsk the Shuffle version you run which SDK and Python runtime it expects, and test the app container against that version before promotion

Protecting credentials and the app runtime

A custom Python app touches credentials, runs as a container and calls external APIs, so each of those is a place to lose control. The cards below cover how Shuffle protects saved credentials, how to keep secrets out of code and images, how to limit what the container can do and reach, and how to check the image before it is promoted.

Encrypted credentials in OpenSearch

Shuffle encrypts saved app credentials and API keys in OpenSearch with AES-256, using the key material set by SHUFFLE_ENCRYPTION_MODIFIER. Your app code never needs to read or store those values in plain form, because authentication is configured once in Shuffle and reused by workflows. Before go-live, confirm where the OpenSearch data directory and its backups live, and who can read them.

Configuration docs

Protect the encryption modifier

Changing SHUFFLE_ENCRYPTION_MODIFIER breaks every saved app authentication. The docs warn that losing or altering the value makes stored credentials unreadable, so each workflow using them starts failing. Store the value in your secrets manager, back it up with a documented owner, and treat any change as a planned migration with a rollback path. Test a restore of a backup in a staging instance before relying on it.

Keep secrets out of code and images

Hardcoded API keys in app.py, api.yaml or a Dockerfile end up in version control, image layers and registry caches, where they are hard to revoke. Pass runtime configuration through Shuffle's authentication settings and environment injection at deploy time instead. Scan the repository and the built image for committed secrets, and ask the owner of each external API how keys are rotated.

Least privilege for the container

An app container should run as a non-root user with no privileged flags, a read-only filesystem where practical and only the capabilities it needs. Shuffle starts app containers through the runtime, so the host's Docker socket access and the Orborus node's permissions decide how much an app can reach. Review these settings with your platform team, and confirm the policy in the deployment guide for your architecture.

Restrict network egress

A custom app usually needs to reach one API host, so outbound traffic should be limited to that destination and nothing else. Without egress rules, a compromised dependency or a malicious workflow input can call arbitrary internal services or exfiltrate data. Document the allowed hosts and ports per app, enforce them at the network layer, and retest after any change to the vendor's endpoints.

Scan images before promotion

Each version of the app becomes a container image, so the image carries the Python interpreter, the pinned dependencies and the base operating system packages. Run vulnerability and secret scanning on every build, and block promotion when a finding exceeds the threshold your security team sets. Keep the scan results with the version tag so an auditor can see what was checked before a given version ran.

Questions teams ask before writing Python apps

What drives the cost of a custom Shuffle Python app?

The main drivers are how many actions the app needs, how complex each action is, which authentication scheme the upstream API uses, how deep the testing goes, and how much upkeep the app will need later. A read-only app with three actions and an API key is a very different job from a multi-step app with OAuth2, pagination, file handling and error mapping. Cost is mostly people time, so the one-time build and the recurring maintenance should be quoted separately. Ask any partner to break the quote into scoping, build, testing, documentation and handover, and to state what happens when the upstream API changes after handover.

How long does a Python app take to build?

Duration follows scope, and no fixed figure applies to every app. The work moves faster when the API documentation is complete, a sandbox is available and the team can answer questions quickly, and slows when endpoints are undocumented, authentication behaves unexpectedly or test data is hard to get. Ask for a timeline tied to a written list of actions, the authentication method and the test environment, along with the assumptions behind each phase. Any timeline that does not name these inputs is hard to check.

Can our internal team write the app without outside help?

Yes, if an engineer already comfortable with Python and REST APIs has time to learn the app directory layout, the api.yaml definition, the app.py structure and the Shuffle SDK helpers. The harder parts are usually not syntax but handling credentials safely, mapping vendor errors into useful workflow output and building repeatable tests. Teams that lack a second reviewer, or that need the app to meet internal change control, often bring in a partner for the first build and then take over maintenance. Decide this before the build starts, not after the first release.

What does our team need to provide for the build?

Plan to provide the upstream API documentation or specification, sandbox or test tenant access, test credentials with the least privilege that will work, and a named owner who can approve scope and accept the app. Also provide the list of workflows that will call the app, because those define the actions and output shape that matter. Confirm with the vendor whether a sandbox exists and what it returns, since testing against production data carries its own risk. Missing any of these items usually turns into waiting time during the build.

Who owns the app after it goes live?

Your organization should own the code, the container image and the version history, and name a maintainer who can respond when the upstream API changes or a dependency needs updating. Ongoing work includes dependency updates, image rebuilds, retesting against the vendor, and reviewing changes to the API. Ask a partner to document who does each of these tasks and whether maintenance is included in the build quote or offered separately as a retainer. Without a named owner, a working app can drift out of date quietly.

How does an upstream API change affect a custom app?

A vendor change such as a renamed field, a deprecated endpoint or a new authentication requirement can break actions that previously worked, and the break often shows up first in a live workflow. Plan for regular review of the vendor's changelog, automated tests that run the actions against a sandbox, and a procedure for shipping a new app version without disrupting running workflows. Ask how much ongoing testing is included and how often the app is checked against the vendor's current API.

What security risks should we review before building a Python app?

Review how the app stores and passes credentials, because Shuffle encrypts saved app authentications in OpenSearch with a secret that must be protected and never lost, and a mishandled credential in code or logs is a real exposure. Also review what the app can do with the permissions it holds, which dependencies it pulls in, and whether the container image is scanned before promotion. Confirm with your security team which of these checks they require and who signs off on the app before it reaches production workflows.

What a fixed-scope Python app engagement covers

A DeployOpen engagement for a custom Python app starts with a written scope, and the deliverables and timelines are agreed in writing before any work begins. For a Python app for Shuffle, that scope usually lists each action the app exposes, the inputs and outputs each action returns, and the authentication model the app uses against the target system. It also names the api.yaml and app.py files, the dependencies in the app's requirements, the test workflows that exercise each action, and the container build that produces a versioned image. The last item is the handoff: either the image is loaded into your self-hosted Shuffle through the hot-load process, or it is pushed to a registry your Shuffle instance pulls from. Confirm which path your environment uses before the scope is signed, because it changes what the handoff includes.

The quote follows from that written scope, so the reader should compare quotes on the same list of actions, the same authentication handling and the same handoff method. Ask each provider to state which items are one-time build work and which recur, such as rebuilding the image after a dependency update or revalidating actions when the target API changes. Ask who owns the source code and the image registry credentials at handover, and whether secrets used during testing are removed from the test environment. Ask how the provider handles changes that appear mid-build, including the process for adding an action or altering an authentication scheme. Those answers reveal more about the true cost than the headline figure.

Ongoing maintenance is available as a retainer, which covers work such as updating the app when the target API changes, rebuilding images for dependency and base image updates, and retesting actions after a Shuffle upgrade. Your own team should decide early which of these tasks it will keep in-house and which it will hand to a retainer, because that split determines how much knowledge must transfer at the end of the build. Confirm with the provider how the retainer is scoped and how urgent fixes are requested, and confirm the Shuffle version your environment runs against the current release notes before the scope is fixed.

How DeployOpen delivers custom Shuffle apps

This sequence takes a Python integration from an agreed scope to a tested, versioned container that your team can run, review and maintain on the Shuffle version you operate. Each step ends with a named output so you can check progress before the next one starts.

  1. Scope the integration and auth model

    DeployOpen and your team agree which target system the app will call, which actions it must expose, what data moves in each direction, and which authentication method the vendor supports, such as API key, bearer token or OAuth2. We also confirm the Shuffle version and deployment type you run, since the app must match that runtime. The step closes with a written scope listing actions, inputs, outputs, and the credential model, approved by your team before any code is written.

  2. Confirm the Shuffle runtime and app layout

    We check whether a Python app is the right choice compared with the App Creator for this target API, and document the reason in the scope. We then set up the app directory with api.yaml describing the actions and app.py implementing them, using the Shuffle SDK helpers where they fit. The output is a repository skeleton that a Shuffle instance on your stated version can load, with the dependency list pinned in the project.

  3. Build the actions against the target system

    Engineers implement each action in app.py, handle vendor error responses, and keep return values in a consistent structure so downstream workflow steps can rely on them. Third-party Python dependencies are kept to the minimum the integration needs. The step closes when every action in the agreed scope has code and a unit-level check against the vendor's sandbox or test tenant, with results recorded in the repository.

  4. Test the app on your Shuffle version

    We load the app into a non-production Shuffle instance running the version you operate, then execute each action through test workflows. Checks cover successful responses, failed authentication, rate limits, and malformed input, and we confirm that results appear in the format the workflows expect. The output is a test record showing each action, the input used, the observed result and any defects fixed before handover.

  5. Review credential handling and dependencies

    Security engineers review how the app receives secrets, confirming that credentials are stored through Shuffle's authentication mechanism, which encrypts saved app credentials in OpenSearch, and never written into source, logs or workflow text. They also review each Python dependency for known vulnerabilities, license terms and maintenance status, and check that the container does not run with more privilege than the app needs. The step closes with a findings list and fixes agreed with your team.

  6. Package the versioned container and document it

    The app is built as a versioned Docker container with a fixed tag, so you can roll back a release and know exactly which code runs in production. We write operator documentation covering the app's actions, required authentication setup, the encryption key dependency, upgrade steps and known limits. The output is the image, the source repository, a release note and the documentation, handed over in writing with the version identifiers recorded.

  7. Hand over and agree support options

    Your team receives the handover package and a walkthrough of how to load the app, add its authentication and run its test workflows on your instance. You decide whether to maintain the app internally or add a retainer for ongoing support, upgrades when Shuffle or the target API changes, and continued testing. The quote for any support work follows from a written scope, and the handover closes once your team confirms it can operate the app without DeployOpen.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.