1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "request": {
12 "entity_id": "order-42",
13 "evaluation_time": "2026-10-18T08:00:00Z",
14 "sources": [
15 {
16 "id": "stripe"
17 },
18 {
19 "id": "crm"
20 },
21 {
22 "id": "warehouse"
23 }
24 ],
25 "fields": {
26 "payment": {
27 "source_priority": [
28 "stripe",
29 "crm"
30 ],
31 "max_age_seconds": 3600,
32 "min_confidence": 0.8,
33 "require_provenance": true,
34 "allowed_values": [
35 "paid",
36 "refunded"
37 ],
38 "tie_break": "ABSTAIN"
39 },
40 "fulfillment": {
41 "source_priority": [
42 "warehouse"
43 ],
44 "max_age_seconds": 3600,
45 "min_confidence": 0.8,
46 "require_provenance": true,
47 "allowed_values": [
48 "shipped",
49 "held"
50 ],
51 "tie_break": "ABSTAIN"
52 }
53 },
54 "observations": [
55 {
56 "id": "a",
57 "entity_id": "order-42",
58 "source_id": "stripe",
59 "field": "payment",
60 "value": "refunded",
61 "observed_at": "2026-10-18T07:55:00Z",
62 "confidence": 0.98,
63 "provenance": "stripe:event-a"
64 },
65 {
66 "id": "b",
67 "entity_id": "order-42",
68 "source_id": "crm",
69 "field": "payment",
70 "value": "paid",
71 "observed_at": "2026-10-18T07:59:00Z",
72 "confidence": 0.99,
73 "provenance": "crm:event-b"
74 },
75 {
76 "id": "c",
77 "entity_id": "order-42",
78 "source_id": "warehouse",
79 "field": "fulfillment",
80 "value": "shipped",
81 "observed_at": "2026-10-18T07:58:00Z",
82 "confidence": 0.95,
83 "provenance": "warehouse:event-c"
84 }
85 ],
86 "invariants": []
87 }
88};
89
90
91const run = await client.actor("bono718/agent-state-conflict-resolver").call(input);
92
93
94console.log('Results from dataset');
95console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
96const { items } = await client.dataset(run.defaultDatasetId).listItems();
97items.forEach((item) => {
98 console.dir(item);
99});
100
101