-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworkflow.json
More file actions
141 lines (141 loc) · 4.21 KB
/
Copy pathworkflow.json
File metadata and controls
141 lines (141 loc) · 4.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
{
"name": "sync-drift-detection",
"description": "Fetch two data sources in parallel, compare hashes for drift, triage via reasoning, and sync if approved.",
"category": "data",
"features": ["parallel", "http", "crypto", "condition", "reasoning"],
"input_schema": {
"type": "object",
"required": ["source_a_url", "source_b_url", "sync_url"],
"properties": {
"source_a_url": {
"type": "string",
"description": "URL for primary data source"
},
"source_b_url": {
"type": "string",
"description": "URL for secondary data source"
},
"sync_url": {
"type": "string",
"description": "URL to POST sync/load data to"
}
}
},
"definition": {
"timeout": "5m",
"on_timeout": "fail",
"steps": [
{
"id": "fetch-a",
"type": "action",
"action": "http.get",
"params": {
"url": "${{inputs.source_a_url}}"
},
"timeout": "30s",
"retry": {
"max": 2,
"backoff": "exponential",
"delay": "1s"
}
},
{
"id": "fetch-b",
"type": "action",
"action": "http.get",
"params": {
"url": "${{inputs.source_b_url}}"
},
"timeout": "30s",
"retry": {
"max": 2,
"backoff": "exponential",
"delay": "1s"
}
},
{
"id": "hash-a",
"type": "action",
"action": "crypto.hash",
"depends_on": ["fetch-a"],
"params": {
"algorithm": "sha256",
"data": "${{steps.fetch-a.output.content_type}}"
}
},
{
"id": "hash-b",
"type": "action",
"action": "crypto.hash",
"depends_on": ["fetch-b"],
"params": {
"algorithm": "sha256",
"data": "${{steps.fetch-b.output.content_type}}"
}
},
{
"id": "check-drift",
"type": "condition",
"depends_on": ["hash-a", "hash-b"],
"config": {
"expression": "steps['hash-a'].hash != steps['hash-b'].hash",
"branches": {
"true": [
{
"id": "triage-drift",
"type": "reasoning",
"config": {
"prompt_context": "Drift has been detected between the two data sources. Review the changes and decide whether to approve an automatic sync or investigate manually.",
"options": [
{ "id": "sync", "description": "Approve automatic sync to reconcile drift" },
{ "id": "investigate", "description": "Hold sync, investigate differences manually" }
],
"data_inject": {
"hash_a": "steps['hash-a'].hash",
"hash_b": "steps['hash-b'].hash",
"source_a": "inputs.source_a_url",
"source_b": "inputs.source_b_url"
},
"timeout": "1h",
"fallback": "investigate"
}
},
{
"id": "sync-data",
"type": "action",
"action": "http.post",
"depends_on": ["triage-drift"],
"condition": "steps['check-drift.true.triage-drift'].choice == 'sync'",
"params": {
"url": "${{inputs.sync_url}}",
"body": {
"action": "sync",
"source": "${{inputs.source_a_url}}",
"hash_a": "${{steps.hash-a.output.hash}}",
"hash_b": "${{steps.hash-b.output.hash}}"
}
},
"timeout": "30s",
"retry": {
"max": 2,
"backoff": "exponential",
"delay": "2s"
}
}
],
"false": [
{
"id": "log-no-drift",
"type": "action",
"action": "workflow.log",
"params": {
"message": "No drift detected between sources"
}
}
]
}
}
}
]
}
}