loopengine 0.0.6 → 0.0.10

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.
Files changed (2) hide show
  1. package/README.md +33 -46
  2. package/package.json +3 -2
package/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  [![CI](https://github.com/evanyan22/loopengine/actions/workflows/ci.yml/badge.svg)](https://github.com/evanyan22/loopengine/actions/workflows/ci.yml)
4
4
 
5
- A minimal framework for defining and running tool-using AI agents. Write an
6
- agent as a plain config object — persona, tools, permission rules — and run
7
- it through one generic ReAct loop over the CLI, an HTTP API, or both. No
5
+ LoopEngine is a runtime for defining and running multiple AI agents through a
6
+ transparent ReAct loop. Write an agent as a plain config object — persona,
7
+ tools, permission rules — and run it over the CLI, an HTTP API, or both. No
8
8
  chain DSL, no hidden control flow: `run-agent.ts` is a single readable
9
9
  function you can step through top to bottom.
10
10
 
@@ -32,6 +32,28 @@ one layer further out still: it's not part of the loop either, just a
32
32
  its output merges straight in with no adapter code. See "External tool
33
33
  gateways" below.
34
34
 
35
+ ## Creating a new project
36
+
37
+ The fastest way to get a running agent server, in your own repo, is
38
+ [`create-loopengine`](https://www.npmjs.com/package/create-loopengine):
39
+
40
+ ```bash
41
+ npx create-loopengine@latest my-agents
42
+ cd my-agents
43
+ npm install
44
+ cp .env.example .env # fill in ANTHROPIC_API_KEY
45
+ npm run dev # HTTP server on :8787
46
+ ```
47
+
48
+ That scaffolds a real, standalone project — its own `package.json`
49
+ depending on `loopengine` (not a clone of this repo), an HTTP + CLI
50
+ adapter, and one starter agent — rather than a bare library import. `npm
51
+ install loopengine` alone (below) only gets you the library; the server,
52
+ adapters, and a runnable example are deliberately not part of that
53
+ package, which is the gap `create-loopengine` fills. See
54
+ [`create-loopengine`'s own README](https://github.com/evanyan22/create-loopengine)
55
+ for what the generated project looks like.
56
+
35
57
  ## Using loopengine as a library
36
58
 
37
59
  This repo is two things in one: a small library (the loop itself) and a
@@ -74,8 +96,10 @@ console.log(result.text)
74
96
 
75
97
  The full exported surface: `runAgent`, `AgentConfig`/`ToolSchema`/`ToolDefinition`,
76
98
  `FileSessionStore`/`RedisSessionStore`/`createSessionStore`, `VectorIndex`/
77
- `embed`/`cosineSimilarity` (for RAG — see below), `discoverAgents` (see
78
- "Auto-discovered agent registry" below), and `createAnthropicModelCall`/
99
+ `embed`/`cosineSimilarity` (for RAG — see below), `discoverAgents` (scans a
100
+ directory for `config`/`createModelCall` modules and builds a name → entry
101
+ map, keyed by `AgentConfig.name` — see `agent-registry.ts` for the ~15-line
102
+ wrapper this repo's own adapters use), and `createAnthropicModelCall`/
79
103
  `createOpenAIModelCall`/`createDeepSeekModelCall` (real, ready-to-use
80
104
  `ModelCall`s). See `index.ts` for the exact list.
81
105
 
@@ -132,46 +156,9 @@ export const config: AgentConfig = {
132
156
  examples — same `runAgent` loop, entirely different personas and tools.
133
157
 
134
158
  A file exporting `config` and `createModelCall` and saved into `agents/` is
135
- runnable through both adapters immediately — `agent-registry.ts` discovers
136
- it automatically (by `AgentConfig.name`, not the filename) at startup.
137
- Nothing to edit, no import to add, no adapter change. See "Auto-discovered
138
- agent registry" below for how and why.
139
-
140
- ## Auto-discovered agent registry
141
-
142
- `discoverAgents(dir)` — exported from the library, used by this repo's own
143
- `agent-registry.ts` — scans a directory's direct files (not
144
- subdirectories, so shared helper code has somewhere to live without being
145
- mistaken for an agent) for modules exporting `config`/`createModelCall`,
146
- and builds a `Map<name, {config, createModelCall}>` from them:
147
-
148
- ```ts
149
- import { dirname, join } from 'node:path'
150
- import { fileURLToPath } from 'node:url'
151
- import { discoverAgents } from 'loopengine'
152
-
153
- const agentsDir = join(dirname(fileURLToPath(import.meta.url)), 'agents')
154
- const entries = await discoverAgents(agentsDir) // top-level await — fine in ESM
155
- ```
156
-
157
- Keyed by `AgentConfig.name`, not the filename — that's the identity
158
- ActAuth's `scope.agent` segment already uses, so this doesn't introduce a
159
- second naming scheme, and a rename is just editing `config.name`, not also
160
- a registry line and an import path. Two files that declared the same
161
- `config.name` would already silently collide in ActAuth's rules before
162
- this existed; `discoverAgents` throws loudly on that (and on a file
163
- missing either export) at startup instead, which is a real safety
164
- property this adds, not just less typing.
165
-
166
- `agent-registry.ts` is a ~15-line wrapper around this: resolve `agents/`
167
- relative to its own file, call `discoverAgents` once at module load behind
168
- a top-level `await`, and expose `listAgents()`/`getEntry(name)` as
169
- synchronous functions from the result — ESM guarantees an importer's own
170
- evaluation (`adapters/http.ts`, `adapters/cli.ts`) waits for that
171
- top-level await to settle first, so neither adapter needs to know
172
- discovery is async underneath. Verified live: dropped a new agent file
173
- into `agents/` with zero other changes and called it immediately through
174
- both `adapters/cli.ts` and `adapters/http.ts`.
159
+ runnable through both adapters immediately — `agent-registry.ts` finds it
160
+ automatically (by `AgentConfig.name`, not the filename) at startup.
161
+ Nothing to edit, no import to add, no adapter change.
175
162
 
176
163
  ## Retrieval (RAG)
177
164
 
@@ -274,7 +261,7 @@ conversation on a later request):
274
261
  ```bash
275
262
  curl -X POST localhost:8787/agents/file-agent/messages \
276
263
  -H 'content-type: application/json' \
277
- -d '{"sessionId":"s1","message":"Summarize a.txt and b.txt into summary.txt."}'
264
+ -d '{"message":"Summarize a.txt and b.txt into summary.txt."}'
278
265
  ```
279
266
 
280
267
  `customer-service` is the exception here too — a request with no
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "loopengine",
3
- "version": "0.0.6",
3
+ "version": "0.0.10",
4
4
  "type": "module",
5
- "description": "A minimal framework for defining and running tool-using AI agents over CLI, HTTP, or both.",
5
+ "description": "Runtime for tool-using AI agents with a transparent ReAct loop.",
6
6
  "license": "MIT",
7
+ "homepage": "https://loopengine.co",
7
8
  "repository": {
8
9
  "type": "git",
9
10
  "url": "git+https://github.com/evanyan22/loopengine.git"