@electric-ax/agents 0.4.12 → 0.4.13
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/dist/entrypoint.js +126 -63
- package/dist/index.cjs +125 -62
- package/dist/index.d.cts +27 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +126 -63
- package/docs/entities/patterns/blackboard.md +1 -1
- package/docs/entities/patterns/dispatcher.md +3 -3
- package/docs/entities/patterns/manager-worker.md +11 -23
- package/docs/entities/patterns/map-reduce.md +1 -1
- package/docs/entities/patterns/pipeline.md +3 -3
- package/docs/index.md +61 -39
- package/docs/quickstart.md +26 -22
- package/docs/reference/entity-handle.md +51 -25
- package/docs/reference/handler-context.md +1 -1
- package/docs/reference/wake-event.md +1 -1
- package/docs/usage/defining-tools.md +4 -5
- package/docs/usage/overview.md +10 -6
- package/docs/usage/shared-state.md +3 -3
- package/docs/usage/spawning-and-coordinating.md +34 -18
- package/docs/usage/writing-handlers.md +1 -1
- package/docs/walkthrough.md +1156 -0
- package/package.json +4 -3
- package/skills/quickstart/scaffold/package.json +1 -1
- package/skills/quickstart.md +16 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@electric-ax/agents",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.13",
|
|
4
4
|
"description": "Built-in Electric Agents runtimes such as Horton and worker",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"./package.json": "./package.json"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@durable-streams/state": "^0.
|
|
41
|
+
"@durable-streams/state": "^0.3.1",
|
|
42
42
|
"@mariozechner/pi-agent-core": "^0.70.2",
|
|
43
43
|
"@mariozechner/pi-ai": "^0.70.2",
|
|
44
44
|
"@sinclair/typebox": "^0.34.48",
|
|
@@ -47,9 +47,10 @@
|
|
|
47
47
|
"pino": "^10.3.1",
|
|
48
48
|
"pino-pretty": "^13.0.0",
|
|
49
49
|
"sqlite-vec": "^0.1.9",
|
|
50
|
+
"undici": "^7.24.7",
|
|
50
51
|
"zod": "^4.3.6",
|
|
51
52
|
"@electric-ax/agents-mcp": "0.2.2",
|
|
52
|
-
"@electric-ax/agents-runtime": "0.3.
|
|
53
|
+
"@electric-ax/agents-runtime": "0.3.9"
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
55
56
|
"@types/better-sqlite3": "^7.6.13",
|
package/skills/quickstart.md
CHANGED
|
@@ -56,7 +56,7 @@ The handler is **not** a long-running process. It wakes, does its work (usually
|
|
|
56
56
|
|
|
57
57
|
### Spawning Children
|
|
58
58
|
|
|
59
|
-
Any entity can spawn child entities. When a child finishes (and the parent registered `wake: "runFinished"`), the parent's handler runs again. The wake event includes the child's response and the status of sibling children.
|
|
59
|
+
Any entity can spawn child entities. When a child finishes (and the parent registered `wake: { on: "runFinished", includeResponse: true }`), the parent's handler runs again. The wake event includes the child's response and the status of sibling children.
|
|
60
60
|
|
|
61
61
|
### The Worker Entity
|
|
62
62
|
|
|
@@ -184,7 +184,10 @@ function createAnalyzeTool(ctx: HandlerContext) {
|
|
|
184
184
|
'You are an optimist analyst. Provide an enthusiastic, positive analysis focusing on opportunities and benefits.',
|
|
185
185
|
tools: ['bash', 'read'],
|
|
186
186
|
},
|
|
187
|
-
{
|
|
187
|
+
{
|
|
188
|
+
initialMessage: question,
|
|
189
|
+
wake: { on: 'runFinished', includeResponse: true },
|
|
190
|
+
}
|
|
188
191
|
)
|
|
189
192
|
return {
|
|
190
193
|
content: [
|
|
@@ -257,7 +260,10 @@ function createAnalyzeTool(ctx: HandlerContext) {
|
|
|
257
260
|
'worker',
|
|
258
261
|
childId,
|
|
259
262
|
{ systemPrompt: p.systemPrompt, tools: ['bash'] },
|
|
260
|
-
{
|
|
263
|
+
{
|
|
264
|
+
initialMessage: question,
|
|
265
|
+
wake: { on: 'runFinished', includeResponse: true },
|
|
266
|
+
}
|
|
261
267
|
)
|
|
262
268
|
ctx.db.actions.children_insert({
|
|
263
269
|
row: { key: p.id, url: `/worker/${childId}` },
|
|
@@ -524,13 +530,13 @@ After explaining, tell the user to restart with `npm run dev:all` (starts both s
|
|
|
524
530
|
|
|
525
531
|
## What you learned
|
|
526
532
|
|
|
527
|
-
| Step | Concept | API
|
|
528
|
-
| ---- | ----------------------- |
|
|
529
|
-
| 1 | Entity types & handlers | `registry.define()`, `ctx.useAgent()`, `ctx.agent.run()`
|
|
530
|
-
| 2 | Spawning children | `ctx.spawn()`, `wake: 'runFinished'`
|
|
531
|
-
| 3 | State collections | `state: { children: { primaryKey: 'key' } }`
|
|
532
|
-
| 4 | Server routes | `createRuntimeServerClient()`, `client.spawnEntity()`
|
|
533
|
-
| 5 | Live frontend | `createAgentsClient`, `entity()`, `useChat`, streaming text
|
|
533
|
+
| Step | Concept | API |
|
|
534
|
+
| ---- | ----------------------- | ------------------------------------------------------------------- |
|
|
535
|
+
| 1 | Entity types & handlers | `registry.define()`, `ctx.useAgent()`, `ctx.agent.run()` |
|
|
536
|
+
| 2 | Spawning children | `ctx.spawn()`, `wake: { on: 'runFinished', includeResponse: true }` |
|
|
537
|
+
| 3 | State collections | `state: { children: { primaryKey: 'key' } }` |
|
|
538
|
+
| 4 | Server routes | `createRuntimeServerClient()`, `client.spawnEntity()` |
|
|
539
|
+
| 5 | Live frontend | `createAgentsClient`, `entity()`, `useChat`, streaming text |
|
|
534
540
|
|
|
535
541
|
For a complete multi-agent chat app with rooms, agent spawning, and a Slack-style UI, see the [agents-chat-starter](https://github.com/electric-sql/electric/tree/main/examples/agents-chat-starter) example.
|
|
536
542
|
|