@lloyal-labs/lloyal-agents 1.1.0 → 1.2.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.
Files changed (44) hide show
  1. package/README.md +28 -50
  2. package/dist/agent-pool.d.ts +4 -7
  3. package/dist/agent-pool.d.ts.map +1 -1
  4. package/dist/agent-pool.js +101 -9
  5. package/dist/agent-pool.js.map +1 -1
  6. package/dist/context.d.ts +32 -1
  7. package/dist/context.d.ts.map +1 -1
  8. package/dist/context.js +31 -1
  9. package/dist/context.js.map +1 -1
  10. package/dist/generate.d.ts +20 -5
  11. package/dist/generate.d.ts.map +1 -1
  12. package/dist/generate.js +80 -9
  13. package/dist/generate.js.map +1 -1
  14. package/dist/index.d.ts +6 -1
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +11 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/init.d.ts +4 -1
  19. package/dist/init.d.ts.map +1 -1
  20. package/dist/init.js +5 -1
  21. package/dist/init.js.map +1 -1
  22. package/dist/shared-root.d.ts +3 -3
  23. package/dist/shared-root.d.ts.map +1 -1
  24. package/dist/shared-root.js +66 -5
  25. package/dist/shared-root.js.map +1 -1
  26. package/dist/source.d.ts +27 -0
  27. package/dist/source.d.ts.map +1 -0
  28. package/dist/source.js +25 -0
  29. package/dist/source.js.map +1 -0
  30. package/dist/trace-scope.d.ts +25 -0
  31. package/dist/trace-scope.d.ts.map +1 -0
  32. package/dist/trace-scope.js +41 -0
  33. package/dist/trace-scope.js.map +1 -0
  34. package/dist/trace-types.d.ts +178 -0
  35. package/dist/trace-types.d.ts.map +1 -0
  36. package/dist/trace-types.js +3 -0
  37. package/dist/trace-types.js.map +1 -0
  38. package/dist/trace-writer.d.ts +58 -0
  39. package/dist/trace-writer.d.ts.map +1 -0
  40. package/dist/trace-writer.js +56 -0
  41. package/dist/trace-writer.js.map +1 -0
  42. package/dist/types.d.ts +6 -0
  43. package/dist/types.d.ts.map +1 -1
  44. package/package.json +1 -1
package/README.md CHANGED
@@ -1,20 +1,21 @@
1
1
  # @lloyal-labs/lloyal-agents
2
2
 
3
- Structured concurrency agent runtime for the lloyal inference platform.
3
+ Continuous Context agent runtime.
4
4
 
5
- `lloyal-agents` runs multi-agent inference inside the decode loop. Agents are branches of a single running process — forked from shared KV cache state, advancing through one GPU forward pass per tick, spawning sub-agents from their own live branches at arbitrary depth. Orchestration is not a layer above inference. It is inference.
5
+ `lloyal-agents` runs multi-agent inference inside the decode loop. Instead of N independent model calls rebuilding the prompt each step, all agents advance inside one continuous decode process — forked from shared KV cache state, driven through a single GPU forward pass per tick, spawning sub-agents from their own live branches at arbitrary depth.
6
6
 
