Repository navigation
Expand file tree
/
Copy pathindex.ts
More file actions
57 lines (48 loc) · 1.55 KB
/
Copy pathindex.ts
File metadata and controls
57 lines (48 loc) · 1.55 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
import { runner } from "@agentuity/sdk";
if (!process.env.AGENTUITY_API_KEY && !process.env.AGENTUITY_SDK_KEY) {
console.error(
"\x1b[31m[ERROR] AGENTUITY_API_KEY or AGENTUITY_SDK_KEY is not set. This should have been set automatically by the Agentuity CLI or picked up from the .env file.\x1b[0m"
);
const cmd = process.env._ || "";
if (cmd.endsWith("node")) {
console.error(
"\x1b[31m[ERROR] Re-run the command with `node --env-file .env index.ts`\x1b[0m"
);
}
process.exit(1);
}
if (!process.env.ADMIN_KEY) {
console.error(
"\x1b[31m[ERROR] ADMIN_KEY environment variable is not set. Required for admin operations.\x1b[0m"
);
process.exit(1);
}
if (!process.env.EXAMPLE_APPLICANT_KEY) {
console.error(
"\x1b[31m[ERROR] EXAMPLE_APPLICANT_KEY environment variable is not set. Required for example applicant agent features.\x1b[0m"
);
process.exit(1);
}
if (!process.env.AGENTUITY_URL) {
console.warn(
"\x1b[31m[WARN] You are running this agent outside of the Agentuity environment. Any automatic Agentuity features will be disabled.\x1b[0m"
);
if (process.isBun) {
console.warn(
"\x1b[31m[WARN] Recommend running `agentuity dev` to run your project locally instead of `bun run start`.\x1b[0m"
);
} else {
console.warn(
"\x1b[31m[WARN] Recommend running `agentuity dev` to run your project locally instead of `npm start`.\x1b[0m"
);
}
}
runner(true, import.meta.dirname).catch((err) => {
if (err instanceof Error) {
console.error(err.message);
console.error(err.stack);
} else {
console.error(err);
}
process.exit(1);
});