openloops 0.1.23 → 0.1.25

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/README.md CHANGED
@@ -0,0 +1,219 @@
1
+ # openloops
2
+
3
+ **Build production-grade enterprise agents in minutes, not days, weeks, or months.**
4
+
5
+ ```typescript
6
+ import { Agent } from 'openloops/core'
7
+ import { Logger } from 'openloops/common'
8
+ import { CurrentUser } from 'openloops/base'
9
+ import { PlanExecuteLoop } from 'openloops/loops'
10
+
11
+ const logger = new Logger()
12
+ const currentUser = await CurrentUser.asyncFromDB(userId)
13
+ const agent = new Agent({ loop: new PlanExecuteLoop() })
14
+
15
+ const result = await agent.run({
16
+ input: { message: 'what is the current price of Bitcoin?' },
17
+ currentUser,
18
+ })
19
+
20
+ logger.info(result.data.lastAnswer, '[Demo] Result')
21
+ ```
22
+
23
+ That's it. The agent is persisted, resumable, and scoped to that one user, with tool execution, retries, and observability already wired in. No message table to design, no state machine to debug by hand, no MCP adapter to write.
24
+
25
+ ## Pick a loop, or write your own
26
+
27
+ The logic that makes your agent *your* agent (how it plans, when it asks for confirmation, whether it answers in one shot or works through a sequence of tools) lives in an `AgentLoop`. `openloops` ships `PlanExecuteLoop` today, and it's built so any loop, yours or someone else's, is interchangeable.
28
+
29
+ Want a customer support agent?
30
+
31
+ ```typescript
32
+ const agent = new Agent({ loop: new CustomerSupportLoop() })
33
+ ```
34
+
35
+ Want a software development agent?
36
+
37
+ ```typescript
38
+ const agent = new Agent({ loop: new CodeSpecialistLoop() })
39
+ ```
40
+
41
+ Want a reasoning agent for deep analysis?
42
+
43
+ ```typescript
44
+ const agent = new Agent({ loop: new ReactLoop() })
45
+ ```
46
+
47
+ Don't see what you need in the marketplace? Build it yourself. A loop is a single file with a handful of node functions. Most people have their first working loop in an afternoon, not a sprint. See [Building an `AgentLoop`](docs/loops.md).
48
+
49
+ **Launching this week at [openloops.xyz/marketplace](https://openloops.xyz/marketplace):** a growing library of free, community-maintained loops, including `ReactLoop`, `CodeSpecialistLoop`, `CustomerSupportLoop`, and more on the way for domains like cybersecurity and finance. Building an agent for a new use case becomes a matter of picking the right loop, not writing a new framework underneath it every time.
50
+
51
+ ## Built for products, not for one person
52
+
53
+ If you've stood up [OpenClaw](https://github.com/openclaw/openclaw), [Hermes Agent](https://github.com/NousResearch/hermes-agent), or [ZeroClaw](https://github.com/zeroclaw-labs/zeroclaw), you already know how good a single, always-on personal agent can feel. You also know what happens the moment you try to make it serve more than one person: there's no clean boundary between "my agent" and "your agent." Conversations, memory, and connected tools were never designed to be scoped per user in the first place.
54
+
55
+ `openloops` starts from the opposite assumption. Every chat, every task, every piece of context, and every connected MCP server is scoped to a `currentUser` from the ground up, not bolted on later. Two users, same deployment, completely separate agents, with zero risk of one seeing the other's history or tools.
56
+
57
+ ## If you've already tried LangGraph or CrewAI
58
+
59
+ You know the pattern: before you write a single line of what your agent actually *does*, you're declaring a graph, wiring a checkpointer, and figuring out how tool retries and error states are supposed to work. Weeks in, you have an agent that technically runs, and a mental model of *why* it does what it does that only lives in your head, because the framework itself is a black box the moment something goes wrong in production.
60
+
61
+ `openloops` gives you one file to read to understand your agent's behavior: the loop itself. Persistence, retries, and tracing aren't something you configure. They're just already there. See the full comparison against LangGraph further down.
62
+
63
+ ## What you get out of the box
64
+
65
+ - **Multi-user by design.** Chat history, task state, and MCP server configuration are all scoped per user, so the same deployment safely serves every one of your customers.
66
+ - **Zero-boilerplate persistence.** Messages, tasks, and every tool call your agent makes are saved automatically to MongoDB. You never write a `save()` call.
67
+ - **Production-grade tool execution.** Retries on failed steps, confirmation prompts before destructive actions, and graceful resume after a crash are all built into the runtime.
68
+ - **Native MCP support.** Connect any MCP server and its tools become regular tools instantly. No adapter package, no manual schema mapping.
69
+ - **Sub-agent orchestration.** An agent can launch and coordinate other agents to split up a problem. Full guide coming soon.
70
+ - **Any LLM provider, including local ones.** Built on [`@mariozechner/pi-ai`](https://www.npmjs.com/package/@mariozechner/pi-ai), so OpenAI, Anthropic, and self-hosted models (e.g. via Ollama) all work the same way.
71
+ - **Observability without ceremony.** Sentry and Langfuse are built in. Set the environment variables and they turn on, no SDK wiring required.
72
+ - **A loop marketplace.** Don't write a customer-support agent from scratch. Install one.
73
+
74
+ ## See how little code this actually takes
75
+
76
+ Adding a custom tool:
77
+
78
+ ```typescript
79
+ import { Tool, BaseParams } from 'openloops/tools'
80
+
81
+ export const greetUserTool = new Tool({
82
+ name: 'greet_user',
83
+ description: 'Greet the user',
84
+ destructive: false,
85
+ parameters: {
86
+ type: 'object',
87
+ properties: { firstName: { type: 'string', description: 'First name of the user' } },
88
+ required: ['firstName'],
89
+ },
90
+ handler: async (params: BaseParams & { firstName: string }) => {
91
+ return { data: { greeting: `Hi ${params.firstName}` } }
92
+ },
93
+ })
94
+
95
+ agent.addTool(greetUserTool)
96
+ ```
97
+
98
+ Connecting an MCP server for a user takes no code, just a record:
99
+
100
+ ```typescript
101
+ import { createMcpServer } from 'openloops/mcps'
102
+
103
+ await createMcpServer({
104
+ payload: { name: 'my-mcp', type: 'http', url: 'https://example.dev/api/mcp' },
105
+ currentUser,
106
+ })
107
+ ```
108
+
109
+ The next time that user talks to *any* agent, its tools are already there.
110
+
111
+ ## How it compares to other frameworks
112
+
113
+ This is an honest comparison against the self-hosted, open-source versions of LangGraph and CrewAI, not their paid managed offerings, which do handle persistence and infrastructure for you the same way `openloops` does, at a cost.
114
+
115
+ | | `openloops` | LangGraph (self-hosted OSS) | CrewAI (self-hosted OSS) |
116
+ |---|---|---|---|
117
+ | Persistence | Built in, zero config (MongoDB) | Requires configuring a checkpointer (e.g. Postgres) yourself | Local memory (ChromaDB + SQLite) by default, machine-bound and scoped to a single run |
118
+ | Multi-user scoping | Built in: chats, context, and MCP servers are per-user from the start | Not a concept of the framework, you build it | Not natively supported by default |
119
+ | Tool execution & retries | Built into the runtime | You write the retry/error-handling logic | Configured per task, not automatic |
120
+ | MCP support | Native: MCP tools become `Tool` instances automatically | Requires a separate adapter package and manual wiring | Available through a separate tools integration, not automatic per-user loading |
121
+ | User management | Included (`openloops/users`) | Not included, you build your own | Not included |
122
+ | LLM usage/cost tracking | Included (`openloops/llmcalls`) | Not included in OSS, available via paid LangSmith | Not included as a first-class module |
123
+ | Observability | Sentry + Langfuse, enabled via env vars | Requires your own tracing setup, or paid LangSmith | Requires a third-party tracing integration |
124
+ | Pre-built agents | Growing marketplace of ready-to-use loops | You build every agent from primitives | No built-in agent marketplace |
125
+ | What you write | Node functions (plain async functions) | Nodes and the graph's edges, explicitly | Agents, tasks, and crew orchestration, declared per role |
126
+ | Mental model | A state machine your loop drives itself | A graph you declare and compile ahead of time | A crew of role-based agents coordinated for you |
127
+
128
+ Neither approach is "wrong." LangGraph's explicit graph declaration is a deliberate design choice that gives you visual tooling (LangGraph Studio) and fine-grained control over parallel execution, and CrewAI's role-based model is a natural fit for problems that map cleanly onto a team of specialists. `openloops` trades some of that explicitness for a much shorter path from "I have an idea for an agent" to "it's running in production, for all my users."
129
+
130
+ ## Quick start (local)
131
+
132
+ ```bash
133
+ npm install openloops
134
+ # or
135
+ yarn add openloops
136
+ ```
137
+
138
+ Spin up a local MongoDB with the included `docker-compose.yml`:
139
+
140
+ ```bash
141
+ docker compose up -d
142
+ ```
143
+
144
+ Create a `.env` file:
145
+
146
+ ```bash
147
+ IS_LOCAL=true
148
+ NODE_ENV=development
149
+
150
+ OPENLOOPS_DB_URI="mongodb://localhost:27017/"
151
+ OPENLOOPS_DB_NAME='openloops'
152
+
153
+ SECRET_MANAGER_KEY=secret
154
+
155
+ OPENAI_API_KEY=
156
+
157
+ # Optional, see "Observability" below
158
+ SENTRY_DSN=
159
+ LANGFUSE_SECRET_KEY=
160
+ LANGFUSE_PUBLIC_KEY=
161
+ LANGFUSE_BASE_URL=
162
+
163
+ # Optional, see "Web search" below
164
+ SERPER_API_KEY=
165
+ ```
166
+
167
+ ### Database
168
+
169
+ By default, `openloops` creates a database named `openloops` if `OPENLOOPS_DB_NAME` isn't set. You can point it at an existing database instead, but if that database already has other collections, we recommend using a **separate database** to avoid name collisions with your own collections. If you're starting a project from scratch, using a single unified database for everything (your app's data and `openloops`'s data together) is fine and often simpler.
170
+
171
+ ### Web search
172
+
173
+ The built-in `webSearchTool` uses [Serper](https://serper.dev). Create a free API key there and set `SERPER_API_KEY` in your `.env`. See [`docs/tools.md`](docs/tools.md).
174
+
175
+ ### Observability
176
+
177
+ - **Sentry**: set `SENTRY_DSN` and error tracking turns on automatically.
178
+ - **Langfuse**: set `LANGFUSE_SECRET_KEY`, `LANGFUSE_PUBLIC_KEY`, and `LANGFUSE_BASE_URL` and every LLM call is traced automatically.
179
+
180
+ Neither requires any code changes. They're opt-in purely through environment variables.
181
+
182
+ ## More examples
183
+
184
+ Every pattern above, and a lot more, lives as a runnable example in [`examples/`](examples), organized by domain: `users`, `chats`, `run-agent`, `mcps`, `usage`.
185
+
186
+ ## Package structure
187
+
188
+ `openloops` is a single package with organized subpath exports, so you only pull in what you use:
189
+
190
+ | Subpath | What's in it |
191
+ |---|---|
192
+ | `openloops/core` | `Agent`, `AgentLoop`, `RunContext`: the runtime |
193
+ | `openloops/loops` | Built-in loops, starting with `PlanExecuteLoop` |
194
+ | `openloops/tools` | `Tool`, `BaseParams`, and built-in tools |
195
+ | `openloops/skills` | `Skill`, for writing LLM-backed reasoning steps inside a loop |
196
+ | `openloops/mcps` | MCP server CRUD and connection handling |
197
+ | `openloops/users` | User management |
198
+ | `openloops/llmcalls` | LLM usage/cost tracking |
199
+ | `openloops/base` | `CurrentUser`, `CurrentSession` |
200
+ | `openloops/common` | `Logger` and shared utilities |
201
+ | `openloops/clients` | HTTP clients used by built-in tools (e.g. Serper) |
202
+ | `openloops/authentication` | Authentication utilities |
203
+ | `openloops/chats` | Chat/conversation persistence internals |
204
+
205
+ ## Learn more
206
+
207
+ - [Building an `AgentLoop`](docs/loops.md)
208
+ - [The `Agent` runtime](docs/agent.md)
209
+ - [Tools](docs/tools.md)
210
+ - [Skills](docs/skills.md)
211
+ - [MCP servers](docs/mcp-servers.md)
212
+ - [User management](docs/users.md)
213
+ - [LLM usage tracking](docs/usage.md)
214
+
215
+ ## License
216
+
217
+ Apache-2.0, free and open source, including for commercial and enterprise use.
218
+
219
+ Questions? Reach out at jose@openloops.xyz.
@@ -6,6 +6,7 @@ import { Tool, BaseParams } from '../tools/tool.js';
6
6
  import { SkillRunOptions } from '../skills/skill.js';
7
7
  import { WeightedKeyword, ScoredTool } from './utils/rank-tools-by-keywords';
8
8
  export interface RunContext {
9
+ identity?: AgentIdentity;
9
10
  task?: AgentTask;
10
11
  chat: Chat;
11
12
  currentUser: CurrentUser;
@@ -23,6 +24,11 @@ export interface RunContext {
23
24
  setNextNode: (node?: string | AgentLoopNode) => void;
24
25
  logger: Logger;
25
26
  }
27
+ interface AgentIdentity {
28
+ name?: string;
29
+ gender?: string;
30
+ role?: string;
31
+ }
26
32
  export type AgentLoopNode = (ctx: RunContext) => Promise<void>;
27
33
  export interface Author {
28
34
  name: string;
@@ -36,3 +42,4 @@ export declare abstract class AgentLoop {
36
42
  abstract get version(): string;
37
43
  abstract get author(): Author;
38
44
  }
45
+ export {};
@@ -7,15 +7,26 @@ import { AgentLoop } from './agent-loop';
7
7
  export declare const AGENT_ERROR_CODES: {
8
8
  readonly NODE_NOT_FOUND: "AGENT_NODE_NOT_FOUND";
9
9
  };
10
+ interface AgentIdentity {
11
+ name?: string;
12
+ gender?: string;
13
+ role?: string;
14
+ }
10
15
  export interface AgentOptions {
11
16
  loop: AgentLoop;
12
17
  tools?: Tool[];
18
+ identity?: AgentIdentity;
13
19
  }
14
- interface Input {
20
+ interface ChatInput {
15
21
  message: string;
16
22
  chatId?: string;
17
23
  messageId?: string;
24
+ }
25
+ interface ChatOptions {
26
+ loopName?: string;
27
+ modelName?: 'string';
18
28
  isPrivateSession?: boolean;
29
+ notifyOnCompletion?: boolean;
19
30
  }
20
31
  type HookType = 'pre_execution' | 'post_execution';
21
32
  export declare class Agent {
@@ -23,11 +34,13 @@ export declare class Agent {
23
34
  private readonly chatRepository;
24
35
  private readonly logger;
25
36
  private readonly _loop;
37
+ private readonly _identity?;
26
38
  private _tools;
27
39
  private _mcps;
28
40
  private _preHooks;
29
41
  private _postHooks;
30
42
  private currentChat;
43
+ private chatOptions?;
31
44
  private currentUser?;
32
45
  private currentSession?;
33
46
  private currentMessage;
@@ -42,7 +55,12 @@ export declare class Agent {
42
55
  get mcps(): McpServer[];
43
56
  get notifyOnCompletion(): boolean | undefined;
44
57
  get lastAssistantAnswer(): string | undefined;
45
- run(input: Input, currentUser: CurrentUser, currentSession?: CurrentSession): Promise<{
58
+ run(props: {
59
+ input: ChatInput;
60
+ options?: ChatOptions;
61
+ currentUser: CurrentUser;
62
+ currentSession?: CurrentSession;
63
+ }): Promise<{
46
64
  data: Chat;
47
65
  } | undefined>;
48
66
  stopAgent(): void;
@@ -44,11 +44,13 @@ class Agent {
44
44
  chatRepository = import_tsyringe.container.resolve(import_repositories.ChatRepository);
45
45
  logger = new import_logger.Logger();
46
46
  _loop;
47
+ _identity;
47
48
  _tools;
48
49
  _mcps = [];
49
50
  _preHooks = [];
50
51
  _postHooks = [];
51
52
  currentChat;
53
+ chatOptions;
52
54
  currentUser;
53
55
  currentSession;
54
56
  currentMessage = "";
@@ -81,6 +83,7 @@ class Agent {
81
83
  if (!agentOptions?.loop) throw new Error("[AGENT] An AgentLoop instance is required");
82
84
  this._loop = agentOptions.loop;
83
85
  this._tools = agentOptions.tools ?? [];
86
+ this._identity = agentOptions.identity;
84
87
  this.currentChat = import_chat.Chat.withDefaults(this._loop.name);
85
88
  }
86
89
  get tools() {
@@ -95,8 +98,9 @@ class Agent {
95
98
  get lastAssistantAnswer() {
96
99
  return this.currentChat.lastAnswer;
97
100
  }
98
- async run(input, currentUser, currentSession) {
101
+ async run(props) {
99
102
  try {
103
+ const { input, options, currentUser, currentSession } = props || {};
100
104
  const { chatId, message } = input || {};
101
105
  this.logger.debug(input, "[AGENT] Agent started");
102
106
  if (!this._loop?.nodes || !this._loop?.initialNode) throw new Error("[AGENT] Loop is missing");
@@ -108,6 +112,7 @@ class Agent {
108
112
  this.currentUser = currentUser;
109
113
  this.currentSession = currentSession;
110
114
  this.currentMessage = message;
115
+ this.chatOptions = options;
111
116
  this.answerId = new (require("mongodb")).ObjectId().toString();
112
117
  await this.preRunner(chatId);
113
118
  await this.runLoop();
@@ -149,6 +154,10 @@ class Agent {
149
154
  role: "user",
150
155
  content: this.currentMessage
151
156
  });
157
+ if (this.chatOptions?.notifyOnCompletion) this.currentChat.settings?.setNotifyOnCompletion(true);
158
+ if (this.chatOptions?.isPrivateSession) this.currentChat.settings?.setIsPrivateSession(true);
159
+ if (this.chatOptions?.modelName) this.currentChat.settings?.setModelName(this.chatOptions.modelName);
160
+ if (this.chatOptions?.loopName) this.currentChat.settings?.setLoopName(this.chatOptions.loopName);
152
161
  this.currentChat.state?.setStatus(import_agent_state.AgentStatus.PROCESSING);
153
162
  this.currentChat.state?.setCurrentActivity("Starting...");
154
163
  await this.saveChat({ resetStop: true });
@@ -275,6 +284,7 @@ class Agent {
275
284
  buildRunContext() {
276
285
  const sessionId = this.currentChat._id?.toString() ?? "";
277
286
  return {
287
+ identity: this._identity,
278
288
  task: this.currentChat.activeTask,
279
289
  chat: this.currentChat,
280
290
  currentUser: this.currentUser,
@@ -21,11 +21,13 @@ class Agent {
21
21
  chatRepository = container.resolve(ChatRepository);
22
22
  logger = new Logger();
23
23
  _loop;
24
+ _identity;
24
25
  _tools;
25
26
  _mcps = [];
26
27
  _preHooks = [];
27
28
  _postHooks = [];
28
29
  currentChat;
30
+ chatOptions;
29
31
  currentUser;
30
32
  currentSession;
31
33
  currentMessage = "";
@@ -58,6 +60,7 @@ class Agent {
58
60
  if (!agentOptions?.loop) throw new Error("[AGENT] An AgentLoop instance is required");
59
61
  this._loop = agentOptions.loop;
60
62
  this._tools = agentOptions.tools ?? [];
63
+ this._identity = agentOptions.identity;
61
64
  this.currentChat = Chat.withDefaults(this._loop.name);
62
65
  }
63
66
  get tools() {
@@ -72,8 +75,9 @@ class Agent {
72
75
  get lastAssistantAnswer() {
73
76
  return this.currentChat.lastAnswer;
74
77
  }
75
- async run(input, currentUser, currentSession) {
78
+ async run(props) {
76
79
  try {
80
+ const { input, options, currentUser, currentSession } = props || {};
77
81
  const { chatId, message } = input || {};
78
82
  this.logger.debug(input, "[AGENT] Agent started");
79
83
  if (!this._loop?.nodes || !this._loop?.initialNode) throw new Error("[AGENT] Loop is missing");
@@ -85,6 +89,7 @@ class Agent {
85
89
  this.currentUser = currentUser;
86
90
  this.currentSession = currentSession;
87
91
  this.currentMessage = message;
92
+ this.chatOptions = options;
88
93
  this.answerId = new (require("mongodb")).ObjectId().toString();
89
94
  await this.preRunner(chatId);
90
95
  await this.runLoop();
@@ -126,6 +131,10 @@ class Agent {
126
131
  role: "user",
127
132
  content: this.currentMessage
128
133
  });
134
+ if (this.chatOptions?.notifyOnCompletion) this.currentChat.settings?.setNotifyOnCompletion(true);
135
+ if (this.chatOptions?.isPrivateSession) this.currentChat.settings?.setIsPrivateSession(true);
136
+ if (this.chatOptions?.modelName) this.currentChat.settings?.setModelName(this.chatOptions.modelName);
137
+ if (this.chatOptions?.loopName) this.currentChat.settings?.setLoopName(this.chatOptions.loopName);
129
138
  this.currentChat.state?.setStatus(AgentStatus.PROCESSING);
130
139
  this.currentChat.state?.setCurrentActivity("Starting...");
131
140
  await this.saveChat({ resetStop: true });
@@ -252,6 +261,7 @@ class Agent {
252
261
  buildRunContext() {
253
262
  const sessionId = this.currentChat._id?.toString() ?? "";
254
263
  return {
264
+ identity: this._identity,
255
265
  task: this.currentChat.activeTask,
256
266
  chat: this.currentChat,
257
267
  currentUser: this.currentUser,
@@ -0,0 +1 @@
1
+ export * from './logger';
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var common_exports = {};
17
+ module.exports = __toCommonJS(common_exports);
18
+ __reExport(common_exports, require("./logger"), module.exports);
19
+ // Annotate the CommonJS export names for ESM import in node:
20
+ 0 && (module.exports = {
21
+ ...require("./logger")
22
+ });
@@ -0,0 +1 @@
1
+ export * from "./logger";
@@ -55,9 +55,11 @@ class PlanExecuteLoop extends import_agent.AgentLoop {
55
55
  async fastResponder(ctx) {
56
56
  ctx.chat.state?.setCurrentActivity("Analyzing requirement...");
57
57
  const chat_history = ctx.chat.lastHistoryMessages();
58
+ const agentIdentity = ctx.identity;
58
59
  const result = await import_skills.fastResponder.run({
59
60
  ...ctx.skillParams,
60
61
  contextInjection: {
62
+ ...agentIdentity && Object.keys(agentIdentity)?.length ? { agentIdentity } : {},
61
63
  ...chat_history?.length ? { chat_history } : {}
62
64
  }
63
65
  });
@@ -40,9 +40,11 @@ class PlanExecuteLoop extends AgentLoop {
40
40
  async fastResponder(ctx) {
41
41
  ctx.chat.state?.setCurrentActivity("Analyzing requirement...");
42
42
  const chat_history = ctx.chat.lastHistoryMessages();
43
+ const agentIdentity = ctx.identity;
43
44
  const result = await fastResponder.run({
44
45
  ...ctx.skillParams,
45
46
  contextInjection: {
47
+ ...agentIdentity && Object.keys(agentIdentity)?.length ? { agentIdentity } : {},
46
48
  ...chat_history?.length ? { chat_history } : {}
47
49
  }
48
50
  });
@@ -31,11 +31,6 @@ const fastResponder = new import_skill.Skill({
31
31
  systemInstructions: {
32
32
  instruction_set: {
33
33
  goal: "Provide general assistance in a friendly, empathetic, and natural manner as a close companion.",
34
- identity: {
35
- name: "Sofi",
36
- gender: "Female",
37
- role: "Personal assistant and daily companion"
38
- },
39
34
  soul: {
40
35
  tone: "Warm, fluid, and enthusiastic, and empathetic",
41
36
  style: "Conversational and natural, avoiding overly formal language",
@@ -9,11 +9,6 @@ const fastResponder = new Skill({
9
9
  systemInstructions: {
10
10
  instruction_set: {
11
11
  goal: "Provide general assistance in a friendly, empathetic, and natural manner as a close companion.",
12
- identity: {
13
- name: "Sofi",
14
- gender: "Female",
15
- role: "Personal assistant and daily companion"
16
- },
17
12
  soul: {
18
13
  tone: "Warm, fluid, and enthusiastic, and empathetic",
19
14
  style: "Conversational and natural, avoiding overly formal language",
@@ -1,17 +1,20 @@
1
1
  export interface ChatSettingsProps {
2
2
  notifyOnCompletion?: boolean;
3
+ isPrivateSession?: boolean;
3
4
  modelName?: string;
4
5
  loopName?: string;
5
6
  }
6
7
  export declare class ChatSettings {
7
8
  private readonly props;
8
9
  notifyOnCompletion?: boolean | undefined;
10
+ isPrivateSession?: boolean | undefined;
9
11
  modelName?: string | undefined;
10
12
  loopName?: string | undefined;
11
- constructor(props: ChatSettingsProps, notifyOnCompletion?: boolean | undefined, modelName?: string | undefined, loopName?: string | undefined);
13
+ constructor(props: ChatSettingsProps, notifyOnCompletion?: boolean | undefined, isPrivateSession?: boolean | undefined, modelName?: string | undefined, loopName?: string | undefined);
12
14
  static fromJSON(props: ChatSettingsProps): ChatSettings;
13
15
  toJSON(): ChatSettingsProps;
14
16
  setLoopName(loopName: string): void;
15
17
  setModelName(modelName: string): void;
16
18
  setNotifyOnCompletion(notifyOnCompletion: boolean): void;
19
+ setIsPrivateSession(isPrivateSession: boolean): void;
17
20
  }
@@ -22,20 +22,23 @@ __export(chat_settings_entity_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(chat_settings_entity_exports);
24
24
  class ChatSettings {
25
- constructor(props, notifyOnCompletion, modelName, loopName) {
25
+ constructor(props, notifyOnCompletion, isPrivateSession, modelName, loopName) {
26
26
  this.props = props;
27
27
  this.notifyOnCompletion = notifyOnCompletion;
28
+ this.isPrivateSession = isPrivateSession;
28
29
  this.modelName = modelName;
29
30
  this.loopName = loopName;
30
31
  }
31
32
  props;
32
33
  notifyOnCompletion;
34
+ isPrivateSession;
33
35
  modelName;
34
36
  loopName;
35
37
  static fromJSON(props) {
36
38
  return new ChatSettings(
37
39
  props,
38
40
  props.notifyOnCompletion,
41
+ props.isPrivateSession,
39
42
  props.modelName,
40
43
  props.loopName
41
44
  );
@@ -43,6 +46,7 @@ class ChatSettings {
43
46
  toJSON() {
44
47
  return {
45
48
  notifyOnCompletion: this.notifyOnCompletion,
49
+ isPrivateSession: this.isPrivateSession,
46
50
  modelName: this.modelName,
47
51
  loopName: this.loopName
48
52
  };
@@ -56,6 +60,9 @@ class ChatSettings {
56
60
  setNotifyOnCompletion(notifyOnCompletion) {
57
61
  this.notifyOnCompletion = notifyOnCompletion;
58
62
  }
63
+ setIsPrivateSession(isPrivateSession) {
64
+ this.isPrivateSession = isPrivateSession;
65
+ }
59
66
  }
60
67
  // Annotate the CommonJS export names for ESM import in node:
61
68
  0 && (module.exports = {
@@ -1,19 +1,22 @@
1
1
  import "../../../chunk-CF3WOMB3.mjs";
2
2
  class ChatSettings {
3
- constructor(props, notifyOnCompletion, modelName, loopName) {
3
+ constructor(props, notifyOnCompletion, isPrivateSession, modelName, loopName) {
4
4
  this.props = props;
5
5
  this.notifyOnCompletion = notifyOnCompletion;
6
+ this.isPrivateSession = isPrivateSession;
6
7
  this.modelName = modelName;
7
8
  this.loopName = loopName;
8
9
  }
9
10
  props;
10
11
  notifyOnCompletion;
12
+ isPrivateSession;
11
13
  modelName;
12
14
  loopName;
13
15
  static fromJSON(props) {
14
16
  return new ChatSettings(
15
17
  props,
16
18
  props.notifyOnCompletion,
19
+ props.isPrivateSession,
17
20
  props.modelName,
18
21
  props.loopName
19
22
  );
@@ -21,6 +24,7 @@ class ChatSettings {
21
24
  toJSON() {
22
25
  return {
23
26
  notifyOnCompletion: this.notifyOnCompletion,
27
+ isPrivateSession: this.isPrivateSession,
24
28
  modelName: this.modelName,
25
29
  loopName: this.loopName
26
30
  };
@@ -34,6 +38,9 @@ class ChatSettings {
34
38
  setNotifyOnCompletion(notifyOnCompletion) {
35
39
  this.notifyOnCompletion = notifyOnCompletion;
36
40
  }
41
+ setIsPrivateSession(isPrivateSession) {
42
+ this.isPrivateSession = isPrivateSession;
43
+ }
37
44
  }
38
45
  export {
39
46
  ChatSettings
@@ -105,13 +105,19 @@ let GetLLMUsageUseCase = class extends import_base.BaseUseCase {
105
105
  _id: "$ownerId",
106
106
  totalTokens: { $sum: "$response.usage.totalTokens" }
107
107
  }
108
+ },
109
+ {
110
+ $project: {
111
+ _id: 0,
112
+ userId: "$_id",
113
+ totalTokens: 1
114
+ }
108
115
  }
109
116
  ];
110
117
  const result = await this.llmCallRepository?._.aggregate(pipeline);
111
118
  return {
112
119
  data: {
113
- ...result[0],
114
- tokensLimit: 5e6
120
+ ...result[0]
115
121
  }
116
122
  };
117
123
  }
@@ -77,13 +77,19 @@ let GetLLMUsageUseCase = class extends BaseUseCase {
77
77
  _id: "$ownerId",
78
78
  totalTokens: { $sum: "$response.usage.totalTokens" }
79
79
  }
80
+ },
81
+ {
82
+ $project: {
83
+ _id: 0,
84
+ userId: "$_id",
85
+ totalTokens: 1
86
+ }
80
87
  }
81
88
  ];
82
89
  const result = await this.llmCallRepository?._.aggregate(pipeline);
83
90
  return {
84
91
  data: {
85
- ...result[0],
86
- tokensLimit: 5e6
92
+ ...result[0]
87
93
  }
88
94
  };
89
95
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openloops",
3
- "version": "0.1.23",
3
+ "version": "0.1.25",
4
4
  "description": "Framework to build AI Agents",
5
5
  "author": {
6
6
  "name": "Jose Barcos",
@@ -19,6 +19,10 @@
19
19
  "types": "./dist/common/base/index.d.ts",
20
20
  "default": "./dist/common/base/index.js"
21
21
  },
22
+ "./common": {
23
+ "types": "./dist/common/index.d.ts",
24
+ "default": "./dist/common/index.js"
25
+ },
22
26
  "./core": {
23
27
  "types": "./dist/agent/index.d.ts",
24
28
  "default": "./dist/agent/index.js"
@@ -115,5 +119,9 @@
115
119
  },
116
120
  "engines": {
117
121
  "node": ">=22.0.0"
122
+ },
123
+ "repository": {
124
+ "type": "git",
125
+ "url": "git+https://github.com/jbarcosdev/openloops.git"
118
126
  }
119
127
  }