agent-lattice 0.9.21 → 0.9.23

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 CHANGED
@@ -533,6 +533,13 @@ delivery: the runtime waits for the member's upstream reply, feeds it back to
533
533
  the lead, and keeps going until the root lead returns the final result or the
534
534
  run terminates.
535
535
 
536
+ After one model response queues one or more handoffs, the SDK does not call the
537
+ lead model again immediately. It first runs those members, collects their
538
+ completed or failed reports, and only then calls the lead again. All handoffs
539
+ from the current tool batch are queued before the lead pauses. The receipt keeps
540
+ `status: "accepted"` for compatibility and also includes `phase: "queued"`,
541
+ `completion_pending: true`, `message_id`, `work_item_id`, and `thread_id`.
542
+
536
543
  Accepted handoffs use work-item failure isolation by default. If one member
537
544
  returns an agent error such as `MaxTurnsError` or `APIError`, the runtime marks
538
545
  that work item `failed`, sends a failure report to the lead, and continues the
@@ -541,6 +548,25 @@ together and decides whether to retry, revise the task, accept a partial result,
541
548
  or finish. A run-wide `AbortError` still stops the runner; the runtime marks the
542
549
  current and remaining accepted work `cancelled` before propagating the abort.
543
550
 
551
+ Handoff work is serial by default. Set a bounded concurrency limit on the team
552
+ when independent members should run at the same time:
553
+
554
+ ```ts
555
+ const team = createTeam({
556
+ name: "research",
557
+ lead,
558
+ members,
559
+ runner: { maxConcurrentWorkItems: 4 },
560
+ });
561
+ ```
562
+
563
+ You can also pass `maxConcurrentWorkItems` to `createTeamRunner()`. The limit
564
+ must be a positive integer and defaults to `1`. It applies across different
565
+ member mailboxes; work addressed to the same mailbox remains serial because an
566
+ Agent may keep mutable conversation state. Runtime events are emitted as work
567
+ actually progresses, while the reports injected back into the lead stay in the
568
+ original handoff order.
569
+
544
570
  Team member tools can also request explicit shared workspace write grants:
545
571
 
546
572
  ```ts
package/dist/index.d.ts CHANGED
@@ -100,6 +100,7 @@ export type AgentRuntimeContext = {
100
100
  permissions: RuntimePermissions;
101
101
  delegate(input: AgentRuntimeDelegateInput): Promise<AgentRuntimeDelegateResult>;
102
102
  emit(message: TeamRunnerMessage): void;
103
+ shouldPauseAfterToolBatch?(): boolean;
103
104
  };
104
105
  export type ContextTraceEventType = "run_start" | "user_message" | "model_request" | "assistant_message" | "tool_use" | "tool_result" | "team_message" | "result" | "error";
105
106
  export type ContextTraceEvent = {
@@ -312,12 +313,17 @@ export type SQLiteMailboxOptions = {
312
313
  database: SQLiteDatabaseLike;
313
314
  tableName?: string;
314
315
  };
316
+ export type TeamRunnerConfig = {
317
+ maxDelegateDepth?: number;
318
+ maxConcurrentWorkItems?: number;
319
+ };
315
320
  export type TeamOptions = {
316
321
  name: string;
317
322
  lead: Agent<any>;
318
323
  members: TeamMemberDefinition[];
319
324
  mailbox?: TeamMailbox;
320
325
  exposeLeadMailboxTools?: boolean;
326
+ runner?: TeamRunnerConfig;
321
327
  };
322
328
  export type Team = {
323
329
  name: string;
@@ -326,6 +332,7 @@ export type Team = {
326
332
  mailbox: TeamMailbox;
327
333
  tools: Array<ToolDefinition<any, any>>;
328
334
  memberTools: Record<string, Array<ToolDefinition<any, any>>>;
335
+ readonly runnerOptions?: TeamRunnerConfig;
329
336
  send(from: string, to: string, content: string, options?: TeamSendOptions): Promise<TeamMessage>;
330
337
  drain(options?: TeamDrainOptions): Promise<TeamDrainResult>;
331
338
  query(prompt: string | ContentBlock[], options?: QueryOptions): AsyncGenerator<TeamRunnerMessage>;
@@ -341,12 +348,11 @@ export type TeamDrainResult = {
341
348
  failed: number;
342
349
  rounds: number;
343
350
  };
344
- export type TeamRunnerOptions = {
351
+ export type TeamRunnerOptions = TeamRunnerConfig & {
345
352
  team?: Team;
346
353
  root?: AgentLike<any>;
347
354
  mailbox?: TeamMailbox;
348
355
  source?: AgentRuntimeSource;
349
- maxDelegateDepth?: number;
350
356
  };
351
357
  export type TeamRunner = {
352
358
  root: AgentLike<any>;