glove-foundry 0.7.0 → 0.9.0
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 +80 -4
- package/dist/{chunk-64UBLGYM.js → chunk-CYOIHSUX.js} +131 -7
- package/dist/{chunk-EJZJAVNG.js → chunk-EUGKVW3J.js} +335 -7
- package/dist/{chunk-AC6SRI5V.js → chunk-J6NHL4SM.js} +357 -56
- package/dist/{chunk-EEHGAWXM.js → chunk-L5JQVTHD.js} +4 -0
- package/dist/{chunk-2GXPSIRL.js → chunk-LI7VIGVH.js} +1919 -104
- package/dist/{chunk-IPASF7PK.js → chunk-X3HZYVZS.js} +36 -1
- package/dist/cli.js +4 -4
- package/dist/{client-BgpgsnoO.d.ts → client-CCY4_vqN.d.ts} +95 -55
- package/dist/client.d.ts +2 -2
- package/dist/client.js +1 -1
- package/dist/config.d.ts +7 -0
- package/dist/{event-delivery-BaYe6d9w.d.ts → event-delivery-CNCsVqi8.d.ts} +379 -11
- package/dist/execution-agent.js +1 -1
- package/dist/execution-daemon.js +10 -5
- package/dist/execution-loader.js +256 -18
- package/dist/index.d.ts +17 -6
- package/dist/index.js +114 -15
- package/dist/voice.d.ts +11 -7
- package/dist/voice.js +51 -10
- package/docs/README.md +1 -1
- package/docs/building-with-foundry.md +128 -4
- package/docs/durable-subagents.md +101 -23
- package/docs/execution.md +4 -0
- package/docs/inspector.md +321 -29
- package/package.json +11 -10
- package/templates/travel-concierge/README.md +1 -1
|
@@ -190,6 +190,21 @@ export default defineAgent({
|
|
|
190
190
|
|
|
191
191
|
An agent definition describes lazy assembly. It never declares request input or result output; those are Foundry contracts. An agent definition is also not an instance. Instances are durable data and may be created, updated, removed, or reconstructed independently.
|
|
192
192
|
|
|
193
|
+
### Agents are data
|
|
194
|
+
|
|
195
|
+
A definition is everything a kind of agent can be, like a server-rendered page
|
|
196
|
+
that renders any props. Each agent is an instance, and who it is lives on the
|
|
197
|
+
instance: `name`, `description`, `context`, `installations` and `workspaceId`.
|
|
198
|
+
Write one definition per kind of agent, never one per agent. A person making a
|
|
199
|
+
bot, renaming it or giving it an app is a write (`createAgent`,
|
|
200
|
+
`configureAgent`, `install`), not a deploy. Read names, jobs and per-user
|
|
201
|
+
settings from the instance in resolvers, branch on its data (`context.routines`)
|
|
202
|
+
rather than its id, and let agents change their own data with tools, such as a
|
|
203
|
+
`take_job` tool that writes `name` and `description` with `ctx.data.putAgent`.
|
|
204
|
+
A workspace is a tenant: its agents share workspace entries, and with `mesh` they are peers.
|
|
205
|
+
Add a definition only when a kind of agent runs differently, loads different
|
|
206
|
+
dependencies, or must never have another kind's tools.
|
|
207
|
+
|
|
193
208
|
## Define and compose colocated pieces
|
|
194
209
|
|
|
195
210
|
```ts
|
|
@@ -263,6 +278,65 @@ servers from stalling a run indefinitely.
|
|
|
263
278
|
Stdio-only idle and lifetime limits can recycle memory-heavy children without
|
|
264
279
|
interrupting in-flight calls; adapter environment values are resolved again on reopen.
|
|
265
280
|
|
|
281
|
+
### Apps people connect
|
|
282
|
+
|
|
283
|
+
When a person connects one of their own accounts (their Gmail, their Linear),
|
|
284
|
+
connect it through an app, not a bare MCP definition. The app is the unit they
|
|
285
|
+
connect, and it holds everything about that provider: the MCP server whose
|
|
286
|
+
tools the agent uses, the account they open with, the transmissions that carry
|
|
287
|
+
events in and deliveries out, and the connection that listens.
|
|
288
|
+
|
|
289
|
+
```ts
|
|
290
|
+
// agents/assistant/apps/gmail.app.ts
|
|
291
|
+
export default defineApp({
|
|
292
|
+
description: "Gmail: search, read and draft, send with approval, hear about new mail",
|
|
293
|
+
config: z.object({ alwaysAllow: z.array(z.string()).default([]) }),
|
|
294
|
+
inbound: [gmail], // new mail, as events
|
|
295
|
+
outbound: [gmail], // sending, delivered by Foundry
|
|
296
|
+
connections: [gmailWatch], // users.watch + Pub/Sub, one per account
|
|
297
|
+
mcp: {
|
|
298
|
+
entry: { name: "Gmail", url: "https://gmailmcp.googleapis.com/mcp/v1" },
|
|
299
|
+
// Runs inside the agent's accountSessions; Foundry never holds the token.
|
|
300
|
+
auth: (session) => ({ authorization: `Bearer ${(session as GoogleSession).accessToken}` }),
|
|
301
|
+
// "allow", "ask" or "hide" per tool. Default: read-only tools run, the rest ask.
|
|
302
|
+
tools: (tool, { config }) =>
|
|
303
|
+
tool.readOnly || config.alwaysAllow.includes(tool.name) ? "allow" : "ask",
|
|
304
|
+
},
|
|
305
|
+
})
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
Install it with the person's account: `install(gmailApp, config, { account })`
|
|
309
|
+
in code, or `{ kind: "application", id: "gmail", accountId }` over HTTP. The
|
|
310
|
+
server's tools mount as `gmail__search_threads` and so on, opened with that
|
|
311
|
+
account; a stdio server gets `auth`'s result as its environment instead. An app
|
|
312
|
+
whose `mcp` has `auth` refuses an installation without an account, and its
|
|
313
|
+
connection closes when the run ends.
|
|
314
|
+
|
|
315
|
+
Splitting the work this way keeps each part where it is safest:
|
|
316
|
+
|
|
317
|
+
- **Reads and drafts** come from the provider's MCP server, through the app's
|
|
318
|
+
tool policy.
|
|
319
|
+
- **Sends** belong in an outbound transmission when the provider's server has
|
|
320
|
+
none or when the send should not run in the agent: Foundry delivers it in its
|
|
321
|
+
own process, with the route's account session, after the exact input is
|
|
322
|
+
approved, and only for a run whose bindings grant the route.
|
|
323
|
+
- **Incoming events** (new mail, a webhook) are an inbound transmission. A
|
|
324
|
+
connection keeps the provider subscription alive per account; a playbook on
|
|
325
|
+
the instance decides which agent hears them.
|
|
326
|
+
|
|
327
|
+
An app that is only an MCP server (Linear's, Google Calendar's) needs only
|
|
328
|
+
`mcp`. Accounts belong to your application: your OAuth callback stores the
|
|
329
|
+
account and its tokens, your `accountSessions` resolves and refreshes them,
|
|
330
|
+
and Foundry reads accounts through your account directory (see "Runtime
|
|
331
|
+
topology is data").
|
|
332
|
+
|
|
333
|
+
An agent can put its own policy around an app's generated send in
|
|
334
|
+
`configure(agent, ctx)`: replace the tool with one whose `requiresPermission`
|
|
335
|
+
applies the person's rules and whose `do` calls the original tool's `run`.
|
|
336
|
+
Glove asks for approval from the tool the model calls, so the wrapper's rule
|
|
337
|
+
is the one that counts, and delivery still happens in Foundry's process.
|
|
338
|
+
`configure` sees the instance, its conversation and the data adapter.
|
|
339
|
+
|
|
266
340
|
## Mount optional capabilities
|
|
267
341
|
|
|
268
342
|
Use `configure(agent, context)` to call capability packages' mount functions on the assembled agent. Register resource teardown with `context.onCleanup(() => handle.close())`; callbacks run in reverse order after execution, including failed setup or cancellation. Register cleanup as soon as you acquire a resource, before any later setup can fail.
|
|
@@ -344,6 +418,21 @@ export default defineAgent({
|
|
|
344
418
|
|
|
345
419
|
`workingEnvironment` and `repl` accept the same direct-value-or-lazy-resolver shape as the other assembly fields. JavaScript, Python, and Lisp sessions are supported through one discriminated `defineRepl` API. Foundry exposes the mounted `workingEnvironment`, its guarded `vfs` handle, and the native `repl` session to layers, `configure`, calls, and `run` handlers.
|
|
346
420
|
|
|
421
|
+
Installed apps arrive grouped. `select` receives `apps`, one entry per
|
|
422
|
+
installed app with its live tools already named for code, grouped under the
|
|
423
|
+
app and marked read-only where the server says so. Selecting an app's reads
|
|
424
|
+
gives the agent `gmail.search_threads(...)` and `linear.list_issues(...)` in one
|
|
425
|
+
program. `keepDirect: false` takes the selected tools out of the model's direct
|
|
426
|
+
tool list, so a large app catalogue stays out of context; a tool that needs
|
|
427
|
+
approval always stays direct.
|
|
428
|
+
|
|
429
|
+
```ts
|
|
430
|
+
programmaticTools: {
|
|
431
|
+
select: ({ apps }) => apps.flatMap((app) => app.tools.filter((tool) => tool.readOnly)),
|
|
432
|
+
keepDirect: false,
|
|
433
|
+
}
|
|
434
|
+
```
|
|
435
|
+
|
|
347
436
|
`programmaticTools` turns an explicit least-privilege projection of the live
|
|
348
437
|
agent tool registry into functions inside that sandbox. The selector runs after
|
|
349
438
|
application transmissions, instance-installed tools and MCPs, calls, memory,
|
|
@@ -547,6 +636,28 @@ export const ticketInbound = defineInboundRoute({
|
|
|
547
636
|
|
|
548
637
|
`accessRef` is opaque to Foundry. Credential acquisition and refresh belong to the user-owned account-session adapter.
|
|
549
638
|
|
|
639
|
+
Foundry never creates accounts. When people connect accounts at runtime, keep
|
|
640
|
+
them in your own store and give Foundry a read-only `AccountDirectory` over it.
|
|
641
|
+
Supplying `services` replaces `defineApplication({ accounts })`, so list any
|
|
642
|
+
code-defined accounts in your directory too. Routes and bindings you write when
|
|
643
|
+
someone connects (`putRoute`, `putBinding`) live in the topology store; on a
|
|
644
|
+
single host, `fileTopologyStore(file)` keeps them across restarts.
|
|
645
|
+
|
|
646
|
+
```ts
|
|
647
|
+
export default defineApplication({
|
|
648
|
+
name: "Assistants",
|
|
649
|
+
data,
|
|
650
|
+
services: Layer.mergeAll(
|
|
651
|
+
myAccountDirectory, // reads your accounts table
|
|
652
|
+
fileTopologyStore(join(dataDir, "topology.json")),
|
|
653
|
+
memoryEventStore,
|
|
654
|
+
),
|
|
655
|
+
})
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
Application connections find their account through that directory, so a newly
|
|
659
|
+
connected account starts its connection on the next reconciliation.
|
|
660
|
+
|
|
550
661
|
## Runtime-composed playbooks and dynamic installations
|
|
551
662
|
|
|
552
663
|
```ts
|
|
@@ -629,6 +740,10 @@ glove_foundry_schedule({
|
|
|
629
740
|
timing: { kind: "every", interval: "24h" },
|
|
630
741
|
})
|
|
631
742
|
|
|
743
|
+
// Deliver through an outbound route this instance's playbooks declare.
|
|
744
|
+
// It asks for approval whenever the route's transmission requires it:
|
|
745
|
+
glove_foundry_transmit({ routeId: "support-replies", payload: { message: "Done." } })
|
|
746
|
+
|
|
632
747
|
// Suspend this conversation and wake the same instance later:
|
|
633
748
|
glove_foundry_sleep({
|
|
634
749
|
kind: "for",
|
|
@@ -698,9 +813,13 @@ during active work through the typed steering operation.
|
|
|
698
813
|
## Effect approvals
|
|
699
814
|
|
|
700
815
|
A Glove tool can set `requiresPermission: true` or return a boolean from
|
|
701
|
-
`requiresPermission(input)`. In Foundry, an unset decision becomes a
|
|
702
|
-
|
|
703
|
-
|
|
816
|
+
`requiresPermission(input)`. In Foundry, an unset decision becomes a stored
|
|
817
|
+
approval record rather than an unresolved in-process display promise. The worker
|
|
818
|
+
waits `approvals.waitMs` (60 s); if nobody decides, the run suspends at that call
|
|
819
|
+
and the approval stays open (7 days, through restarts). A trusted host lists and
|
|
820
|
+
resolves the exact request, or opens one by id from a link
|
|
821
|
+
(`client.approval(id)`); a decision after the run suspended resumes the
|
|
822
|
+
conversation at the waiting call:
|
|
704
823
|
|
|
705
824
|
```ts
|
|
706
825
|
const [approval] = await client.approvals({
|
|
@@ -744,7 +863,9 @@ tool with `requiresPermission` off the call, because a realtime session runs
|
|
|
744
863
|
tools directly and would skip the approval. A delegation result that arrives
|
|
745
864
|
after the caller hangs up runs as an ordinary turn (`source.kind` is
|
|
746
865
|
`"delegation"`); by default `voiceCall` saves it to the conversation, or pass
|
|
747
|
-
`offCall` to handle it, for instance with a text model.
|
|
866
|
+
`offCall` to handle it, for instance with a text model. A call's agent on the
|
|
867
|
+
hosted mesh hears messages from its peers the same way (`announceMeshMessage`,
|
|
868
|
+
or your own `announce`); one that arrives after the call is a `"mesh"` turn.
|
|
748
869
|
|
|
749
870
|
Use `glove-voice-s2s` for Gemini Live, OpenAI Realtime, or GPT-Live and `glove-voice` for a
|
|
750
871
|
speech-to-text / Glove / text-to-speech pipeline.
|
|
@@ -793,13 +914,16 @@ run cleanup. See the [document adapter](../../glove-env-documents/README.md).
|
|
|
793
914
|
- IDs appear when definitions are serialized into durable data.
|
|
794
915
|
- Runtime data IDs remain explicit because users and adapters create those records.
|
|
795
916
|
- Applications, shared tools, and MCPs mount only when an instance installs them.
|
|
917
|
+
- A person's accounts connect through apps: MCP for tools, transmissions for sends and events, connections for subscriptions, your own account directory and `accountSessions` for credentials.
|
|
796
918
|
- Memory and inboxes are agent-definition surfaces and may resolve from current context/message.
|
|
797
919
|
- Working environments and one native REPL are agent-definition surfaces and may resolve from current context/message.
|
|
798
920
|
- VFS persistence, remote storage, and locking remain adapter-owned.
|
|
799
921
|
- Transmissions own executable integration logic; playbooks remain serializable policy.
|
|
800
922
|
- Provider adapters own credential acquisition and refresh.
|
|
801
923
|
- Voice rooms own audio transport; `voiceCall` owns the session and the transcript; Foundry owns the durable run.
|
|
924
|
+
- A definition is what a kind of agent can be; each agent, its name and its job are instance data.
|
|
802
925
|
- Interactors keep the person's context; workers keep one task's. Delegation results and questions come back to the conversation that delegated.
|
|
926
|
+
- Agents that already exist as peers in one workspace can message each other on the hosted mesh. Replies come back to the conversation that sent the message.
|
|
803
927
|
|
|
804
928
|
## Durable subagents
|
|
805
929
|
|
|
@@ -1,24 +1,54 @@
|
|
|
1
1
|
# Durable subagents
|
|
2
2
|
|
|
3
|
-
A durable subagent is
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
A durable subagent is an agent instance owned by another agent instance. Declare a
|
|
4
|
+
named worker in `defineAgent`; Foundry creates it on first use and keeps its identity,
|
|
5
|
+
conversations and owned data available for future work.
|
|
6
|
+
|
|
7
|
+
Use durable subagents when one agent needs several intelligent workers with separate
|
|
8
|
+
responsibilities. Each can have its own model, instructions, tools, memory access and
|
|
9
|
+
run budget, handle many tasks over time, receive events independently, and own further
|
|
10
|
+
workers. The parent can keep serving requests while that work proceeds. This applies
|
|
11
|
+
to chat agents, background services, scheduled work and systems with no conversational
|
|
12
|
+
front. A realtime front is one possible consumer of the same primitives.
|
|
13
|
+
|
|
14
|
+
## What exists in code and storage
|
|
15
|
+
|
|
16
|
+
| Concept | Meaning |
|
|
17
|
+
| --- | --- |
|
|
18
|
+
| Worker definition | A normal `defineAgent` value describing a model, instructions and capabilities. Several slots or parents can reuse it. |
|
|
19
|
+
| Named slot | A key in `durableSubagents`, with a worker definition, inheritance selections and delivery defaults. |
|
|
20
|
+
| Owned worker instance | One persisted agent for a particular parent instance and slot name, with its own instance ID in the parent's workspace. |
|
|
21
|
+
| Conversation | A context owned by that worker. Its default event conversation and individual delegated-task conversations are separate. |
|
|
22
|
+
| Run | An execution assembled to process work in a conversation. The same worker instance can be used by many runs. |
|
|
23
|
+
|
|
24
|
+
Two parent instances using the same definition get different workers. Two slots on
|
|
25
|
+
one parent get different workers even when they reuse the same definition. Reusing a
|
|
26
|
+
definition does not adopt an unrelated existing instance.
|
|
27
|
+
|
|
28
|
+
The identity and stored state are durable. A worker does not need a continuously
|
|
29
|
+
running JavaScript process or model session. Foundry assembles it again for each run;
|
|
30
|
+
an idle worker does not occupy an execution slot just to exist.
|
|
31
|
+
|
|
32
|
+
## Declare the relationship
|
|
33
|
+
|
|
34
|
+
Keep workers as ordinary agent definitions, then select them in the parent. An inline
|
|
35
|
+
`defineAgent` value works too. Models and persistence adapters use normal Foundry
|
|
36
|
+
configuration; there is no separate worker harness to construct.
|
|
7
37
|
|
|
8
38
|
```ts
|
|
9
39
|
import { defineAgent, restrictApp } from "glove-foundry";
|
|
10
|
-
import
|
|
40
|
+
import worker from "../worker/agent.js";
|
|
11
41
|
import knowledgeBase from "./apps/knowledge-base.app.js";
|
|
12
42
|
import { components } from "./composition.js";
|
|
13
43
|
|
|
14
44
|
export default defineAgent({
|
|
15
|
-
description: "
|
|
45
|
+
description: "Coordinate requests and independent workers",
|
|
16
46
|
model: fastModel,
|
|
17
47
|
systemPrompt: "Help the user and coordinate your workers.",
|
|
18
48
|
components,
|
|
19
49
|
durableSubagents: {
|
|
20
|
-
|
|
21
|
-
agent:
|
|
50
|
+
analysis: {
|
|
51
|
+
agent: worker,
|
|
22
52
|
eventDelivery: { whenIdle: "wake" },
|
|
23
53
|
inherit: {
|
|
24
54
|
context: true,
|
|
@@ -50,22 +80,52 @@ export default defineAgent({
|
|
|
50
80
|
|
|
51
81
|
Imported definitions and inline `defineAgent` values work, including nested workers.
|
|
52
82
|
Definitions remain immutable. Discovery derives a route such as
|
|
53
|
-
`
|
|
83
|
+
`coordinator/workers/analysis`; `workers` inside a route is reserved for this purpose.
|
|
54
84
|
Names must be lowercase slugs; `parent` is reserved. Cycles and route collisions fail
|
|
55
85
|
discovery. Declare these relationships statically; ordinary assembly fields remain lazy.
|
|
56
86
|
|
|
57
|
-
##
|
|
87
|
+
## Provisioning and reuse
|
|
88
|
+
|
|
89
|
+
Declaring a slot makes a worker available; it does not create every possible instance
|
|
90
|
+
at startup. A first message or delegated task atomically provisions the owned worker.
|
|
91
|
+
An application can also ensure one explicitly:
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
import { createFoundryClient } from "glove-foundry/client";
|
|
95
|
+
|
|
96
|
+
const client = createFoundryClient({ baseUrl: process.env.FOUNDRY_URL! });
|
|
97
|
+
const parent = await client.agent("coordinator").create({ workspaceId: "workspace-a" });
|
|
98
|
+
const worker = client.subagent(parent.id, "analysis"); // handle only; no request yet
|
|
99
|
+
const instance = await worker.ensure(); // create once or return the existing instance
|
|
100
|
+
await worker.send("Review the current plan."); // also ensures the worker if needed
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The ownership key is the parent instance ID plus the slot name. New messages, tasks
|
|
104
|
+
and controller restarts reuse that instance when the data adapter is persistent.
|
|
105
|
+
Ensuring a worker does not start a model run. Listing and inspection do not provision
|
|
106
|
+
or reactivate workers. A new parent gets new workers; changing a slot name identifies
|
|
107
|
+
a different worker rather than renaming its stored instance.
|
|
108
|
+
|
|
109
|
+
## Direct messages and task delegation
|
|
110
|
+
|
|
111
|
+
A durable worker is a place to send work over time. Task delegation adds an assignment,
|
|
112
|
+
clarification questions, task status and a correlated final result to that independent
|
|
113
|
+
lifetime. Direct messages communicate facts, priority changes or spontaneous findings
|
|
114
|
+
without creating a tracked task. Both use the same addressed event-delivery layer.
|
|
58
115
|
|
|
59
|
-
|
|
60
|
-
`glove_foundry_delegate({ to: "
|
|
61
|
-
|
|
116
|
+
Calls to
|
|
117
|
+
`glove_foundry_delegate({ to: "analysis", task: "Write a report" })` use the owned
|
|
118
|
+
worker. Existing `delegates` continue to work. A durable name takes precedence
|
|
62
119
|
when it also names a sibling delegate. Each task gets a separate conversation;
|
|
63
120
|
its final result and questions return to the originating parent conversation.
|
|
64
121
|
|
|
65
|
-
`glove_foundry_message({ to: "
|
|
122
|
+
`glove_foundry_message({ to: "analysis", message: "Watch this competitor" })`
|
|
66
123
|
sends a spontaneous message without creating a task. The worker can send
|
|
67
124
|
`glove_foundry_message({ to: "parent", message: "Something changed" })` at any time.
|
|
68
|
-
|
|
125
|
+
An instance ID identifies the worker; a conversation ID identifies the particular
|
|
126
|
+
context in which it processes an event. By default messages address a stable event
|
|
127
|
+
conversation belonging to the recipient. They do not automatically enter an active
|
|
128
|
+
task or the latest parent chat. Supply
|
|
69
129
|
`delivery.conversationId` to address an existing conversation explicitly. Foundry
|
|
70
130
|
validates that it belongs to the recipient and shares its workspace; it never guesses
|
|
71
131
|
the latest chat. The model tool accepts only declared children and the actual parent.
|
|
@@ -75,7 +135,7 @@ reply. There is no automatic reply loop.
|
|
|
75
135
|
|
|
76
136
|
```ts
|
|
77
137
|
await worker.send("Include these three companies.", {
|
|
78
|
-
id: "
|
|
138
|
+
id: "analysis-update-42", // stable across retries
|
|
79
139
|
conversationId: reportConversationId,
|
|
80
140
|
whenIdle: "defer", // join the next turn
|
|
81
141
|
deferTimeoutMs: 30_000, // or wake after 30 seconds
|
|
@@ -84,7 +144,7 @@ await worker.send("Include these three companies.", {
|
|
|
84
144
|
|
|
85
145
|
// The same layer supports direct addressed events from an application.
|
|
86
146
|
await client.emitEvent(
|
|
87
|
-
{ agentId:
|
|
147
|
+
{ agentId: workerId, conversationId: reportConversationId },
|
|
88
148
|
{ id: "source-change-42", source: "app:watcher", kind: "source.changed", content: "The source changed." },
|
|
89
149
|
{ whenIdle: "wake" },
|
|
90
150
|
);
|
|
@@ -96,13 +156,17 @@ await messageTool.run({
|
|
|
96
156
|
});
|
|
97
157
|
```
|
|
98
158
|
|
|
159
|
+
## Delivery policies
|
|
160
|
+
|
|
99
161
|
`defineAgent({ eventDelivery })` sets the recipient's default policy; a durable slot
|
|
100
|
-
can
|
|
101
|
-
|
|
162
|
+
can replace that default object with `durableSubagents.analysis.eventDelivery`. Each
|
|
163
|
+
send can override fields of the effective policy. The default is `whenIdle: "wake"`.
|
|
164
|
+
`defer` with no effective timeout waits
|
|
102
165
|
for another turn; with `deferTimeoutMs`, the original acceptance time determines the
|
|
103
166
|
wake deadline, including across restarts. `expiresAt` discards stale events before
|
|
104
|
-
injection. Policies affect idle
|
|
105
|
-
native event boundary.
|
|
167
|
+
injection. Policies affect idle conversations; events sent to a conversation with a
|
|
168
|
+
live run join its next native event boundary. Different conversations can run
|
|
169
|
+
independently within execution limits. A waking event can carry other deferred events into the same
|
|
106
170
|
turn. These are deterministic controller policies; they do not infer user presence.
|
|
107
171
|
|
|
108
172
|
The message tool waits for durable acceptance, not for the recipient's answer.
|
|
@@ -156,6 +220,12 @@ application `conversationStore` (or worker `store`) for transcripts. Instance an
|
|
|
156
220
|
message persistence does not itself persist native Glove transcripts, memory, or
|
|
157
221
|
external files. These keep their existing Foundry persistence boundaries.
|
|
158
222
|
|
|
223
|
+
## Execution budgets and responsiveness
|
|
224
|
+
|
|
225
|
+
A worker's run is independent of the run that delegated to it. A parent can finish a
|
|
226
|
+
request while the worker continues; a question or result can later wake the originating
|
|
227
|
+
parent conversation. Models and run budgets can be chosen separately for each role.
|
|
228
|
+
|
|
159
229
|
`runTimeoutMs` sets a definition's run deadline; the existing default remains five
|
|
160
230
|
minutes. `maxConcurrentRuns` limits that definition's simultaneous runs. Set runtime
|
|
161
231
|
`execution.maxConcurrent` above the combined background limits to leave slots for
|
|
@@ -210,11 +280,11 @@ instead of bypassing it with process-global credentials.
|
|
|
210
280
|
## Management and retention
|
|
211
281
|
|
|
212
282
|
```ts
|
|
213
|
-
const worker = client.subagent(
|
|
283
|
+
const worker = client.subagent(parentId, "analysis");
|
|
214
284
|
const instance = await worker.ensure();
|
|
215
285
|
await worker.send("Include these three companies.");
|
|
216
286
|
const state = await worker.data();
|
|
217
|
-
const children = await client.subagents(
|
|
287
|
+
const children = await client.subagents(parentId);
|
|
218
288
|
await worker.archive();
|
|
219
289
|
await worker.resume();
|
|
220
290
|
await worker.archive();
|
|
@@ -257,3 +327,11 @@ manage its lifecycle. The runtime exposes matching `subagent`, `listSubagents`,
|
|
|
257
327
|
`POST /api/events` accepts `{ target: { agentId, conversationId }, event, policy? }`,
|
|
258
328
|
matching `runtime.emitEvent` and `client.emitEvent`. It uses the same application
|
|
259
329
|
request authorization as the rest of the HTTP API.
|
|
330
|
+
|
|
331
|
+
## Complete worked example
|
|
332
|
+
|
|
333
|
+
The [realtime front and durable researcher walkthrough](https://glove.dterminal.net/foundry/docs/durable-subagents/realtime-example)
|
|
334
|
+
applies these primitives in a runnable project with persistent stores, memory/app
|
|
335
|
+
inheritance, direct messages, task delegation, delivery policies and restart checks.
|
|
336
|
+
Source: `examples/foundry-durable-research`. The ownership and delivery model above
|
|
337
|
+
applies regardless of how the agents receive work.
|
package/docs/execution.md
CHANGED
|
@@ -61,6 +61,10 @@ Foundry stops Station and its resource adapters on shutdown, and cleans up on fa
|
|
|
61
61
|
|
|
62
62
|
Programmatic `FoundryRuntime.discover` calls using a daemon adapter must supply `applicationFilePath`; closures are loaded in the child process, never serialized from the parent. Each Foundry runtime owns its Station instance. A fixed port must be unique per instance; omitting it avoids manual port allocation.
|
|
63
63
|
|
|
64
|
+
## Kuiper's browsers and sandboxes, without a daemon
|
|
65
|
+
|
|
66
|
+
On [Kuiper](https://kuiper.sh), `glove-execution/kuiper` mounts Kuiper's browsers (real Chrome) and sandboxes through `@kuiper-sh/sdk`: `kuiperBrowser({ browsers: kuiper.browsers, … })` and `kuiperSandbox({ sandboxes: kuiper.sandboxes, … })`. They need no `stationDaemon`. A Kuiper session or sandbox belongs to the project rather than the process, so each run mounts it in `configure`, and the next run reconnects by the IDs the application kept, usually on the agent instance. The browser adapter takes a `guard` that sees every request the browser makes, and an `onHandOff` that gives a person Kuiper's live view for a sign-in. See the [glove-execution README](../../glove-execution/README.md#kuiper) and the personal-agent example.
|
|
67
|
+
|
|
64
68
|
## Optional capability mounts
|
|
65
69
|
|
|
66
70
|
Browser and sandbox support is opt-in through `glove-execution`. Neither `glove-core` nor Foundry depends on that package. Use the same explicit mounting pattern as other Glove extensions, inside Foundry's existing `configure` hook:
|