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:Supported Packages
Opus Code comes with these Python packages pre-installed:| Category | Packages |
|---|---|
| Data | json, csv, collections, dataclasses, enum, copy |
| Text | re, string, html |
| Math | math, statistics, random, decimal, fractions |
| Time | datetime, time, python-dateutil |
| Utilities | itertools, functools, operator, typing, uuid |
| Encoding | hashlib, base64 |
| Advanced | abc, warnings, contextlib, concurrent, concurrent.futures |
| PyPDF2, pdfplumber, pymupdf, reportlab, fpdf2, pdf2docx, pdf2image | |
| Images | pillow, opencv-python-headless |
| Other | python-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
Keep it simple
Keep it simple
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
Check your inputs first
Check your inputs first
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
Handle errors
Handle errors
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
Test with preview
Test with preview
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