openloops 0.8.1 → 0.8.2

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 CHANGED
@@ -2,6 +2,12 @@
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
+ ## Unreleased
6
+
7
+ ### Changed
8
+
9
+ - 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 product 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 openloops.xyz.
10
+
5
11
  ## 0.8.1
6
12
 
7
13
  ### Added
package/README.md CHANGED
@@ -1,11 +1,13 @@
1
1
  # openloops
2
2
 
3
- **Build production-grade enterprise agents in minutes, not days, weeks, or months.** · [openloops.xyz](https://openloops.xyz)
3
+ **Build enterprise multitenant AI agents for your SaaS in minutes, not days, weeks, or months.** · [openloops.xyz](https://openloops.xyz)
4
4
 
5
- `openloops` is an open source **harness** for 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 a **loop** that decides what it is for (the body). `openloops` is the harness, and it ships the loop. Change the model, or the loop, and the rest stays the same.
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 **product** you build around it (the body). Anthropic and OpenAI give you the engine, Openloops is the chassis, with the AGI loop, the tools and everything an agent needs in production, and 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
+
7
+ **Want to see it working?** [Try the live demo](https://openloops.xyz/#demo), a real agent running on Openloops, with nothing to install.
6
8
 
7
9
  <p align="center">
8
- <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 (the harness) and a body (the loop). The body changes between a personal assistant, an analyst, customer support and a programmer, while the engine and the chassis stay the same." width="560">
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 product). 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">
9
11
  </p>
10
12
 
11
13
  ```typescript
@@ -13,13 +15,13 @@ import { Agent } from 'openloops/core'
13
15
  import { Logger } from 'openloops/common'
14
16
  import { CurrentUser } from 'openloops/base'
15
17
  import { AgiLoop } from 'openloops/loops'
16
- import { webSearchTool } from 'openloops/tools'
18
+ import { fetchUrlTool } from 'openloops/tools'
17
19
 
18
20
  const logger = new Logger()
19
21
  const currentUser = await CurrentUser.asyncFromDB(userId)
20
22
  const agent = new Agent({ loop: new AgiLoop() })
21
23
 
22
- agent.addTool(webSearchTool) // needs SERPER_API_KEY, see "Web search" below
24
+ agent.addTool(fetchUrlTool) // reads web pages as text, it needs no key
23
25
 
24
26
  const result = await agent.run({
25
27
  input: { message: 'what is the current price of Bitcoin?' },
@@ -67,27 +69,9 @@ This project uses the `openloops` package. Before writing code that uses it, rea
67
69
  The package has no controllers: the authorization of every endpoint is the responsibility of this backend.
68
70
  ```
69
71
 
70
- ## Pick a loop, or write your own
71
-
72
- The logic that makes your agent *your* agent (how it reasons, when it asks for confirmation, whether it answers in one shot or works through a sequence of tools) lives in an `AgentLoop`. `openloops` ships `AgiLoop`, a reasoning loop that answers directly when it can and otherwise works in cycles of think, act and observe until it has a final answer. Any loop, yours or someone else's, is interchangeable.
73
-
74
- Want a customer support agent?
75
-
76
- ```typescript
77
- const agent = new Agent({ loop: new CustomerSupportLoop() })
78
- ```
72
+ ## Built for your SaaS, not for one person
79
73
 
80
- Want a software development agent?
81
-
82
- ```typescript
83
- const agent = new Agent({ loop: new CodeSpecialistLoop() })
84
- ```
85
-
86
- A loop is a single file with a handful of node functions, so writing your own is a matter of an afternoon, not a sprint. See [Building an `AgentLoop`](docs/loops.md).
87
-
88
- ## Built for products, not for one person
89
-
90
- 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.
74
+ 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 every customer of a product: 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.
91
75
 
92
76
  `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.
93
77
 
@@ -95,11 +79,11 @@ If you've stood up [OpenClaw](https://github.com/openclaw/openclaw), [Hermes Age
95
79
 
96
80
  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.
97
81
 
98
- `openloops` gives you one file to read to understand your agent's behavior: the loop itself. Persistence and tracing aren't something you configure. They're just already there. See the full comparison further down.
82
+ `openloops` gives you a ready-made chassis: you add your tools and your MCP servers, embed the agent in your app, and the rest is already there. Persistence and tracing aren't something you configure. See the full comparison further down.
99
83
 
100
84
  ## What you get out of the box
101
85
 
102
- - **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.
86
+ - **Multitenant 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.
103
87
  - **Zero-boilerplate persistence.** Messages, tasks, and every tool call your agent makes are saved automatically to MongoDB, and a conversation resumes exactly where it stopped, including in the middle of a confirmation or a question. You never write a `save()` call.
104
88
  - **Safe tool execution.** Arguments are validated against the tool's schema, destructive tools wait for the user's confirmation, identical failing calls are blocked, identifiers the model invented are rejected before they reach a real system, and large outputs are kept out of the prompt. LLM calls retry with backoff and wait out rate limits.
105
89
  - **Native MCP support with a trust flow.** Connect any MCP server and its tools become regular tools. Each server must be approved by the user before its first tool runs, and a server that changes its tools is reviewed again, so a third party cannot quietly change what your agent does.
@@ -174,8 +158,8 @@ This is a comparison against the self-hosted, open-source versions of LangGraph
174
158
  | User management | Included (`openloops/users`, `openloops/authentication`) | Not included, you build your own | Not included, you build your own |
175
159
  | LLM usage/cost tracking | Included (`openloops/llmcalls`): per answer, per chat, and per-user statistics | Not included in OSS, available via paid LangSmith | Third-party integrations such as OpenLIT report token usage and cost |
176
160
  | Observability | Langfuse via env vars, a hook to report errors to the tool you use, and traces stored per chat | Your own tracing setup, or paid LangSmith | Third-party integrations (Langfuse, OpenLIT, Arize Phoenix, Opik, Weave) that you set up |
177
- | What you write | Node functions (plain async functions) | Nodes and the graph's edges, explicitly | Agents, tasks, and crew orchestration, declared per role |
178
- | 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 |
161
+ | What you write | Your tools and MCP servers, and the product you build on top. The loop is included, and you can write your own | Nodes and the graph's edges, explicitly | Agents, tasks, and crew orchestration, declared per role |
162
+ | Mental model | A ready-made chassis: you connect your tools and embed the agent in your app | A graph you declare and compile ahead of time | A crew of role-based agents coordinated for you |
179
163
 
180
164
  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."
181
165
 
@@ -257,6 +241,12 @@ The built-in `sendSlackMessageTool` posts a message to a channel. Create a Slack
257
241
  - **Errors**: register one function with `setErrorReporter` and send them to Sentry or to the tool you use. See [reporting errors](docs/error-reporting.md). Reporting with `SENTRY_DSN` still works but is deprecated.
258
242
  - **Langfuse**: set `LANGFUSE_SECRET_KEY`, `LANGFUSE_PUBLIC_KEY`, and `LANGFUSE_BASE_URL` and every LLM call is traced automatically, with no code changes.
259
243
 
244
+ ## The AGI loop, and your own if you need it
245
+
246
+ The logic that makes your agent *your* agent (how it reasons, when it asks for confirmation, whether it answers in one shot or works through a sequence of tools) lives in an `AgentLoop`. Most products never need to write one: `openloops` ships `AgiLoop`, a reasoning loop that answers directly when it can and otherwise works in cycles of think, act and observe until it has a final answer. What you add is your tools and your MCP servers.
247
+
248
+ If you need full control, a loop is a single file with a handful of node functions, so writing your own is a matter of an afternoon, not a sprint. See [Building an `AgentLoop`](docs/loops.md).
249
+
260
250
  ## More examples
261
251
 
262
252
  Every pattern above, and a lot more, lives as a runnable example in [`examples/`](examples), organized by domain: `run-agent`, `loops`, `tools`, `guardrails`, `automations`, `mcps`, `chats`, `usage`, `users`, `errors`, and `authentication`.
@@ -1,6 +1,6 @@
1
1
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 560 310" width="560" height="310" role="img" aria-labelledby="t d">
2
2
  <title id="t">The openloops harness</title>
3
- <desc id="d">A car made of an engine (the AI model), a chassis (the harness) and a body (the loop). The body changes while the engine and the chassis stay the same: a different body, a different agent.</desc>
3
+ <desc id="d">A car made of an engine (the AI model), a chassis (Openloops) and a body (your product). The body changes while the engine and the chassis stay the same: a different body, a different agent.</desc>
4
4
  <style>
5
5
  .mono{font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace}
6
6
  .body,.role{opacity:0;animation:cycle 12.8s infinite both;transform-box:fill-box}
@@ -22,25 +22,25 @@
22
22
  <path d="M 90 150 L 90 128 Q 90 118 104 116 L 190 110 L 225 82 Q 232 76 244 76 L 330 76 Q 342 76 350 84 L 378 110 L 462 118 Q 478 120 478 134 L 478 150 Z" fill="#cbd5e1" fill-opacity="0.04" stroke="#cbd5e1" stroke-width="1.75" stroke-linejoin="round"/>
23
23
  <path d="M 232 84 L 292 84 L 292 108 L 205 108 Z M 300 84 L 336 84 L 366 108 L 300 108 Z" fill="#cbd5e1" fill-opacity="0.08" stroke="#cbd5e1" stroke-width="1" stroke-linejoin="round"/>
24
24
  <line x1="290" y1="62" x2="290" y2="72" stroke="#64748b" stroke-width="1" stroke-dasharray="3 3"/>
25
- <text class="mono" x="290" y="54" text-anchor="middle" font-size="11" letter-spacing="1.2" fill="#cbd5e1">BODY<tspan fill="#94a3b8"> (</tspan><tspan fill="#f8fafc">LOOP</tspan><tspan fill="#94a3b8">)</tspan></text>
25
+ <text class="mono" x="290" y="54" text-anchor="middle" font-size="11" letter-spacing="1.2" fill="#cbd5e1">BODY<tspan fill="#94a3b8"> (</tspan><tspan fill="#f8fafc">YOUR PRODUCT</tspan><tspan fill="#94a3b8">)</tspan></text>
26
26
  </g>
27
- <g class="body b1" style="animation-delay:3.2s">
27
+ <g class="body b1" style="animation-delay:6.4s">
28
28
  <path d="M 90 150 L 90 132 Q 90 124 102 122 L 200 116 Q 240 84 290 84 L 330 84 Q 350 86 362 104 L 372 114 L 462 124 Q 480 128 480 138 L 480 150 Z" fill="#cbd5e1" fill-opacity="0.04" stroke="#cbd5e1" stroke-width="1.75" stroke-linejoin="round"/>
29
29
  <path d="M 232 112 Q 258 92 290 92 L 330 92 Q 342 94 350 110 Z" fill="#cbd5e1" fill-opacity="0.08" stroke="#cbd5e1" stroke-width="1" stroke-linejoin="round"/>
30
30
  <line x1="290" y1="62" x2="290" y2="80" stroke="#64748b" stroke-width="1" stroke-dasharray="3 3"/>
31
- <text class="mono" x="290" y="54" text-anchor="middle" font-size="11" letter-spacing="1.2" fill="#cbd5e1">BODY<tspan fill="#94a3b8"> (</tspan><tspan fill="#f8fafc">LOOP</tspan><tspan fill="#94a3b8">)</tspan></text>
31
+ <text class="mono" x="290" y="54" text-anchor="middle" font-size="11" letter-spacing="1.2" fill="#cbd5e1">BODY<tspan fill="#94a3b8"> (</tspan><tspan fill="#f8fafc">YOUR PRODUCT</tspan><tspan fill="#94a3b8">)</tspan></text>
32
32
  </g>
33
- <g class="body b2" style="animation-delay:6.4s">
33
+ <g class="body b2" style="animation-delay:3.2s">
34
34
  <path d="M 90 150 L 90 100 Q 90 84 106 84 L 340 84 Q 352 84 358 96 L 380 118 L 462 124 Q 478 126 478 140 L 478 150 Z" fill="#cbd5e1" fill-opacity="0.04" stroke="#cbd5e1" stroke-width="1.75" stroke-linejoin="round"/>
35
35
  <path d="M 110 96 L 166 96 L 166 124 L 110 124 Z M 176 96 L 232 96 L 232 124 L 176 124 Z M 242 96 L 298 96 L 298 124 L 242 124 Z M 308 96 L 342 96 L 366 118 L 308 118 Z" fill="#cbd5e1" fill-opacity="0.08" stroke="#cbd5e1" stroke-width="1" stroke-linejoin="round"/>
36
36
  <line x1="240" y1="62" x2="240" y2="80" stroke="#64748b" stroke-width="1" stroke-dasharray="3 3"/>
37
- <text class="mono" x="240" y="54" text-anchor="middle" font-size="11" letter-spacing="1.2" fill="#cbd5e1">BODY<tspan fill="#94a3b8"> (</tspan><tspan fill="#f8fafc">LOOP</tspan><tspan fill="#94a3b8">)</tspan></text>
37
+ <text class="mono" x="240" y="54" text-anchor="middle" font-size="11" letter-spacing="1.2" fill="#cbd5e1">BODY<tspan fill="#94a3b8"> (</tspan><tspan fill="#f8fafc">YOUR PRODUCT</tspan><tspan fill="#94a3b8">)</tspan></text>
38
38
  </g>
39
39
  <g class="body b3" style="animation-delay:9.6s">
40
40
  <path d="M 290 150 L 290 100 Q 292 84 308 82 L 352 82 Q 364 82 370 92 L 384 114 L 462 120 Q 478 122 478 136 L 478 150 Z M 90 150 L 90 110 L 100 110 L 104 140 L 270 140 L 274 110 L 284 110 L 284 150 Z" fill="#cbd5e1" fill-opacity="0.04" stroke="#cbd5e1" stroke-width="1.75" stroke-linejoin="round"/>
41
41
  <path d="M 302 92 L 348 92 L 372 114 L 302 114 Z" fill="#cbd5e1" fill-opacity="0.08" stroke="#cbd5e1" stroke-width="1" stroke-linejoin="round"/>
42
42
  <line x1="330" y1="62" x2="330" y2="78" stroke="#64748b" stroke-width="1" stroke-dasharray="3 3"/>
43
- <text class="mono" x="330" y="54" text-anchor="middle" font-size="11" letter-spacing="1.2" fill="#cbd5e1">BODY<tspan fill="#94a3b8"> (</tspan><tspan fill="#f8fafc">LOOP</tspan><tspan fill="#94a3b8">)</tspan></text>
43
+ <text class="mono" x="330" y="54" text-anchor="middle" font-size="11" letter-spacing="1.2" fill="#cbd5e1">BODY<tspan fill="#94a3b8"> (</tspan><tspan fill="#f8fafc">YOUR PRODUCT</tspan><tspan fill="#94a3b8">)</tspan></text>
44
44
  </g>
45
45
  <g>
46
46
  <rect class="motor" x="394" y="122" width="66" height="26" rx="4" fill="#ffffff" fill-opacity="0.06" stroke="#cbd5e1" stroke-width="1.5"/>
@@ -70,10 +70,10 @@
70
70
  <line x1="0" y1="-8" x2="0" y2="-20" stroke="#64748b" stroke-width="2" transform="rotate(288)"/>
71
71
  </g><circle r="8" fill="#0B0E14" stroke="#cbd5e1" stroke-width="1.5"/></g>
72
72
  <line x1="280" y1="172" x2="280" y2="232" stroke="#64748b" stroke-width="1" stroke-dasharray="3 3"/>
73
- <text class="mono" x="280" y="248" text-anchor="middle" font-size="11" letter-spacing="1.2" font-weight="700" fill="#C06CF0">CHASSIS<tspan fill="#94a3b8"> (</tspan><tspan fill="#e9d5ff">HARNESS</tspan><tspan fill="#94a3b8">)</tspan></text></g>
73
+ <text class="mono" x="280" y="248" text-anchor="middle" font-size="11" letter-spacing="1.2" font-weight="700" fill="#C06CF0">CHASSIS<tspan fill="#94a3b8"> (</tspan><tspan fill="#e9d5ff">OPENLOOPS</tspan><tspan fill="#94a3b8">)</tspan></text></g>
74
74
  <text class="mono role b0" x="280" y="278" text-anchor="middle" font-size="13" fill="#f8fafc" style="animation-delay:0s">Personal assistant</text>
75
- <text class="mono role b1" x="280" y="278" text-anchor="middle" font-size="13" fill="#f8fafc" style="animation-delay:3.2s">Analyst</text>
76
- <text class="mono role b2" x="280" y="278" text-anchor="middle" font-size="13" fill="#f8fafc" style="animation-delay:6.4s">Customer support</text>
77
- <text class="mono role b3" x="280" y="278" text-anchor="middle" font-size="13" fill="#f8fafc" style="animation-delay:9.6s">Programmer</text>
75
+ <text class="mono role b1" x="280" y="278" text-anchor="middle" font-size="13" fill="#f8fafc" style="animation-delay:6.4s">Meeting copilot</text>
76
+ <text class="mono role b2" x="280" y="278" text-anchor="middle" font-size="13" fill="#f8fafc" style="animation-delay:3.2s">Customer support</text>
77
+ <text class="mono role b3" x="280" y="278" text-anchor="middle" font-size="13" fill="#f8fafc" style="animation-delay:9.6s">Your incredible idea</text>
78
78
  <text class="mono" x="280" y="298" text-anchor="middle" font-size="11" fill="#94a3b8">Same engine. Same chassis. A different body, a different agent.</text>
79
79
  </svg>
package/docs/llms.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  # openloops
2
2
 
3
- > A TypeScript runtime for AI agents that run in your backend. It persists chats, tasks and tool calls in MongoDB, scopes everything to a user, asks for approval before destructive tools and unapproved MCP servers, and can run agents on a schedule. It has no HTTP layer: your backend calls its use cases and owns authorization.
3
+ > An open source harness for building multitenant AI agents for your SaaS: a TypeScript runtime that runs in your backend. It persists chats, tasks and tool calls in MongoDB, scopes everything to a user, asks for approval before destructive tools and unapproved MCP servers, and can run agents on a schedule. It has no HTTP layer: your backend calls its use cases and owns authorization.
4
4
 
5
5
  Start with the integration guide, then read only the pages you need. All pages are in this folder.
6
6
 
package/docs/loops.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Building an `AgentLoop`
2
2
 
3
- An `AgentLoop` decides how your agent thinks and acts: when it answers directly, when it uses tools, when it asks the user. `openloops` ships `AgiLoop`, which is the one to use for general agents, and you can write your own for anything else.
3
+ An `AgentLoop` decides how your agent thinks and acts: when it answers directly, when it uses tools, when it asks the user. `openloops` ships `AgiLoop`, which is the one to use for general agents and works out of the box, so most products never need to write a loop. This page is for the advanced case where you do.
4
4
 
5
5
  ```typescript
6
6
  import { AgentLoop, AgentStatus, Harness, RunContext } from 'openloops/core'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "openloops",
3
- "version": "0.8.1",
4
- "description": "Open source harness for AI agents: a TypeScript runtime with persistence, tools, MCP trust, approvals and autonomous automations, where the loop is pluggable",
3
+ "version": "0.8.2",
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
7
  "email": "jose@openloops.xyz",
@@ -157,6 +157,8 @@
157
157
  "agent-framework",
158
158
  "agent-runtime",
159
159
  "agent-loop",
160
+ "multitenant",
161
+ "saas",
160
162
  "agentic",
161
163
  "autonomous-agents",
162
164
  "llm",