skillsMetadata causes concurrent update error when parallel subagents complete with skills middleware #34

Closed
opened 2026-02-16 06:16:56 -05:00 by yindo · 1 comment
Owner

Originally created by @tverghonooks on GitHub (Jan 25, 2026).

Originally assigned to: @maahir30 on GitHub.

Checked other resources

  • This is a bug, not a usage question.
  • I added a clear and descriptive title.
  • I searched existing issues and didn't find this.
  • I can reproduce this with the latest released version.
  • I included a minimal reproducible example and steps to reproduce.

Area (Required)

  • deepagents (SDK)
  • cli

Reproduction Steps / Example Code (Python)

/**
 * Reproduction script for skillsMetadata concurrent update bug
 *
 * Requirements:
 *   Node.js >= 20.9.0
 *
 * Setup:
 *   npm install deepagents @langchain/anthropic tsx
 *   mkdir -p /tmp/skills/test-skill
 *   echo '---
 * name: test-skill
 * description: A test skill
 * ---
 * # Test Skill' > /tmp/skills/test-skill/SKILL.md
 *
 * Run:
 *   ANTHROPIC_API_KEY=your_key npx tsx repro-skillsmetadata-bug.ts
 *
 * Expected error (before fix):
 *   Invalid update for channel "skillsMetadata" with values [[...],[...],[...],[...]]:
 *   LastValue can only receive one value per step.
 */

import { createDeepAgent } from "deepagents";
import { HumanMessage } from "@langchain/core/messages";

async function reproduce() {
  console.log("=== skillsMetadata Concurrent Update Bug Reproduction ===\n");

  const agent = createDeepAgent({
    model: "claude-sonnet-4-5-20250929",
    skills: ["/tmp/skills/"],
    systemPrompt: `You coordinate research by delegating to subagents via the task tool.
IMPORTANT: When asked to get multiple answers, call the task tool multiple times IN PARALLEL (same message).
Subagents should just return a brief text answer - no file operations needed.`,
  });

  console.log("Sending request to trigger parallel subagents...\n");

  try {
    const result = await agent.invoke({
      messages: [
        new HumanMessage(
          "Use the task tool to spawn 4 subagents IN PARALLEL (all 4 task calls in one message). " +
          "Each subagent should answer ONE of these questions with a single sentence:\n" +
          "1) What is 2+2?\n" +
          "2) What is the capital of France?\n" +
          "3) What color is the sky?\n" +
          "4) How many days in a week?\n\n" +
          "Call task 4 times simultaneously. Subagents should just return the answer, no tools needed."
        ),
      ],
    });

    const lastMsg = result.messages[result.messages.length - 1];
    console.log("Result:", String(lastMsg?.content).slice(0, 500));
  } catch (error: any) {
    if (error.message?.includes("LastValue") && error.message?.includes("skillsMetadata")) {
      console.log("BUG REPRODUCED!\n");
      console.log("Error:", error.message);
    } else {
      console.log("Error:", error.message);
    }
  }
}

reproduce().catch(console.error);

Error Message and Stack Trace (if applicable)

Error: Invalid update for channel "skillsMetadata" with values [[],[],[],[]]: LastValue can only receive one value per step.

Description

Description

When skills middleware is enabled (e.g. skills: ['/.claude/skills/']) and multiple subagents run in parallel, LangGraph throws a concurrent update error because skillsMetadata is not in EXCLUDED_STATE_KEYS.

Impact

We're looking to integrate deepagents into our production platform and this bug blocks us from using skills middleware with parallel subagents, which is a core part of our architecture. We have a working fork with the fix, but would like to see this merged upstream so we can stay on the main release.

Steps to Reproduce

  1. Create an agent with skills middleware enabled:
const agent = createDeepAgent({
  model: 'claude-sonnet-4-5-20250929',
  skills: ['/.claude/skills/'],
  // ... other config
});
  1. Send a request that triggers multiple subagents in parallel (e.g., "research X, Y, Z, and W")

  2. When 4 subagents complete simultaneously, each returns skillsMetadata in their state update

  3. LangGraph fails because skillsMetadata uses implicit LastValue (no custom reducer)

Root Cause

In libs/deepagents/src/middleware/subagents.ts, the EXCLUDED_STATE_KEYS array (line 33-38) includes files but not skillsMetadata:

const EXCLUDED_STATE_KEYS = [
  "messages",
  "todos",
  "structuredResponse",
  "files",
  // "skillsMetadata" is missing
] as const;

When multiple subagents then return skillsMetadata simultaneously, LangGraph throws the error.

Proposed Fix

Add "skillsMetadata" to EXCLUDED_STATE_KEYS:

const EXCLUDED_STATE_KEYS = [
  "messages",
  "todos",
  "structuredResponse",
  "files",
  "skillsMetadata",  // Add this
] as const;

Environment / System Info

  • deepagents version: 1.6.0
  • Node.js: 20.x, 22.x
  • OS: macOS
