deepagents 1.13.4-rc.0 → 1.13.4

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.
@@ -2598,7 +2598,6 @@ function createFilesystemMiddleware(options = {}) {
2598
2598
  }
2599
2599
  return (0, langchain.createMiddleware)({
2600
2600
  name: "FilesystemMiddleware",
2601
- tracePolicy: { processInputs: langchain.omitPayload },
2602
2601
  stateSchema: FilesystemStateSchema,
2603
2602
  tools: allTools,
2604
2603
  async beforeAgent(state) {
@@ -3338,7 +3337,6 @@ function createSummarizationMiddleware(options) {
3338
3337
  }
3339
3338
  return (0, langchain.createMiddleware)({
3340
3339
  name: "SummarizationMiddleware",
3341
- tracePolicy: { processInputs: langchain.omitPayload },
3342
3340
  stateSchema: SummarizationStateSchema,
3343
3341
  async wrapModelCall(request, handler) {
3344
3342
  const effectiveMessages = getEffectiveMessages(request.messages ?? [], request.state);
@@ -3477,6 +3475,24 @@ const DEFAULT_SUBAGENT_PROMPT = "In order to complete the objective that the use
3477
3475
  const FORKED_CONTEXT_KEY = "_deepagentsForkedContext";
3478
3476
  const FORK_RECURSION_REFUSAL = "You are a subagent and cannot delegate to another subagent. Complete this task yourself instead of calling this tool again.";
3479
3477
  /**
3478
+ * Per-graph call accounting owned by the upstream limit middlewares. Upstream
3479
+ * declares these as plain values, so LangGraph gives them single-writer
3480
+ * `LastValue` channels: forwarding them crashed parallel delegation and let a
3481
+ * subagent's reset overwrite the parent's budget. Each agent counts its own
3482
+ * calls, so they never cross the boundary.
3483
+ *
3484
+ * Matching by name is targeted, not structural — other middleware declaring
3485
+ * plain state still collide, notably in a fork. A later change should derive
3486
+ * these keys from each subagent's middleware `stateSchema` and forward only
3487
+ * mergeable (`ReducedValue`) channels.
3488
+ */
3489
+ const CALL_COUNT_STATE_KEYS = [
3490
+ "threadModelCallCount",
3491
+ "runModelCallCount",
3492
+ "threadToolCallCount",
3493
+ "runToolCallCount"
3494
+ ];
3495
+ /**
3480
3496
  * State keys excluded when passing state to subagents and when returning
3481
3497
  * updates from subagents. Summarization keys are excluded because their
3482
3498
  * cutoffIndex is only valid against the message list it was computed from.
@@ -3487,6 +3503,7 @@ const EXCLUDED_STATE_KEYS = [
3487
3503
  "structuredResponse",
3488
3504
  "skillsMetadata",
3489
3505
  "memoryContents",
3506
+ ...CALL_COUNT_STATE_KEYS,
3490
3507
  "_summarizationEvent",
3491
3508
  "_summarizationSessionId",
3492
3509
  FORKED_CONTEXT_KEY
@@ -3496,9 +3513,13 @@ const EXCLUDED_STATE_KEYS = [
3496
3513
  * Narrower than `EXCLUDED_STATE_KEYS`: a fork's mirrored middleware needs
3497
3514
  * the parent's private channels (skills metadata, memory contents, etc.)
3498
3515
  * to rebuild an equivalent prompt.
3516
+ *
3517
+ * Call counts stay excluded: a fork inherits the parent's middleware, so
3518
+ * sharing them collides on the parent's channel.
3499
3519
  */
3500
3520
  const FORK_EXCLUDED_STATE_KEYS = [
3501
3521
  "structuredResponse",
3522
+ ...CALL_COUNT_STATE_KEYS,
3502
3523
  "_summarizationEvent",
3503
3524
  "_summarizationSessionId"
3504
3525
  ];
@@ -3649,7 +3670,6 @@ const ForkedContextStateSchema = zod_v4.z.object({ [FORKED_CONTEXT_KEY]: zod_v4.
3649
3670
  function createForkTaskToolMiddleware(taskTool) {
3650
3671
  return (0, langchain.createMiddleware)({
3651
3672
  name: "forkTaskToolMiddleware",
3652
- tracePolicy: { processInputs: langchain.omitPayload },
3653
3673
  stateSchema: ForkedContextStateSchema,
3654
3674
  tools: [taskTool],
3655
3675
  beforeAgent: () => ({ [FORKED_CONTEXT_KEY]: true })
@@ -3885,7 +3905,6 @@ function createSubAgentMiddleware(options) {
3885
3905
  });
3886
3906
  return (0, langchain.createMiddleware)({
3887
3907
  name: "subAgentMiddleware",
3888
- tracePolicy: { processInputs: langchain.omitPayload },
3889
3908
  tools: [taskTool],
3890
3909
  wrapModelCall: async (request, handler) => {
3891
3910
  if (systemPrompt !== null) return handler({
@@ -3990,7 +4009,6 @@ function patchDanglingToolCalls(messages) {
3990
4009
  function createPatchToolCallsMiddleware() {
3991
4010
  return (0, langchain.createMiddleware)({
3992
4011
  name: "patchToolCallsMiddleware",
3993
- tracePolicy: { processInputs: langchain.omitPayload },
3994
4012
  beforeAgent: async (state) => {
3995
4013
  const messages = state.messages;
3996
4014
  if (!messages || messages.length === 0) return;
@@ -4352,7 +4370,6 @@ function createMemoryMiddleware(options) {
4352
4370
  const { backend, sources, addCacheControl = false } = options;
4353
4371
  return (0, langchain.createMiddleware)({
4354
4372
  name: "MemoryMiddleware",
4355
- tracePolicy: { processInputs: langchain.omitPayload },
4356
4373
  stateSchema: MemoryStateSchema,
4357
4374
  async beforeAgent(state) {
4358
4375
  if ("memoryContents" in state && state.memoryContents != null) return;
@@ -4837,7 +4854,6 @@ function createSkillsMiddleware(options) {
4837
4854
  let loadedSkills = [];
4838
4855
  return (0, langchain.createMiddleware)({
4839
4856
  name: "SkillsMiddleware",
4840
- tracePolicy: { processInputs: langchain.omitPayload },
4841
4857
  stateSchema: SkillsStateSchema,
4842
4858
  async beforeAgent(state) {
4843
4859
  const stateHasSkills = "skillsMetadata" in state && Array.isArray(state.skillsMetadata) && state.skillsMetadata.length > 0;
@@ -5082,7 +5098,6 @@ function createCompletionCallbackMiddleware(options) {
5082
5098
  }
5083
5099
  return (0, langchain.createMiddleware)({
5084
5100
  name: "CompletionCallbackMiddleware",
5085
- tracePolicy: { processInputs: langchain.omitPayload },
5086
5101
  stateSchema: CompletionCallbackStateSchema,
5087
5102
  /**
5088
5103
  * After-agent hook: fires when the subagent completes successfully.
@@ -5624,7 +5639,6 @@ function createAsyncSubAgentMiddleware(options) {
5624
5639
  const fullSystemPrompt = systemPrompt ? `${systemPrompt}\n\nAvailable async subagent types:\n${agentsDescription}` : null;
5625
5640
  return (0, langchain.createMiddleware)({
5626
5641
  name: "asyncSubAgentMiddleware",
5627
- tracePolicy: { processInputs: langchain.omitPayload },
5628
5642
  stateSchema: AsyncTaskStateSchema,
5629
5643
  tools,
5630
5644
  wrapModelCall: async (request, handler) => {
@@ -5707,7 +5721,6 @@ var ConfigurationError = class ConfigurationError extends Error {
5707
5721
  function createCacheBreakpointMiddleware() {
5708
5722
  return (0, langchain.createMiddleware)({
5709
5723
  name: "CacheBreakpointMiddleware",
5710
- tracePolicy: { processInputs: langchain.omitPayload },
5711
5724
  wrapModelCall(request, handler) {
5712
5725
  if (!isAnthropicModel(request.model)) return handler(request);
5713
5726
  const existingContent = request.systemMessage.content;
@@ -5742,7 +5755,6 @@ function hasToolName(tool) {
5742
5755
  function createToolExclusionMiddleware(excludedTools) {
5743
5756
  return (0, langchain.createMiddleware)({
5744
5757
  name: "_ToolExclusionMiddleware",
5745
- tracePolicy: { processInputs: langchain.omitPayload },
5746
5758
  wrapModelCall(request, handler) {
5747
5759
  return handler({
5748
5760
  ...request,
@@ -9083,4 +9095,4 @@ Object.defineProperty(exports, "serializeProfile", {
9083
9095
  }
9084
9096
  });
9085
9097
 
9086
- //# sourceMappingURL=langsmith-BRsbzTlK.cjs.map
9098
+ //# sourceMappingURL=langsmith-yA3yhBRa.cjs.map