7
- ```bash
8
- npm i @lloyal-labs/lloyal-agents
9
- ```
10
-
11
- **Backends:** [lloyal.node](https://github.com/lloyal-ai/lloyal.node) — prebuilt binaries for macOS (Metal, CPU), Linux (CPU, CUDA, Vulkan), and Windows (CPU, CUDA, Vulkan). GPU selection at runtime.
7
+ Built on [lloyal.node](https://github.com/lloyal-ai/lloyal.node), which provides forkable decode state and continuous tree batching over llama.cpp. `lloyal-agents` adds structured concurrency, tool dispatch, and a four-phase tick loop. Orchestration is not a layer above inference. It is inference.
12
8
 
13
- ## Generation as the Primitive
9
+ <picture>
10
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/lloyal-ai/sdk/main/assets/continuous-context-dark.svg">
11
+ <img src="https://raw.githubusercontent.com/lloyal-ai/sdk/main/assets/continuous-context.svg" alt="Traditional Agents vs Continuous Context Agents — shared KV prefix, tool prefill, sub-agent spawning" width="100%">
12
+ </picture>
14
13
 
15
- The core architectural decision: generation is the primitive, not the API call. Agents are not processes that exchange messages. They are branches of a running inference process — forked from shared KV cache state, generating independently, their outputs comparable because they share a computational origin.
14
+ ```bash
15
+ npm i @lloyal-labs/lloyal-agents @lloyal-labs/lloyal.node
16
+ ```
16
17
 
17
- This is built on [lloyal.node](https://github.com/lloyal-ai/lloyal.node), which provides forkable decode state and continuous tree batching over llama.cpp. `lloyal-agents` adds structured concurrency, tool dispatch, and a three-phase tick loop that drives N branches through a single GPU forward pass per step.
18
+ `lloyal-agents` provides the agent runtime. [`lloyal.node`](https://github.com/lloyal-ai/lloyal.node) provides the native inference backend prebuilt binaries for macOS (Metal, CPU), Linux (CPU, CUDA, Vulkan), and Windows (CPU, CUDA, Vulkan). Both are required. GPU selection at runtime.
18
19
 
19
20
  The public API surface:
20
21
 
@@ -91,7 +92,7 @@ yield *
91
92
 
92
93
  ## In-Loop Orchestration
93
94
 
94
- All active agents advance together in a three-phase tick loop:
95
+ All active agents advance together in a four-phase tick loop:
95
96
 
96
97
  **PRODUCE.** Every generating agent calls `produceSync()` — synchronous sampling with no async gap between agents. This matters because it means the entire produce phase is a single uninterrupted pass over the active set.
97
98
 
@@ -99,6 +100,8 @@ All active agents advance together in a three-phase tick loop:
99
100
 
100
101
  **SETTLE.** Tool results that resolved during COMMIT are drained from a buffer. Each result is tokenized into a delta, budget-checked against a fresh `ContextPressure` snapshot, and batch-prefilled into the agent's branch. Grammar state resets. The agent transitions back to `generating`.
101
102
 
103
+ **DISPATCH.** Tool calls collected during PRODUCE are executed sequentially via `scoped()` + `call()`. Each tool runs to completion before the next begins — no concurrent `llama_decode` during dispatch. Tools return `Operation<unknown>`, so they can `yield*` into framework primitives like `useAgentPool` or `runAgents`, spawning recursive sub-agents within the calling agent's scope.
104
+
102
105
  ```typescript
103
106
  // From the tick loop — Phase 1
104
107
  const entries: [Branch, number][] = [];
@@ -122,7 +125,7 @@ if (entries.length > 0) {
122
125
  }
123
126
  ```
124
127
 
125
- When no agent is generating and tools are still pending, the loop parks itself via `action()` — an Effection primitive that suspends the generator until a tool resolves and calls `wakeIdle()`. No polling. No sleep loops.
128
+ When no agent is generating and tools are still pending, the loop yields control until the next tool resolves. No polling. No sleep loops.
126
129
 
127
130
  ## Structured Concurrency DAG
128
131
 
@@ -140,40 +143,15 @@ function* setupAgent(parent, task, ctx) {
140
143
  }
141
144
  ```
142
145
 
143
- If the scope exits — error, cancellation, normal completion — the branch is pruned. Orphaned branches are structurally impossible. Tool dispatch uses `scope.run()` for eager start inside the agent pool scope; if the scope tears down, pending tools are cancelled. The DAG is not imposed on the orchestration. It is intrinsic to the Effection task tree.
146
+ If the scope exits — error, cancellation, normal completion — the branch is pruned. Orphaned branches are structurally impossible. Tool dispatch uses `scoped()` + `call()` each tool executes inside a scoped error boundary within the agent pool scope. If the scope tears down, pending tools are cancelled. The DAG is not imposed on the orchestration. It is intrinsic to the Effection task tree.
144
147
 
145
148
  `useAgentPool` is an Effection `resource()` — it suspends via `provide()` after all agents complete, but keeps their branches alive. The caller can fork sub-agents from any completed agent's branch. Those sub-agents inherit the parent agent's full KV state — everything it generated, every tool result it consumed, every reasoning step it took. No summarization. No context window management. The sub-agent continues from the parent's frontier.
146
149
 
147
- The deep-research harness ships a concrete example: `reportPass`. Research agents run through the tick loop with tools search, grep, read_file, report. Some agents get hard-cut by context pressure before they can submit findings. Rather than losing their work, the harness forks a sub-agent from each hard-cut agent's branch with a constrained tool set (report only):
150
+ Recursive agents work at two levels. At the **harness level**, a completed pool's branches can be forked into follow-up pools — sub-agents inherit the parent's full KV state and continue from the fork point. At the **model level**, a tool's `execute()` method returns `Operation<unknown>`, so it can `yield*` directly into `useAgentPool` or `runAgents`. An agent that calls such a tool spawns sub-agents mid-generation inside its own scope, inheriting its KV state, with cleanup guaranteed by structured concurrency.
148
151
 
149
- ```typescript
150
- function* reportPass(pool: AgentPoolResult, opts: WorkflowOpts) {
151
- const hardCut = pool.agents.filter((a) => !a.findings && !a.branch.disposed);
152
- if (hardCut.length === 0) return;
153
-
154
- const reporters = yield* runAgents({
155
- tasks: hardCut.map((a) => ({
156
- systemPrompt: REPORT_PROMPT,
157
- content: "Report your findings.",
158
- tools: reportOnlyTools,
159
- parent: a.branch, // fork from the parent agent's branch
160
- })),
161
- tools: new Map([["report", reportTool]]),
162
- terminalTool: "report",
163
- });
152
+ In both cases, the sub-agent sees everything the parent saw — system prompt, tool calls, partial reasoning — because that state is already in the KV cache at the fork point. No summarization. No context reconstruction. The sub-agent just continues from the parent's frontier.
164
153
 
165
- hardCut.forEach((a, i) => {
166
- if (reporters.agents[i]?.findings)
167
- a.findings = reporters.agents[i].findings;
168
- });
169
- }
170
- ```
171
-
172
- The sub-agent sees everything the parent saw — its system prompt, its tool calls, its partial reasoning — because that state is already in the KV cache at the fork point. The sub-agent just continues from where the parent was cut off, with a tighter mandate.
173
-
174
- This is the DAG in practice: parent agents form the first level, reporter sub-agents form the second. `runAgents` wraps `useAgentPool` in `scoped()`, so the reporter branches are pruned when it returns. The parent branches are still alive in the outer scope. When that outer scope exits, every `ensure()` callback fires and prunes the parents. Teardown propagates top-down. Cleanup is guaranteed bottom-up.
175
-
176
- There is nothing in the framework that limits this to two levels. Agents can spawn sub-agents that spawn sub-agents. An agent pool can run inside another agent pool's scope. The structured concurrency guarantees compose at every depth.
154
+ There is nothing in the framework that limits depth. Agents can spawn sub-agents that spawn sub-agents. An agent pool can run inside another agent pool's scope. The structured concurrency guarantees compose at every level.
177
155
 
178
156
  ## Hallucination Detection
179
157
 
@@ -198,19 +176,15 @@ const result =
198
176
  // Losers already pruned. Winner's branch is caller's responsibility.
199
177
  ```
200
178
 
201
- The harness decides how to compare. The deep-research example measures semantic equivalence across diverge outputs using bigram Jaccard similarity where branches agree, the model is confident; where they diverge, hallucination risk is high. No model call required for the comparison itself. Other harnesses can use different equivalence measures over the same `diverge()` primitive.
179
+ The harness decides how to compare. `diverge()` returns all outputs with their perplexity scores the harness can apply any equivalence measure: bigram overlap, embedding similarity, or model-based evaluation. Where branches agree, the model is confident; where they diverge, hallucination risk is high.
202
180
 
203
181
  This directly operationalizes the semantic entropy work from Farquhar et al. ([Nature, 2024](https://www.nature.com/articles/s41586-024-07421-0)) — but as a runtime primitive, not a post-hoc metric. The key constraint: divergence from a common computational ancestor is signal. Divergence from independently-constructed contexts is sampling variance. This measurement is only meaningful because agents share a frontier.
204
182
 
205
183
  ## Session Accumulation
206
184
 
207
- When agents converge when the entropy gate passes — the winning branch is not returned as output. It is promoted. It becomes the new trunk of the session. The next query starts from ground that was computationally earned by the previous convergence check.
208
-
209
- This is the cold/warm session distinction. A cold query runs the full pipeline: plan the decomposition, dispatch research agents, synthesize via `diverge`, evaluate convergence, promote. A warm query — one where a trusted trunk already exists — skips verification entirely. The frontier is already established. Agents fork from it, research, and the session responds directly from findings.
210
-
211
- Each promote is an epistemic commitment: this branch survived N-way comparison and convergence evaluation, so it becomes the basis for future reasoning. The session doesn't just carry forward text — it carries forward the KV state of a branch that survived verification. Future agents fork from this state. Their shared frontier is not an empty system prompt. It is the accumulated, verified reasoning of every previous cycle.
185
+ `Session.promote(branch)` retains only that branch and makes it the session trunk. Future queries fork from this trunk its KV cache already contains everything the promoted branch generated, every tool result it consumed, every verification it passed.
212
186
 
213
- Over multiple queries, the session compounds. Early queries establish the foundation. Later queries branch from it, research further, verify further, promote further. The trunk grows. The frontier advances. The model's effective context is not what you put in the prompt it is what was earned by convergence.
187
+ A cold query starts from position 0. A warm query starts from an existing trunk. Over multiple queries, the session compounds each promote advances the frontier, and future agents inherit the accumulated state.
214
188
 
215
189
  ## Context Pressure
216
190
 
@@ -237,6 +211,8 @@ Tools are class-based with OpenAI-compatible function schemas:
237
211
 
238
212
  ```typescript
239
213
  import { Tool } from "@lloyal-labs/lloyal-agents";
214
+ import { call } from "effection";
215
+ import type { Operation } from "effection";
240
216
  import type { ToolContext } from "@lloyal-labs/lloyal-agents";
241
217
 
242
218
  class SearchTool extends Tool<{ query: string }> {
@@ -248,8 +224,10 @@ class SearchTool extends Tool<{ query: string }> {
248
224
  required: ["query"],
249
225
  };
250
226
 
251
- async execute(args: { query: string }, context?: ToolContext) {
252
- const results = await this.reranker.rank(args.query, this.chunks);
227
+ *execute(args: { query: string }, context?: ToolContext): Operation<unknown> {
228
+ const results = yield* call(() =>
229
+ this.reranker.rank(args.query, this.chunks),
230
+ );
253
231
  context?.onProgress?.({
254
232
  filled: results.length,
255
233
  total: this.chunks.length,
@@ -6,11 +6,10 @@ import type { PressureThresholds, AgentPoolOptions, AgentPoolResult } from './ty
6
6
  *
7
7
  * Created from `SessionContext._storeKvPressure()` which returns
8
8
  * `{ nCtx, cellsUsed, remaining }` where `remaining = nCtx - cellsUsed`.
9
- * `cellsUsed` is a monotonic counter in `BranchStore`it increments on
10
- * every `decode_each` / `decode_scatter` but does **not** decrement on
11
- * individual branch prune (only resets on bulk ops like `retainOnly` and
12
- * `drain`). This means `remaining` is a conservative lower bound that
13
- * becomes increasingly pessimistic as branches are pruned mid-run.
9
+ * `cellsUsed` tracks unique KV cells per branchincremented on
10
+ * `decode_each` / `decode_scatter`, decremented on release by
11
+ * `position - fork_head` (unique cells above the fork point), reset on
12
+ * bulk ops like `retainOnly` and `drain`.
14
13
  *
15
14
  * Two thresholds partition `remaining` into three zones:
16
15
  *
@@ -44,8 +43,6 @@ export declare class ContextPressure {
44
43
  /**
45
44
  * KV slots remaining (`nCtx - cellsUsed`).
46
45
  * Infinity when nCtx ≤ 0 (no context limit).
47
- * Conservative: may undercount actual free space when branches have been
48
- * pruned, since `cellsUsed` is monotonic.
49
46
  */
50
47
  readonly remaining: number;
51
48
  /** Remaining KV floor — tokens reserved for downstream work */
@@ -1 +1 @@
1
- {"version":3,"file":"agent-pool.d.ts","sourceRoot":"","sources":["../src/agent-pool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAW,MAAM,WAAW,CAAC;AAEpD,OAAO,EAA+G,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIpK,OAAO,KAAK,EAEV,kBAAkB,EAElB,gBAAgB,EAChB,eAAe,EAEhB,MAAM,SAAS,CAAC;AAqCjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,qBAAa,eAAe;IAC1B,kEAAkE;IAClE,MAAM,CAAC,QAAQ,CAAC,kBAAkB,QAAQ;IAC1C,2DAA2D;IAC3D,MA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S,EAAE,MAAM,CAAC;gBAEf,GAAG,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,kBAAkB;IAO1D;;;;OAIG;IACH,IAAI,QAAQ,IAAI,MAAM,CAA4C;IAElE,qEAAqE;IACrE,IAAI,QAAQ,IAAI,OAAO,CAA4C;IAEnE,iEAAiE;IACjE,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;CACpC;AA0DD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,SAAS,CAAC,eAAe,CAAC,CAsa/E"}
@@ -6,16 +6,16 @@ const effection_1 = require("effection");
6
6
  const sdk_1 = require("@lloyal-labs/sdk");
7
7
  const context_1 = require("./context");
8
8
  const sdk_2 = require("@lloyal-labs/sdk");
9
+ const trace_scope_1 = require("./trace-scope");
9
10
  /**
10
11
  * Immutable KV budget snapshot for one tick of the agent loop
11
12
  *
12
13
  * Created from `SessionContext._storeKvPressure()` which returns
13
14
  * `{ nCtx, cellsUsed, remaining }` where `remaining = nCtx - cellsUsed`.
14
- * `cellsUsed` is a monotonic counter in `BranchStore`it increments on
15
- * every `decode_each` / `decode_scatter` but does **not** decrement on
16
- * individual branch prune (only resets on bulk ops like `retainOnly` and
17
- * `drain`). This means `remaining` is a conservative lower bound that
18
- * becomes increasingly pessimistic as branches are pruned mid-run.
15
+ * `cellsUsed` tracks unique KV cells per branchincremented on
16
+ * `decode_each` / `decode_scatter`, decremented on release by
17
+ * `position - fork_head` (unique cells above the fork point), reset on
18
+ * bulk ops like `retainOnly` and `drain`.
19
19
  *
20
20
  * Two thresholds partition `remaining` into three zones:
21
21
  *
@@ -49,8 +49,6 @@ class ContextPressure {
49
49
  /**
50
50
  * KV slots remaining (`nCtx - cellsUsed`).
51
51
  * Infinity when nCtx ≤ 0 (no context limit).
52
- * Conservative: may undercount actual free space when branches have been
53
- * pruned, since `cellsUsed` is monotonic.
54
52
  */
55
53
  remaining;
56
54
  /** Remaining KV floor — tokens reserved for downstream work */
@@ -87,7 +85,9 @@ function* setupAgent(parent, task, ctx) {
87
85
  { role: 'system', content: task.systemPrompt },
88
86
  { role: 'user', content: task.content },
89
87
  ];
90
- const fmtOpts = task.tools ? { tools: task.tools } : {};
88
+ const fmtOpts = { enableThinking: false };
89
+ if (task.tools)
90
+ fmtOpts.tools = task.tools;
91
91
  const fmt = ctx.formatChatSync(JSON.stringify(messages), fmtOpts);
92
92
  if (task.tools && (fmt.format === sdk_1.CHAT_FORMAT_CONTENT_ONLY || fmt.format === sdk_1.CHAT_FORMAT_GENERIC)) {
93
93
  // Error before fork — no branch to clean up
@@ -123,6 +123,7 @@ function* setupAgent(parent, task, ctx) {
123
123
  traceBuffer: [],
124
124
  },
125
125
  suffixTokens,
126
+ formattedPrompt: fmt.prompt,
126
127
  };
127
128
  }
128
129
  /**
@@ -186,7 +187,20 @@ function useAgentPool(opts) {
186
187
  yield* effection_1.each.next();
187
188
  }
188
189
  });
190
+ const tw = yield* context_1.Trace.expect();
189
191
  const { tasks, tools, maxTurns = 100, terminalTool, trace = false, pressure: pressureOpts } = opts;
192
+ // Tool index map for trace — position in toolkit array
193
+ const toolIndexMap = new Map([...tools.keys()].map((name, i) => [name, i]));
194
+ const toolkitSize = tools.size;
195
+ const poolT0 = performance.now();
196
+ let poolParentTraceId = null;
197
+ try {
198
+ const p = yield* context_1.TraceParent.get();
199
+ if (p != null)
200
+ poolParentTraceId = p;
201
+ }
202
+ catch { /* top level */ }
203
+ const poolScope = (0, trace_scope_1.traceScope)(tw, poolParentTraceId, 'pool', { agentCount: tasks.length, maxTurns, terminalTool });
190
204
  // Whether the pool's tool registry contains tools besides the terminal tool.
191
205
  // When false, agents are allowed to call the terminal tool as their first
192
206
  // action (e.g. reporter sub-agents that only have `report()`). When true,
@@ -207,9 +221,25 @@ function useAgentPool(opts) {
207
221
  const parent = task.parent;
208
222
  if (!parent)
209
223
  throw new Error('useAgentPool: each task must have a parent branch');
210
- const { agent, suffixTokens } = yield* setupAgent(parent, task, ctx);
224
+ const { agent, suffixTokens, formattedPrompt } = yield* setupAgent(parent, task, ctx);
211
225
  agents.push(agent);
212
226
  prefillSetup.push([agent.branch, suffixTokens]);
227
+ tw.write({
228
+ traceId: tw.nextId(), parentTraceId: poolScope.traceId, ts: performance.now(),
229
+ type: 'branch:create', branchHandle: agent.id, parentHandle: agent.parentId,
230
+ position: 0, role: 'agentFork',
231
+ });
232
+ tw.write({
233
+ traceId: tw.nextId(), parentTraceId: poolScope.traceId, ts: performance.now(),
234
+ type: 'prompt:format', promptText: formattedPrompt,
235
+ taskContent: task.content,
236
+ tokenCount: suffixTokens.length,
237
+ messages: JSON.stringify([
238
+ { role: 'system', content: task.systemPrompt },
239
+ { role: 'user', content: task.content },
240
+ ]),
241
+ tools: task.tools, role: 'agentSuffix',
242
+ });
213
243
  }
214
244
  // Batch prefill all agent suffixes — pressure-gated.
215
245
  // Each suffix is the full formatted chat (system prompt + tools JSON +
@@ -227,11 +257,21 @@ function useAgentPool(opts) {
227
257
  prefillSetup.pop();
228
258
  const dropped = agents.pop();
229
259
  dropped.state = 'done';
260
+ tw.write({
261
+ traceId: tw.nextId(), parentTraceId: poolScope.traceId, ts: performance.now(),
262
+ type: 'pool:agentDrop', agentId: dropped.id, reason: 'pressure_init',
263
+ });
230
264
  }
231
265
  }
232
266
  if (prefillSetup.length > 0) {
233
267
  yield* (0, effection_1.call)(() => store.prefill(prefillSetup));
234
268
  }
269
+ tw.write({
270
+ traceId: tw.nextId(), parentTraceId: poolScope.traceId, ts: performance.now(),
271
+ type: 'pool:open', agentCount: agents.length,
272
+ taskSuffixTokens: prefillSetup.map(([, t]) => t.length),
273
+ pressure: { remaining: initPressure.remaining, softLimit: initPressure.softLimit, headroom: initPressure.headroom },
274
+ });
235
275
  // Emit spawn events — TUI uses parentAgentId to detect sub-agents
236
276
  for (const a of agents) {
237
277
  yield* events.send({ type: 'agent:spawn', agentId: a.id, parentAgentId: a.parentId });
@@ -283,6 +323,8 @@ function useAgentPool(opts) {
283
323
  continue;
284
324
  if (pressure.critical) {
285
325
  a.state = 'done';
326
+ tw.write({ traceId: tw.nextId(), parentTraceId: poolScope.traceId, ts: performance.now(),
327
+ type: 'pool:agentDrop', agentId: a.id, reason: 'pressure_critical' });
286
328
  yield* events.send({ type: 'agent:done', agentId: a.id });
287
329
  continue;
288
330
  }
@@ -293,6 +335,13 @@ function useAgentPool(opts) {
293
335
  thinkingForcedOpen: a.fmt.thinkingForcedOpen,
294
336
  parser: a.fmt.parser,
295
337
  });
338
+ tw.write({
339
+ traceId: tw.nextId(), parentTraceId: poolScope.traceId, ts: performance.now(),
340
+ type: 'agent:turn', agentId: a.id, turn: a.turns,
341
+ rawOutput: a.rawOutput,
342
+ parsedContent: parsed.content || null,
343
+ parsedToolCalls: parsed.toolCalls.map(tc => ({ name: tc.name, arguments: tc.arguments })),
344
+ });
296
345
  const tc = parsed.toolCalls[0];
297
346
  if (!tc) {
298
347
  a.state = 'done';
@@ -312,6 +361,9 @@ function useAgentPool(opts) {
312
361
  && (!terminalTool || tc.name !== terminalTool);
313
362
  if (overBudget) {
314
363
  a.state = 'done';
364
+ tw.write({ traceId: tw.nextId(), parentTraceId: poolScope.traceId, ts: performance.now(),
365
+ type: 'pool:agentDrop', agentId: a.id,
366
+ reason: a.turns >= maxTurns ? 'maxTurns' : 'pressure_softcut' });
315
367
  yield* events.send({ type: 'agent:done', agentId: a.id });
316
368
  continue;
317
369
  }
@@ -367,6 +419,8 @@ function useAgentPool(opts) {
367
419
  if (entries.length > 0) {
368
420
  yield* (0, effection_1.call)(() => store.commit(entries));
369
421
  steps++;
422
+ const tp = ctx._storeKvPressure();
423
+ yield* events.send({ type: 'agent:tick', cellsUsed: tp.cellsUsed, nCtx: tp.nCtx });
370
424
  }
371
425
  // -- Phase 3: SETTLE -- drain settled tool buffer, batch prefill
372
426
  const settled = settledBuffer.splice(0);
@@ -395,6 +449,8 @@ function useAgentPool(opts) {
395
449
  }
396
450
  catch { }
397
451
  }
452
+ tw.write({ traceId: tw.nextId(), parentTraceId: poolScope.traceId, ts: performance.now(),
453
+ type: 'pool:agentDrop', agentId: a.id, reason: 'pressure_settle_reject' });
398
454
  a.state = 'done';
399
455
  yield* events.send({ type: 'agent:done', agentId: a.id });
400
456
  continue;
@@ -402,6 +458,9 @@ function useAgentPool(opts) {
402
458
  prefillPairs.push([a.branch, item.prefillTokens]);
403
459
  settledAgents.push(a);
404
460
  headroom -= item.prefillTokens.length;
461
+ tw.write({ traceId: tw.nextId(), parentTraceId: poolScope.traceId, ts: performance.now(),
462
+ type: 'branch:prefill', branchHandle: a.id,
463
+ tokenCount: item.prefillTokens.length, role: 'toolResult' });
405
464
  }
406
465
  if (prefillPairs.length > 0) {
407
466
  if (trace) {
@@ -440,6 +499,14 @@ function useAgentPool(opts) {
440
499
  totalToolCalls++;
441
500
  agent.turns++;
442
501
  yield* events.send({ type: 'agent:tool_call', agentId: agent.id, tool: tc.name, args: tc.arguments });
502
+ const dispatchTraceId = tw.nextId();
503
+ const toolT0 = performance.now();
504
+ tw.write({
505
+ traceId: dispatchTraceId, parentTraceId: poolScope.traceId, ts: toolT0,
506
+ type: 'tool:dispatch', agentId: agent.id, tool: tc.name,
507
+ toolIndex: toolIndexMap.get(tc.name) ?? -1, toolkitSize,
508
+ args: toolArgs, callId,
509
+ });
443
510
  const tool = tools.get(tc.name);
444
511
  const toolContext = {
445
512
  agentId: agent.id,
@@ -448,6 +515,8 @@ function useAgentPool(opts) {
448
515
  },
449
516
  };
450
517
  try {
518
+ // Set TraceParent so inner pools (research/web_research) link to this dispatch
519
+ yield* context_1.TraceParent.set(dispatchTraceId);
451
520
  const result = yield* (0, effection_1.scoped)(function* () {
452
521
  return yield* (0, effection_1.call)(() => tool ? tool.execute(toolArgs, toolContext) : Promise.resolve({ error: `Unknown tool: ${tc.name}` }));
453
522
  });
@@ -455,10 +524,21 @@ function useAgentPool(opts) {
455
524
  yield* events.send({ type: 'agent:tool_result', agentId: agent.id, tool: tc.name, result: resultStr });
456
525
  const prefillTokens = (0, sdk_2.buildToolResultDelta)(ctx, resultStr, callId);
457
526
  settledBuffer.push({ agentId: agent.id, prefillTokens, toolName: tc.name });
527
+ tw.write({
528
+ traceId: tw.nextId(), parentTraceId: dispatchTraceId, ts: performance.now(),
529
+ type: 'tool:result', agentId: agent.id, tool: tc.name,
530
+ result, prefillTokenCount: prefillTokens.length,
531
+ durationMs: performance.now() - toolT0,
532
+ });
458
533
  }
459
534
  catch (err) {
460
535
  agent.state = 'done';
461
536
  agent.findings = `Tool error: ${err.message}`;
537
+ tw.write({
538
+ traceId: tw.nextId(), parentTraceId: dispatchTraceId, ts: performance.now(),
539
+ type: 'tool:error', agentId: agent.id, tool: tc.name,
540
+ error: err.message,
541
+ });
462
542
  }
463
543
  }
464
544
  // -- Termination
@@ -468,6 +548,18 @@ function useAgentPool(opts) {
468
548
  // ── Provide result — suspends, branches stay alive ───────
469
549
  // Branch cleanup is handled by each branch's ensure() from setupAgent —
470
550
  // when this resource's scope exits, all ensure() callbacks fire.
551
+ tw.write({
552
+ traceId: tw.nextId(), parentTraceId: poolScope.traceId, ts: performance.now(),
553
+ type: 'pool:close',
554
+ agents: agents.map(a => ({
555
+ agentId: a.id, tokenCount: a.tokenCount,
556
+ toolCallCount: a.toolCallCount, findings: a.findings,
557
+ ppl: a.branch.perplexity,
558
+ })),
559
+ totalTokens: agents.reduce((s, a) => s + a.tokenCount, 0),
560
+ steps, durationMs: performance.now() - poolT0,
561
+ });
562
+ poolScope.close();
471
563
  const result = {
472
564
  agents: agents.map(a => ({
473
565
  agentId: a.id,
@@ -1 +1 @@
1
- {"version":3,"file":"agent-pool.js","sourceRoot":"","sources":["../src/agent-pool.ts"],"names":[],"mappings":";;;AAkOA,oCAuUC;AAziBD,yCAAsF;AAGtF,0CAAoK;AAEpK,uCAA+C;AAC/C,0CAAwD;AA6CxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAC,aAAa;gBAC9B,UAAU,EAAE,CAAC,CAAC,UAAU;gBACxB,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,UAAU;gBACxB,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,kBAAkB;gBACxC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;aACzC,CAAC,CAAC;YACL,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC;YACzD,cAAc;YACd,KAAK;YACL,QAAQ;SACT,CAAC;QAEF,KAAK,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;AACL,CAAC"}
package/dist/context.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import type { SessionContext } from '@lloyal-labs/sdk';
2
- import type { BranchStore } from '@lloyal-labs/sdk';
2
+ import type { BranchStore, Branch } from '@lloyal-labs/sdk';
3
3
  import type { Channel } from 'effection';
4
4
  import type { AgentEvent } from './types';
5
+ import type { TraceWriter } from './trace-writer';
5
6
  /**
6
7
  * Effection context holding the active {@link SessionContext}
7
8
  *
@@ -30,4 +31,34 @@ export declare const Store: import("effection").Context<BranchStore>;
30
31
  * @category Agents
31
32
  */
32
33
  export declare const Events: import("effection").Context<Channel<AgentEvent, void>>;
34
+ /**
35
+ * Effection context holding the trace writer
36
+ *
37
+ * Set by {@link initAgents}. Defaults to {@link NullTraceWriter} (zero cost).
38
+ * All agent operations read from this context to emit structured trace events.
39
+ *
40
+ * @category Agents
41
+ */
42
+ export declare const Trace: import("effection").Context<TraceWriter>;
43
+ /**
44
+ * Effection context carrying the current trace scope ID
45
+ *
46
+ * Used to build parent-child relationships across nested agent pools.
47
+ * Set in DISPATCH before tool execution so inner pools inherit the
48
+ * correct parent trace ID.
49
+ *
50
+ * @category Agents
51
+ */
52
+ export declare const TraceParent: import("effection").Context<number>;
53
+ /**
54
+ * Effection context holding the scratchpad fork parent branch
55
+ *
56
+ * Set by {@link withSharedRoot} to the current root branch. Tools that
57
+ * need scratchpad extraction (e.g. BufferingFetchPage, BufferingWebSearch)
58
+ * read this via `yield* ScratchpadParent.expect()` to fork from the
59
+ * innermost active root — never a stale reference from a prior scope.
60
+ *
61
+ * @category Agents
62
+ */
63
+ export declare const ScratchpadParent: import("effection").Context<Branch>;
33
64
  //# sourceMappingURL=context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;;;GAQG;AACH,eAAO,MAAM,GAAG,6CAA8C,CAAC;AAE/D;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,0CAA6C,CAAC;AAEhE;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,wDAA4D,CAAC"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD;;;;;;;;GAQG;AACH,eAAO,MAAM,GAAG,6CAA8C,CAAC;AAE/D;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,0CAA6C,CAAC;AAEhE;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,wDAA4D,CAAC;AAEhF;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,0CAA6C,CAAC;AAEhE;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,qCAA+C,CAAC;AAExE;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,qCAAmD,CAAC"}
package/dist/context.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Events = exports.Store = exports.Ctx = void 0;
3
+ exports.ScratchpadParent = exports.TraceParent = exports.Trace = exports.Events = exports.Store = exports.Ctx = void 0;
4
4
  const effection_1 = require("effection");
5
5
  /**
6
6
  * Effection context holding the active {@link SessionContext}
@@ -30,4 +30,34 @@ exports.Store = (0, effection_1.createContext)('lloyal.store');
30
30
  * @category Agents
31
31
  */
32
32
  exports.Events = (0, effection_1.createContext)('lloyal.events');
33
+ /**
34
+ * Effection context holding the trace writer
35
+ *
36
+ * Set by {@link initAgents}. Defaults to {@link NullTraceWriter} (zero cost).
37
+ * All agent operations read from this context to emit structured trace events.
38
+ *
39
+ * @category Agents
40
+ */
41
+ exports.Trace = (0, effection_1.createContext)('lloyal.trace');
42
+ /**
43
+ * Effection context carrying the current trace scope ID
44
+ *
45
+ * Used to build parent-child relationships across nested agent pools.
46
+ * Set in DISPATCH before tool execution so inner pools inherit the
47
+ * correct parent trace ID.
48
+ *
49
+ * @category Agents
50
+ */
51
+ exports.TraceParent = (0, effection_1.createContext)('lloyal.traceParent');
52
+ /**
53
+ * Effection context holding the scratchpad fork parent branch
54
+ *
55
+ * Set by {@link withSharedRoot} to the current root branch. Tools that
56
+ * need scratchpad extraction (e.g. BufferingFetchPage, BufferingWebSearch)
57
+ * read this via `yield* ScratchpadParent.expect()` to fork from the
58
+ * innermost active root — never a stale reference from a prior scope.
59
+ *
60
+ * @category Agents
61
+ */
62
+ exports.ScratchpadParent = (0, effection_1.createContext)('lloyal.scratchpadParent');
33
63
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;;AAAA,yCAA0C;AAM1C;;;;;;;;GAQG;AACU,QAAA,GAAG,GAAG,IAAA,yBAAa,EAAiB,YAAY,CAAC,CAAC;AAE/D;;;;;;;GAOG;AACU,QAAA,KAAK,GAAG,IAAA,yBAAa,EAAc,cAAc,CAAC,CAAC;AAEhE;;;;;;;GAOG;AACU,QAAA,MAAM,GAAG,IAAA,yBAAa,EAA4B,eAAe,CAAC,CAAC"}
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;;AAAA,yCAA0C;AAQ1C;;;;;;;;GAQG;AACU,QAAA,GAAG,GAAG,IAAA,yBAAa,EAAiB,YAAY,CAAC,CAAC;AAE/D;;;;;;;GAOG;AACU,QAAA,KAAK,GAAG,IAAA,yBAAa,EAAc,cAAc,CAAC,CAAC;AAEhE;;;;;;;GAOG;AACU,QAAA,MAAM,GAAG,IAAA,yBAAa,EAA4B,eAAe,CAAC,CAAC;AAEhF;;;;;;;GAOG;AACU,QAAA,KAAK,GAAG,IAAA,yBAAa,EAAc,cAAc,CAAC,CAAC;AAEhE;;;;;;;;GAQG;AACU,QAAA,WAAW,GAAG,IAAA,yBAAa,EAAU,oBAAoB,CAAC,CAAC;AAExE;;;;;;;;;GASG;AACU,QAAA,gBAAgB,GAAG,IAAA,yBAAa,EAAS,yBAAyB,CAAC,CAAC"}