Skip to main content
Opus Code lets you write Python code directly in your workflow. Use it when you need custom logic or data transformations that other tasks can’t handle. Your code runs in a secure environment with access to data from earlier steps in your workflow.

Key Capabilities

Python 3.13

Write and run Python code in a secure environment.

Use Workflow Data

Read data from earlier steps and pass results to later steps.

Custom Logic

Do calculations, transformations, validations—anything you can code.

Call APIs

Connect to services not supported by integrations or External Service.

When to Use It

Use Opus Code when you need to do something that other tasks can’t handle. Common examples:
  • Transform data into a different format
  • Calculate values or run business logic
  • Clean up messy data before using it
  • Call an API that isn’t supported by the Integration Marketplace or External Service task
  • Validate that data matches what you expect
Keep your code simple and focused. If you need to do multiple things, use multiple Opus Code tasks instead of a big one—it’s easier to debug.

Reading and Writing Data

Your code can read data from earlier steps and pass results to later steps using a special syntax:
# Read an input variable
my_value = {{ input_variable_name }}

# Write to an output variable
{{ output_variable_name }} = my_value
Input variables are read-only—you can read them but not change them. Output variables send data out from your code to later steps.

Supported Packages

Opus Code comes with these Python packages pre-installed:
CategoryPackages
Datajson, csv, collections, dataclasses, enum, copy
Textre, string, html
Mathmath, statistics, random, decimal, fractions
Timedatetime, time, python-dateutil
Utilitiesitertools, functools, operator, typing, uuid
Encodinghashlib, base64
Advancedabc, warnings, contextlib, concurrent, concurrent.futures
PDFPyPDF2, pdfplumber, pymupdf, reportlab, fpdf2, pdf2docx, pdf2image
Imagespillow, opencv-python-headless
Otherpython-magic, toon-format, opus_code_sdk

How to Add Opus Code

1

Drop it into your workflow

Drag an Opus Code task into your workflow.
2

Set up your inputs

Add input variables and connect them to data from earlier steps.
3

Write your code

Write your Python code in the editor. Read inputs and assign values to outputs.
4

Set up your outputs

Add output variables that later steps can use.
5

Test it

Run a preview to make sure your code works with real data.

Tips for Better Results

One task, one job:
  • Do one focused thing per Opus Code task
  • Use multiple small tasks instead of one big one
  • Easier to debug when something goes wrong
Validate data at the start of your code:
  • Make sure required fields exist
  • Check that data is the type you expect
  • Handle empty or missing data gracefully
Plan for things going wrong:
  • Use try/except to catch errors
  • Set an error output so later steps know something failed
  • Write clear error messages
Before activating your workflow:
  • Run preview with realistic test data
  • Check that outputs look correct
  • Try edge cases to make sure your code handles them