What you’ll build
In this guide, we’ll create an npm package with a post-call follow-up workflow, mark it as discoverable by Output, publish it, then install and call it from another project.Package requirements
An external workflow package should:- Follow the standard Output file conventions:
workflow.js,steps.js,evaluators.js,shared/steps/*.js,shared/evaluators/*.js, and so on. - Export workflows from the package entry point using static ESM re-exports.
- Set
outputai.workflows.exposetotrueinpackage.json. - Publish JavaScript files. If the package is authored in TypeScript, build
.jsfiles and matching.d.tsfiles before publishing. - Declare
@outputai/coreas a peer dependency. If your declaration files importzod, declarezodtoo.
Step 1: Create the workflow package
Create a package with the same shape as a regular Output project:src/workflows/post_call_followup/workflow.ts
src/workflows/post_call_followup/steps.ts
shared/steps or shared/evaluators when more than one workflow in the package can use them:
src/shared/steps/normalize_transcript.ts
Step 2: Export the workflow
Export workflows from the package entry point with static ESM re-exports:src/index.ts
Step 3: Mark the package as exposing workflows
Addoutputai.workflows.expose to package.json:
package.json
Step 4: Build and publish
If the package is written directly in JavaScript, make sure the published files are included in npm. If the package is written in TypeScript, compile it before publishing:.js files. .d.ts files are strongly recommended so consumer projects get correct types.
Step 5: Install the package
In the project that will call the external workflow:node_modules.
Step 6: Call the workflow directly through the API
When the worker starts, it discovers exposed workflow packages, registers their workflows, and loads package-level shared activities. You can call an external workflow by itsname without writing a local wrapper workflow.
For example, the package above registers acmePostCallFollowup:
Step 7: Call from another workflow
You can also import an external workflow and call it from local workflow code. Use this when the packaged workflow is one part of a larger local orchestration. Import the workflow from the npm package and call it inside your local workflow:src/workflows/customer_call_review/workflow.ts
Caveats
Workflow names must be unique
External workflow names share the same catalog as local workflow names. If two workflows use the samename, they collide.
Choose stable, package-specific workflow names when publishing reusable workflows:
Shared activity names can collide
Package-level shared steps and evaluators are registered in the same shared namespace as local shared activities. If two shared activities use the samename, the later registration can overwrite the earlier one.
Use descriptive shared activity names for published packages:
Only exposed packages are auto-discovered
The worker only scans packages with:Use static ESM re-exports
The worker resolves external workflow imports by statically following package entry point exports until it reachesworkflow.js files. Use explicit ESM re-exports with relative paths:
Keep workflow package code workflow-safe
Workflow code runs in Temporal’s workflow runtime. Avoid importing Node-only APIs or non-deterministic code from workflow files. If a package needs a workflow-safe entry point, it can provide anoutput-workflow-bundle export condition so the worker bundle resolves the safe version.
Next steps
After installing an external workflow package:- Start the worker and verify the external workflows appear in the catalog.
- Trigger a local workflow that calls the external workflow.
- Check traces to confirm the external workflow runs as a child workflow.