1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "skills": [
12 "apify/agent-skills"
13 ],
14 "nodeDependencies": {},
15 "pythonRequirementsTxt": "",
16 "initShellScript": `apt-get update
17 # apt-get install -y curl
18 # mkdir /sandbox/data`,
19 "idleTimeoutSeconds": 600,
20 "proxyMappings": [
21 {
22 "path": "/myapp",
23 "target": "http://127.0.0.1:3000/myapp"
24 }
25 ]
26};
27
28
29const run = await client.actor("apify/ai-sandbox").call(input);
30
31
32console.log('Results from dataset');
33console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
34const { items } = await client.dataset(run.defaultDatasetId).listItems();
35items.forEach((item) => {
36 console.dir(item);
37});
38
39