openloops 0.10.0 → 0.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -1
- package/README.md +3 -3
- package/dist/loops/agi/loop.js +2 -2
- package/dist/loops/agi/loop.mjs +2 -2
- package/dist/services/automations/entities/recurrence.d.ts +11 -0
- package/dist/services/automations/entities/recurrence.js +26 -6
- package/dist/services/automations/entities/recurrence.mjs +23 -6
- package/dist/services/automations/runner/automation-runner.js +1 -0
- package/dist/services/automations/runner/automation-runner.mjs +1 -0
- package/dist/services/automations/utils/next-run.js +9 -0
- package/dist/services/automations/utils/next-run.mjs +10 -1
- package/docs/authentication.md +1 -1
- package/docs/automations.md +5 -1
- package/docs/users.md +1 -1
- package/examples/authentication/login.ts +1 -1
- package/examples/users/create-user.ts +1 -1
- package/package.json +15 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `openloops` are written here, newest first. The format follows [Keep a Changelog](https://keepachangelog.com) and the versions follow [semantic versioning](https://semver.org), where a minor version can still break the API while the package is in beta. Changes before 0.4.0 are not recorded here, see the commits and the tags.
|
|
4
4
|
|
|
5
|
+
## 0.10.2
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `openloops/tasks`, `openloops/traces` and `openloops/workspaces` are exported, so a backend can read the tasks, actions, traces and workspace items of a chat (`listAgentTasksByChat`, `getAgentTaskById`, `listAgentActionsByTask`, `listAgentTracesByChat`, `listWorkspaceItems`, `getWorkspaceItem`, `searchWorkspaceItems`, `saveWorkspaceItem`, `deleteWorkspaceItem`). Their functions already existed and only the subpaths were missing.
|
|
10
|
+
|
|
11
|
+
- Recurrence of type `interval` for automations: every X minutes or hours counted from a `start` date and time (`{ type: 'interval', every, unit, start }`, `IntervalUnit` enum). It is an exact interval from `start`, not tied to the clock, and the shortest is 5 minutes. No migration needed.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- The chat of an automation run takes the name of the automation as its title. Before, it took the first 80 characters of the instructions, or had none.
|
|
16
|
+
|
|
5
17
|
## 0.10.0
|
|
6
18
|
|
|
7
19
|
### Added
|
|
@@ -41,7 +53,7 @@ All notable changes to `openloops` are written here, newest first. The format fo
|
|
|
41
53
|
|
|
42
54
|
- The fast responder (2.6.0) now knows it is the front layer of an agent, adopts `identity` like the reasoning engine does, and delegates to the engine every message about the product, the agent or its capabilities, and the data or advice that belong to the domain described in `productInfo.about`. It no longer lists what the agent can or cannot do, and it delegates when in doubt. Keep `identity.role` short.
|
|
43
55
|
- The reasoning engine (2.5.6) states more firmly that the final answer goes inside the `respond` action and that text written outside the JSON is never delivered, which reduces the plain text answers that were rejected as `invalid_response` and cost an extra call. The message sent back after a response that is not JSON now says that text meant for the user belongs in the `answer` of a `respond` action. It also reads `productInfo` when the user asks about the product or the company.
|
|
44
|
-
- The description of the package, the README and the docs index present `openloops` as the harness for building multitenant AI agents for your SaaS, where the model is the engine, `openloops` the chassis and your interface the body. The README no longer shows the `CustomerSupportLoop` and `CodeSpecialistLoop` examples, which the package does not ship, and links to the live demo at
|
|
56
|
+
- The description of the package, the README and the docs index present `openloops` as the harness for building multitenant AI agents for your SaaS, where the model is the engine, `openloops` the chassis and your interface the body. The README no longer shows the `CustomerSupportLoop` and `CodeSpecialistLoop` examples, which the package does not ship, and links to the live demo at openloopsai.co.
|
|
45
57
|
|
|
46
58
|
## 0.8.1
|
|
47
59
|
|
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Openloops
|
|
2
2
|
|
|
3
|
-
**Build production-ready, multitenant AI agents for your SaaS in minutes, not days, weeks, or months.** · [
|
|
3
|
+
**Build production-ready, multitenant AI agents for your SaaS in minutes, not days, weeks, or months.** · [openloopsai.co](https://openloopsai.co)
|
|
4
4
|
|
|
5
5
|
Openloops is an open source **harness** for building AI agents. An agent is three things: a **model** that thinks (the engine), a **harness** that gives it hands, memory and rules (the chassis), and the **interface** you build on top, with your tools and MCP servers (the body). Anthropic and OpenAI give you the engine. Openloops gives you the chassis, with the AGI loop, the tools and everything an agent needs in production. You build the body: a customer support agent, a financial auditor, a meeting copilot. Change the model, or the product, and the rest stays the same.
|
|
6
6
|
|
|
7
|
-
**Want to see it working?** [Try the live demo](https://
|
|
7
|
+
**Want to see it working?** [Try the live demo](https://openloopsai.co/#demo), a real agent running on Openloops, with nothing to install.
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
10
10
|
<img src="https://raw.githubusercontent.com/jbarcosdev/openloops/main/docs/assets/harness-car.svg" alt="A car made of an engine (the AI model), a chassis (Openloops) and a body (your interface). The body changes between a personal assistant, customer support, a meeting copilot and your own idea, while the engine and the chassis stay the same." width="560">
|
|
@@ -300,4 +300,4 @@ Every pattern above, and a lot more, lives as a runnable example in [`examples/`
|
|
|
300
300
|
|
|
301
301
|
Apache-2.0, free and open source, including for commercial and enterprise use.
|
|
302
302
|
|
|
303
|
-
Questions? Reach out at jose@
|
|
303
|
+
Questions? Reach out at jose@endeavourai.co.
|
package/dist/loops/agi/loop.js
CHANGED
|
@@ -55,8 +55,8 @@ class AgiLoop extends import_harness.AgentLoop {
|
|
|
55
55
|
get author() {
|
|
56
56
|
return {
|
|
57
57
|
name: "Jose Barcos",
|
|
58
|
-
email: "jose@
|
|
59
|
-
website: "https://
|
|
58
|
+
email: "jose@endeavourai.co",
|
|
59
|
+
website: "https://openloopsai.co/jose"
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
agentContext(ctx) {
|
package/dist/loops/agi/loop.mjs
CHANGED
|
@@ -32,8 +32,8 @@ class AgiLoop extends AgentLoop {
|
|
|
32
32
|
get author() {
|
|
33
33
|
return {
|
|
34
34
|
name: "Jose Barcos",
|
|
35
|
-
email: "jose@
|
|
36
|
-
website: "https://
|
|
35
|
+
email: "jose@endeavourai.co",
|
|
36
|
+
website: "https://openloopsai.co/jose"
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
agentContext(ctx) {
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
export declare const WEEKDAYS: readonly ["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"];
|
|
2
|
+
export declare enum IntervalUnit {
|
|
3
|
+
MINUTES = "minutes",
|
|
4
|
+
HOURS = "hours"
|
|
5
|
+
}
|
|
6
|
+
export declare const MIN_INTERVAL_MINUTES = 5;
|
|
7
|
+
export declare const intervalToMinutes: (every: number, unit: IntervalUnit) => number;
|
|
2
8
|
export type Recurrence = {
|
|
3
9
|
type: 'daily';
|
|
4
10
|
time: string;
|
|
@@ -10,6 +16,11 @@ export type Recurrence = {
|
|
|
10
16
|
type: 'monthly';
|
|
11
17
|
day: number | 'last';
|
|
12
18
|
time: string;
|
|
19
|
+
} | {
|
|
20
|
+
type: 'interval';
|
|
21
|
+
every: number;
|
|
22
|
+
unit: IntervalUnit;
|
|
23
|
+
start: string;
|
|
13
24
|
} | {
|
|
14
25
|
type: 'once';
|
|
15
26
|
at: string;
|
|
@@ -18,12 +18,22 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var recurrence_exports = {};
|
|
20
20
|
__export(recurrence_exports, {
|
|
21
|
+
IntervalUnit: () => IntervalUnit,
|
|
22
|
+
MIN_INTERVAL_MINUTES: () => MIN_INTERVAL_MINUTES,
|
|
21
23
|
WEEKDAYS: () => WEEKDAYS,
|
|
24
|
+
intervalToMinutes: () => intervalToMinutes,
|
|
22
25
|
toCronPattern: () => toCronPattern,
|
|
23
26
|
validateRecurrence: () => validateRecurrence
|
|
24
27
|
});
|
|
25
28
|
module.exports = __toCommonJS(recurrence_exports);
|
|
26
29
|
const WEEKDAYS = ["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"];
|
|
30
|
+
var IntervalUnit = /* @__PURE__ */ ((IntervalUnit2) => {
|
|
31
|
+
IntervalUnit2["MINUTES"] = "minutes";
|
|
32
|
+
IntervalUnit2["HOURS"] = "hours";
|
|
33
|
+
return IntervalUnit2;
|
|
34
|
+
})(IntervalUnit || {});
|
|
35
|
+
const MIN_INTERVAL_MINUTES = 5;
|
|
36
|
+
const intervalToMinutes = (every, unit) => unit === "hours" /* HOURS */ ? every * 60 : every;
|
|
27
37
|
const TIME = /^([01]\d|2[0-3]):([0-5]\d)$/;
|
|
28
38
|
const LOCAL_DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})T([01]\d|2[0-3]):([0-5]\d)$/;
|
|
29
39
|
const isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
@@ -31,13 +41,13 @@ const assertTime = (value) => {
|
|
|
31
41
|
if (typeof value !== "string" || !TIME.test(value)) throw new Error("The time must be written as HH:mm, in 24 hours");
|
|
32
42
|
return value;
|
|
33
43
|
};
|
|
34
|
-
const assertLocalDateTime = (value) => {
|
|
44
|
+
const assertLocalDateTime = (value, type) => {
|
|
35
45
|
const match = typeof value === "string" ? LOCAL_DATE_TIME.exec(value) : null;
|
|
36
|
-
if (!match) throw new Error(
|
|
46
|
+
if (!match) throw new Error(`The date of a recurrence of type ${type} must be written as YYYY-MM-DDTHH:mm`);
|
|
37
47
|
const [, year, month, day] = match;
|
|
38
48
|
const parsed = new Date(Date.UTC(Number(year), Number(month) - 1, Number(day)));
|
|
39
49
|
if (parsed.getUTCFullYear() !== Number(year) || parsed.getUTCMonth() !== Number(month) - 1 || parsed.getUTCDate() !== Number(day)) {
|
|
40
|
-
throw new Error(
|
|
50
|
+
throw new Error(`The date of a recurrence of type ${type} does not exist`);
|
|
41
51
|
}
|
|
42
52
|
return value;
|
|
43
53
|
};
|
|
@@ -58,14 +68,21 @@ function validateRecurrence(value) {
|
|
|
58
68
|
if (!valid) throw new Error('The day of a monthly recurrence must be a number from 1 to 31 or "last"');
|
|
59
69
|
return { type: "monthly", day, time: assertTime(value.time) };
|
|
60
70
|
}
|
|
71
|
+
case "interval": {
|
|
72
|
+
const { every, unit } = value;
|
|
73
|
+
if (!Number.isInteger(every) || every < 1) throw new Error("The interval of a recurrence must be a whole number greater than zero");
|
|
74
|
+
if (!Object.values(IntervalUnit).includes(unit)) throw new Error("The unit of an interval must be minutes or hours");
|
|
75
|
+
if (intervalToMinutes(every, unit) < MIN_INTERVAL_MINUTES) throw new Error(`The interval of a recurrence cannot be shorter than ${MIN_INTERVAL_MINUTES} minutes`);
|
|
76
|
+
return { type: "interval", every, unit, start: assertLocalDateTime(value.start, "interval") };
|
|
77
|
+
}
|
|
61
78
|
case "once":
|
|
62
|
-
return { type: "once", at: assertLocalDateTime(value.at) };
|
|
79
|
+
return { type: "once", at: assertLocalDateTime(value.at, "once") };
|
|
63
80
|
default:
|
|
64
|
-
throw new Error("The type of the recurrence must be daily, weekly, monthly or once");
|
|
81
|
+
throw new Error("The type of the recurrence must be daily, weekly, monthly, interval or once");
|
|
65
82
|
}
|
|
66
83
|
}
|
|
67
84
|
function toCronPattern(recurrence) {
|
|
68
|
-
if (recurrence.type === "once") return void 0;
|
|
85
|
+
if (recurrence.type === "once" || recurrence.type === "interval") return void 0;
|
|
69
86
|
const [hour, minute] = recurrence.time.split(":").map(Number);
|
|
70
87
|
switch (recurrence.type) {
|
|
71
88
|
case "daily":
|
|
@@ -78,7 +95,10 @@ function toCronPattern(recurrence) {
|
|
|
78
95
|
}
|
|
79
96
|
// Annotate the CommonJS export names for ESM import in node:
|
|
80
97
|
0 && (module.exports = {
|
|
98
|
+
IntervalUnit,
|
|
99
|
+
MIN_INTERVAL_MINUTES,
|
|
81
100
|
WEEKDAYS,
|
|
101
|
+
intervalToMinutes,
|
|
82
102
|
toCronPattern,
|
|
83
103
|
validateRecurrence
|
|
84
104
|
});
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
const WEEKDAYS = ["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"];
|
|
2
|
+
var IntervalUnit = /* @__PURE__ */ ((IntervalUnit2) => {
|
|
3
|
+
IntervalUnit2["MINUTES"] = "minutes";
|
|
4
|
+
IntervalUnit2["HOURS"] = "hours";
|
|
5
|
+
return IntervalUnit2;
|
|
6
|
+
})(IntervalUnit || {});
|
|
7
|
+
const MIN_INTERVAL_MINUTES = 5;
|
|
8
|
+
const intervalToMinutes = (every, unit) => unit === "hours" /* HOURS */ ? every * 60 : every;
|
|
2
9
|
const TIME = /^([01]\d|2[0-3]):([0-5]\d)$/;
|
|
3
10
|
const LOCAL_DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})T([01]\d|2[0-3]):([0-5]\d)$/;
|
|
4
11
|
const isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
@@ -6,13 +13,13 @@ const assertTime = (value) => {
|
|
|
6
13
|
if (typeof value !== "string" || !TIME.test(value)) throw new Error("The time must be written as HH:mm, in 24 hours");
|
|
7
14
|
return value;
|
|
8
15
|
};
|
|
9
|
-
const assertLocalDateTime = (value) => {
|
|
16
|
+
const assertLocalDateTime = (value, type) => {
|
|
10
17
|
const match = typeof value === "string" ? LOCAL_DATE_TIME.exec(value) : null;
|
|
11
|
-
if (!match) throw new Error(
|
|
18
|
+
if (!match) throw new Error(`The date of a recurrence of type ${type} must be written as YYYY-MM-DDTHH:mm`);
|
|
12
19
|
const [, year, month, day] = match;
|
|
13
20
|
const parsed = new Date(Date.UTC(Number(year), Number(month) - 1, Number(day)));
|
|
14
21
|
if (parsed.getUTCFullYear() !== Number(year) || parsed.getUTCMonth() !== Number(month) - 1 || parsed.getUTCDate() !== Number(day)) {
|
|
15
|
-
throw new Error(
|
|
22
|
+
throw new Error(`The date of a recurrence of type ${type} does not exist`);
|
|
16
23
|
}
|
|
17
24
|
return value;
|
|
18
25
|
};
|
|
@@ -33,14 +40,21 @@ function validateRecurrence(value) {
|
|
|
33
40
|
if (!valid) throw new Error('The day of a monthly recurrence must be a number from 1 to 31 or "last"');
|
|
34
41
|
return { type: "monthly", day, time: assertTime(value.time) };
|
|
35
42
|
}
|
|
43
|
+
case "interval": {
|
|
44
|
+
const { every, unit } = value;
|
|
45
|
+
if (!Number.isInteger(every) || every < 1) throw new Error("The interval of a recurrence must be a whole number greater than zero");
|
|
46
|
+
if (!Object.values(IntervalUnit).includes(unit)) throw new Error("The unit of an interval must be minutes or hours");
|
|
47
|
+
if (intervalToMinutes(every, unit) < MIN_INTERVAL_MINUTES) throw new Error(`The interval of a recurrence cannot be shorter than ${MIN_INTERVAL_MINUTES} minutes`);
|
|
48
|
+
return { type: "interval", every, unit, start: assertLocalDateTime(value.start, "interval") };
|
|
49
|
+
}
|
|
36
50
|
case "once":
|
|
37
|
-
return { type: "once", at: assertLocalDateTime(value.at) };
|
|
51
|
+
return { type: "once", at: assertLocalDateTime(value.at, "once") };
|
|
38
52
|
default:
|
|
39
|
-
throw new Error("The type of the recurrence must be daily, weekly, monthly or once");
|
|
53
|
+
throw new Error("The type of the recurrence must be daily, weekly, monthly, interval or once");
|
|
40
54
|
}
|
|
41
55
|
}
|
|
42
56
|
function toCronPattern(recurrence) {
|
|
43
|
-
if (recurrence.type === "once") return void 0;
|
|
57
|
+
if (recurrence.type === "once" || recurrence.type === "interval") return void 0;
|
|
44
58
|
const [hour, minute] = recurrence.time.split(":").map(Number);
|
|
45
59
|
switch (recurrence.type) {
|
|
46
60
|
case "daily":
|
|
@@ -52,7 +66,10 @@ function toCronPattern(recurrence) {
|
|
|
52
66
|
}
|
|
53
67
|
}
|
|
54
68
|
export {
|
|
69
|
+
IntervalUnit,
|
|
70
|
+
MIN_INTERVAL_MINUTES,
|
|
55
71
|
WEEKDAYS,
|
|
72
|
+
intervalToMinutes,
|
|
56
73
|
toCronPattern,
|
|
57
74
|
validateRecurrence
|
|
58
75
|
};
|
|
@@ -154,6 +154,7 @@ class AutomationRunner {
|
|
|
154
154
|
const agent = new import_agent.Agent({ ...configured, loop });
|
|
155
155
|
const model = automation.modelProvider && automation.modelName ? { modelProvider: automation.modelProvider, modelName: automation.modelName } : {};
|
|
156
156
|
const draft = import_chat.Chat.withDefaults(loop.name);
|
|
157
|
+
draft.setTitle(automation.name);
|
|
157
158
|
draft.settings?.setExecutionMode("autonomous");
|
|
158
159
|
if (model.modelProvider) draft.settings?.setModelProvider(model.modelProvider);
|
|
159
160
|
if (model.modelName) draft.settings?.setModelName(model.modelName);
|
|
@@ -130,6 +130,7 @@ class AutomationRunner {
|
|
|
130
130
|
const agent = new Agent({ ...configured, loop });
|
|
131
131
|
const model = automation.modelProvider && automation.modelName ? { modelProvider: automation.modelProvider, modelName: automation.modelName } : {};
|
|
132
132
|
const draft = Chat.withDefaults(loop.name);
|
|
133
|
+
draft.setTitle(automation.name);
|
|
133
134
|
draft.settings?.setExecutionMode("autonomous");
|
|
134
135
|
if (model.modelProvider) draft.settings?.setModelProvider(model.modelProvider);
|
|
135
136
|
if (model.modelName) draft.settings?.setModelName(model.modelName);
|
|
@@ -35,7 +35,16 @@ function assertTimezone(timezone) {
|
|
|
35
35
|
}
|
|
36
36
|
return timezone;
|
|
37
37
|
}
|
|
38
|
+
function computeNextInterval(recurrence, timezone, from) {
|
|
39
|
+
const start = new import_croner.Cron(`${recurrence.start}:00`, { timezone }).nextRun(/* @__PURE__ */ new Date(0));
|
|
40
|
+
if (!start) return null;
|
|
41
|
+
const step = (0, import_recurrence.intervalToMinutes)(recurrence.every, recurrence.unit) * 60 * 1e3;
|
|
42
|
+
if (from.getTime() < start.getTime()) return start;
|
|
43
|
+
const elapsed = Math.floor((from.getTime() - start.getTime()) / step) + 1;
|
|
44
|
+
return new Date(start.getTime() + elapsed * step);
|
|
45
|
+
}
|
|
38
46
|
function computeNextRun(recurrence, timezone, from = /* @__PURE__ */ new Date()) {
|
|
47
|
+
if (recurrence.type === "interval") return computeNextInterval(recurrence, timezone, from);
|
|
39
48
|
const pattern = recurrence.type === "once" ? `${recurrence.at}:00` : (0, import_recurrence.toCronPattern)(recurrence);
|
|
40
49
|
const cron = new import_croner.Cron(pattern, { timezone });
|
|
41
50
|
let next = cron.nextRun(from);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Cron } from "croner";
|
|
2
|
-
import { toCronPattern } from "../entities/recurrence";
|
|
2
|
+
import { intervalToMinutes, toCronPattern } from "../entities/recurrence";
|
|
3
3
|
const MAX_PREVIEW = 20;
|
|
4
4
|
function assertTimezone(timezone) {
|
|
5
5
|
if (typeof timezone !== "string" || !timezone.trim()) throw new Error("The timezone is required");
|
|
@@ -10,7 +10,16 @@ function assertTimezone(timezone) {
|
|
|
10
10
|
}
|
|
11
11
|
return timezone;
|
|
12
12
|
}
|
|
13
|
+
function computeNextInterval(recurrence, timezone, from) {
|
|
14
|
+
const start = new Cron(`${recurrence.start}:00`, { timezone }).nextRun(/* @__PURE__ */ new Date(0));
|
|
15
|
+
if (!start) return null;
|
|
16
|
+
const step = intervalToMinutes(recurrence.every, recurrence.unit) * 60 * 1e3;
|
|
17
|
+
if (from.getTime() < start.getTime()) return start;
|
|
18
|
+
const elapsed = Math.floor((from.getTime() - start.getTime()) / step) + 1;
|
|
19
|
+
return new Date(start.getTime() + elapsed * step);
|
|
20
|
+
}
|
|
13
21
|
function computeNextRun(recurrence, timezone, from = /* @__PURE__ */ new Date()) {
|
|
22
|
+
if (recurrence.type === "interval") return computeNextInterval(recurrence, timezone, from);
|
|
14
23
|
const pattern = recurrence.type === "once" ? `${recurrence.at}:00` : toCronPattern(recurrence);
|
|
15
24
|
const cron = new Cron(pattern, { timezone });
|
|
16
25
|
let next = cron.nextRun(from);
|
package/docs/authentication.md
CHANGED
|
@@ -36,7 +36,7 @@ The refresh token is not a JWT: it is a random string, and only its hash is stor
|
|
|
36
36
|
```typescript
|
|
37
37
|
const result = await login({
|
|
38
38
|
payload: {
|
|
39
|
-
emailOrUsername: 'jose@
|
|
39
|
+
emailOrUsername: 'jose@endeavourai.co',
|
|
40
40
|
password: 'a-real-password',
|
|
41
41
|
},
|
|
42
42
|
})
|
package/docs/automations.md
CHANGED
|
@@ -92,10 +92,12 @@ The recurrence of a `schedule` trigger is stored as a structured value, so a scr
|
|
|
92
92
|
| `daily` | `time` | `{ type: 'daily', time: '08:00' }` |
|
|
93
93
|
| `weekly` | `days` (1 is Monday, 7 is Sunday), `time` | `{ type: 'weekly', days: [1, 2, 3, 4, 5], time: '09:30' }` is Monday to Friday |
|
|
94
94
|
| `monthly` | `day` (1 to 31 or `'last'`), `time` | `{ type: 'monthly', day: 15, time: '12:00' }` |
|
|
95
|
+
| `interval` | `every` (whole number), `unit` (`'minutes'` or `'hours'`), `start` (`YYYY-MM-DDTHH:mm`, local time) | `{ type: 'interval', every: 90, unit: 'minutes', start: '2026-10-14T08:00' }` |
|
|
95
96
|
| `once` | `at` (`YYYY-MM-DDTHH:mm`, local time) | `{ type: 'once', at: '2026-12-25T10:00' }` |
|
|
96
97
|
|
|
97
98
|
- A monthly automation on day 29, 30 or 31 is skipped in the months that do not have that day. Use `'last'` for the last day of every month.
|
|
98
99
|
- A time that does not exist on a day because of daylight saving time runs at the first valid moment of that day, and a time that happens twice runs once.
|
|
100
|
+
- An `interval` counts real minutes or hours from `start`: it runs at `start`, then every `every` units after it, with no drift and not tied to the clock, so every 7 hours from 08:00 runs at 08:00, 15:00, 22:00, 05:00... Daylight saving time does not move it. A `start` in the past is fine, the next run is the next moment of the grid. Changing `start`, `every`, `unit` or the timezone changes the grid. The shortest interval is 5 minutes (`MIN_INTERVAL_MINUTES`).
|
|
99
101
|
- An automation of type `once` runs a single time and then has no next run.
|
|
100
102
|
|
|
101
103
|
### Previewing
|
|
@@ -299,9 +301,11 @@ process.on('SIGTERM', async () => {
|
|
|
299
301
|
})
|
|
300
302
|
```
|
|
301
303
|
|
|
304
|
+
The runner does not share anything with the agent you build for your chat. If you leave out `agent`, every run starts with an agent that has no tools, no guards and no MCP servers, and nothing warns you: the model just answers that it cannot do the task. Pass the same tools and options you give your chat agent. The best way is to build them in one place, for example a function `buildAgentOptions()`, and call it from your chat endpoint and from the `agent` option of the runner. Two copies of the configuration drift apart, and the automations are the ones that fail, with no one watching.
|
|
305
|
+
|
|
302
306
|
| Option | Default | What it does |
|
|
303
307
|
| --- | --- | --- |
|
|
304
|
-
| `agent` | `{}` | The options of the `Agent` used for every run: tools, guards, `maxIterations`, `strictMode`, `identity`... It can be a function `({ automation, currentUser }) => options` when they depend on the automation or on the user. The loop is `AgiLoop` unless you set `loop`. A custom loop must support autonomous mode (`harness.executionMode`). |
|
|
308
|
+
| `agent` | `{}` (no tools, no guards) | The options of the `Agent` used for every run: tools, guards, `maxIterations`, `strictMode`, `identity`... It can be a function `({ automation, currentUser }) => options` when they depend on the automation or on the user. The loop is `AgiLoop` unless you set `loop`. A custom loop must support autonomous mode (`harness.executionMode`). |
|
|
305
309
|
| `intervalMs` | `60000` | How often it checks. Also set with `AUTOMATIONS_POLL_INTERVAL_MS`. `runner.wake()` makes it check now. |
|
|
306
310
|
| `leaseMs` | `600000` | How long an automation stays locked while it runs, renewed while the run lasts. Also set with `AUTOMATIONS_LEASE_MS`. |
|
|
307
311
|
| `maxConcurrentRuns` | `3` | How many runs a runner executes at once. |
|
package/docs/users.md
CHANGED
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openloops",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.3",
|
|
4
4
|
"description": "Open source harness for building multitenant AI agents for your SaaS: a TypeScript runtime with persistence, tools, MCP trust, approvals and autonomous automations",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jose Barcos",
|
|
7
|
-
"email": "jose@
|
|
7
|
+
"email": "jose@endeavourai.co",
|
|
8
8
|
"url": "https://github.com/jbarcosdev"
|
|
9
9
|
},
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
|
-
"homepage": "https://
|
|
11
|
+
"homepage": "https://openloopsai.co",
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
14
|
"url": "git+https://github.com/jbarcosdev/openloops.git"
|
|
@@ -83,6 +83,18 @@
|
|
|
83
83
|
"types": "./dist/services/users/index.d.ts",
|
|
84
84
|
"default": "./dist/services/users/index.js"
|
|
85
85
|
},
|
|
86
|
+
"./tasks": {
|
|
87
|
+
"types": "./dist/services/tasks/index.d.ts",
|
|
88
|
+
"default": "./dist/services/tasks/index.js"
|
|
89
|
+
},
|
|
90
|
+
"./traces": {
|
|
91
|
+
"types": "./dist/services/traces/index.d.ts",
|
|
92
|
+
"default": "./dist/services/traces/index.js"
|
|
93
|
+
},
|
|
94
|
+
"./workspaces": {
|
|
95
|
+
"types": "./dist/services/workspaces/index.d.ts",
|
|
96
|
+
"default": "./dist/services/workspaces/index.js"
|
|
97
|
+
},
|
|
86
98
|
"./db": {
|
|
87
99
|
"types": "./dist/db/index.d.ts",
|
|
88
100
|
"default": "./dist/db/index.js"
|