Originally created by @tverghonooks on GitHub (Jan 25, 2026). Originally assigned to: @maahir30 on GitHub. ### Checked other resources - [x] This is a bug, not a usage question. - [x] I added a clear and descriptive title. - [x] I searched existing issues and didn't find this. - [x] I can reproduce this with the latest released version. - [x] I included a minimal reproducible example and steps to reproduce. ### Area (Required) - [x] deepagents (SDK) - [ ] cli ### Reproduction Steps / Example Code (Python) ```python /** * Reproduction script for skillsMetadata concurrent update bug * * Requirements: * Node.js >= 20.9.0 * * Setup: * npm install deepagents @langchain/anthropic tsx * mkdir -p /tmp/skills/test-skill * echo '--- * name: test-skill * description: A test skill * --- * # Test Skill' > /tmp/skills/test-skill/SKILL.md * * Run: * ANTHROPIC_API_KEY=your_key npx tsx repro-skillsmetadata-bug.ts * * Expected error (before fix): * Invalid update for channel "skillsMetadata" with values [[...],[...],[...],[...]]: * LastValue can only receive one value per step. */ import { createDeepAgent } from "deepagents"; import { HumanMessage } from "@langchain/core/messages"; async function reproduce() { console.log("=== skillsMetadata Concurrent Update Bug Reproduction ===\n"); const agent = createDeepAgent({ model: "claude-sonnet-4-5-20250929", skills: ["/tmp/skills/"], systemPrompt: `You coordinate research by delegating to subagents via the task tool. IMPORTANT: When asked to get multiple answers, call the task tool multiple times IN PARALLEL (same message). Subagents should just return a brief text answer - no file operations needed.`, }); console.log("Sending request to trigger parallel subagents...\n"); try { const result = await agent.invoke({ messages: [ new HumanMessage( "Use the task tool to spawn 4 subagents IN PARALLEL (all 4 task calls in one message). " + "Each subagent should answer ONE of these questions with a single sentence:\n" + "1) What is 2+2?\n" + "2) What is the capital of France?\n" + "3) What color is the sky?\n" + "4) How many days in a week?\n\n" + "Call task 4 times simultaneously. Subagents should just return the answer, no tools needed." ), ], }); const lastMsg = result.messages[result.messages.length - 1]; console.log("Result:", String(lastMsg?.content).slice(0, 500)); } catch (error: any) { if (error.message?.includes("LastValue") && error.message?.includes("skillsMetadata")) { console.log("BUG REPRODUCED!\n"); console.log("Error:", error.message); } else { console.log("Error:", error.message); } } } reproduce().catch(console.error); ``` ### Error Message and Stack Trace (if applicable) ```shell Error: Invalid update for channel "skillsMetadata" with values [[],[],[],[]]: LastValue can only receive one value per step. ``` ### Description ## Description When skills middleware is enabled (e.g. `skills: ['/.claude/skills/']`) and multiple subagents run in parallel, LangGraph throws a concurrent update error because `skillsMetadata` is not in `EXCLUDED_STATE_KEYS`. ## Impact We're looking to integrate `deepagents` into our production platform and this bug blocks us from using skills middleware with parallel subagents, which is a core part of our architecture. We have a working [fork](https://github.com/tverghonooks/deepagentsjs/tree/fix/exclude-skillsmetadata-from-subagent-state) with the fix, but would like to see this merged upstream so we can stay on the main release. ## Steps to Reproduce 1. Create an agent with skills middleware enabled: ```typescript const agent = createDeepAgent({ model: 'claude-sonnet-4-5-20250929', skills: ['/.claude/skills/'], // ... other config }); ``` 2. Send a request that triggers multiple subagents in parallel (e.g., "research X, Y, Z, and W") 3. When 4 subagents complete simultaneously, each returns `skillsMetadata` in their state update 4. LangGraph fails because `skillsMetadata` uses implicit `LastValue` (no custom reducer) ## Root Cause In `libs/deepagents/src/middleware/subagents.ts`, the `EXCLUDED_STATE_KEYS` array (line 33-38) includes `files` but not `skillsMetadata`: ```typescript const EXCLUDED_STATE_KEYS = [ "messages", "todos", "structuredResponse", "files", // "skillsMetadata" is missing ] as const; ``` When multiple subagents then return `skillsMetadata` simultaneously, LangGraph throws the error. ## Proposed Fix Add `"skillsMetadata"` to `EXCLUDED_STATE_KEYS`: ```typescript const EXCLUDED_STATE_KEYS = [ "messages", "todos", "structuredResponse", "files", "skillsMetadata", // Add this ] as const; ``` ### Environment / System Info - deepagents version: 1.6.0 - Node.js: 20.x, 22.x - OS: macOS
yindo added the bug label 2026-02-16 06:16:56 -05:00
yindo closed this issue 2026-02-16 06:16:56 -05:00
Author
Owner

@christian-bromann commented on GitHub (Feb 5, 2026):

This was resolved in #187. Thank you for raising the issue.

@christian-bromann commented on GitHub (Feb 5, 2026): This was [resolved](https://github.com/langchain-ai/deepagentsjs/pull/187/changes#diff-dc233f2e0b1d72fdba07d95fc27792112a96369069e23ba8ac89e2df55402cc9R45) in #187. Thank you for raising the issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/deepagentsjs#34