Skip to content

Commit f81fa47

Browse files
committed
Add OSOP workflow example — background job pipeline in portable format
1 parent 0e14b6d commit f81fa47

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed

examples/osop/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# OSOP Workflow Example — Trigger.dev Background Job Pipeline
2+
3+
This directory contains a portable workflow definition for a **background job pipeline** pattern, written in [OSOP](https://github.com/osop-org/osop-spec) format.
4+
5+
## What is OSOP?
6+
7+
**OSOP** (Open Standard for Orchestration Protocols) is a YAML-based workflow standard that describes multi-step processes — including background jobs, event-driven pipelines, and AI agent workflows — in a portable, tool-agnostic format. Think of it as "OpenAPI for workflows."
8+
9+
- Any tool can read and render an `.osop` file
10+
- Workflows become shareable, diffable, and version-controllable
11+
- No vendor lock-in: the same workflow runs across different orchestration engines
12+
13+
## Files
14+
15+
| File | Description |
16+
|------|-------------|
17+
| `background-job-pipeline.osop` | Long-running background job: receive request, validate, AI processing with retry, store results, webhook callback, and cleanup |
18+
19+
## How to use
20+
21+
You can read the `.osop` file as plain YAML. To validate or visualize it:
22+
23+
```bash
24+
# Validate the workflow
25+
pip install osop
26+
osop validate background-job-pipeline.osop
27+
28+
# Generate a visual report
29+
npx osop-report background-job-pipeline.osop -o report.html
30+
```
31+
32+
## Learn more
33+
34+
- [OSOP Spec](https://github.com/osop-org/osop-spec) — Full specification
35+
- [OSOP Examples](https://github.com/osop-org/osop-examples) — 30+ workflow templates
36+
- [Trigger.dev Documentation](https://trigger.dev/docs) — Trigger.dev platform docs
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
osop_version: "1.0"
2+
id: triggerdev-background-jobs
3+
name: Trigger.dev Background Job Pipeline
4+
description: Long-running background job with progress tracking, retry logic, and webhook callbacks.
5+
tags: [trigger-dev, background-jobs, queue, serverless]
6+
7+
nodes:
8+
- id: receive-job
9+
type: api
10+
name: Receive Job Request
11+
description: Accept job submission via API or event trigger.
12+
13+
- id: validate-input
14+
type: system
15+
name: Validate Input
16+
description: Check job parameters and required permissions.
17+
18+
- id: process-ai
19+
type: agent
20+
name: AI Processing
21+
description: Run the main AI processing task (e.g., document analysis, code generation).
22+
runtime:
23+
provider: openai
24+
model: gpt-4o
25+
timeout_sec: 300
26+
27+
- id: store-result
28+
type: db
29+
name: Store Result
30+
description: Save the processing output to the database.
31+
32+
- id: webhook-callback
33+
type: api
34+
name: Webhook Callback
35+
description: Notify the caller that the job is complete via webhook.
36+
37+
- id: cleanup
38+
type: system
39+
name: Cleanup
40+
description: Remove temporary files and release resources.
41+
42+
edges:
43+
- from: receive-job
44+
to: validate-input
45+
mode: sequential
46+
- from: validate-input
47+
to: process-ai
48+
mode: sequential
49+
- from: process-ai
50+
to: store-result
51+
mode: sequential
52+
- from: store-result
53+
to: webhook-callback
54+
mode: sequential
55+
- from: webhook-callback
56+
to: cleanup
57+
mode: sequential
58+
- from: process-ai
59+
to: receive-job
60+
mode: fallback
61+
label: Retry on failure

0 commit comments

Comments
 (0)