deepagents 1.8.2 → 1.8.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.
package/dist/index.cjs CHANGED
@@ -1073,7 +1073,7 @@ function createFilesystemMiddleware(options = {}) {
1073
1073
  wrapModelCall: async (request, handler) => {
1074
1074
  const supportsExecution = isSandboxBackend(getBackend(backend, {
1075
1075
  state: request.state || {},
1076
- store: request.config?.store
1076
+ store: request.runtime?.store
1077
1077
  }));
1078
1078
  let tools = request.tools;
1079
1079
  if (!supportsExecution) tools = tools.filter((t) => t.name !== "execute");
@@ -1095,7 +1095,7 @@ function createFilesystemMiddleware(options = {}) {
1095
1095
  if (typeof msg.content === "string" && msg.content.length > toolTokenLimitBeforeEvict * NUM_CHARS_PER_TOKEN) {
1096
1096
  const resolvedBackend = getBackend(backend, {
1097
1097
  state: request.state || {},
1098
- store: request.config?.store
1098
+ store: request.runtime?.store
1099
1099
  });
1100
1100
  const evictPath = `/large_tool_results/${sanitizeToolCallId(request.toolCall?.id || msg.tool_call_id)}`;
1101
1101
  const writeResult = await resolvedBackend.write(evictPath, msg.content);
@@ -1404,11 +1404,15 @@ const INVALID_TOOL_MESSAGE_BLOCK_TYPES = [
1404
1404
  */
1405
1405
  function returnCommandWithStateUpdate(result, toolCallId) {
1406
1406
  const stateUpdate = filterStateForSubagent(result);
1407
- const messages = result.messages;
1408
- let content = (messages?.[messages.length - 1])?.content || "Task completed";
1409
- if (Array.isArray(content)) {
1410
- content = content.filter((block) => !INVALID_TOOL_MESSAGE_BLOCK_TYPES.includes(block.type));
1411
- if (content.length === 0) content = "Task completed";
1407
+ let content;
1408
+ if (result.structuredResponse != null) content = JSON.stringify(result.structuredResponse);
1409
+ else {
1410
+ const messages = result.messages;
1411
+ content = (messages?.[messages.length - 1])?.content || "Task completed";
1412
+ if (Array.isArray(content)) {
1413
+ content = content.filter((block) => !INVALID_TOOL_MESSAGE_BLOCK_TYPES.includes(block.type));
1414
+ if (content.length === 0) content = "Task completed";
1415
+ }
1412
1416
  }
1413
1417
  return new _langchain_langgraph.Command({ update: {
1414
1418
  ...stateUpdate,
@@ -1452,7 +1456,8 @@ function getSubagents(options) {
1452
1456
  systemPrompt: agentParams.systemPrompt,
1453
1457
  tools: agentParams.tools ?? defaultTools,
1454
1458
  middleware,
1455
- name: agentParams.name
1459
+ name: agentParams.name,
1460
+ ...agentParams.responseFormat != null && { responseFormat: agentParams.responseFormat }
1456
1461
  });
1457
1462
  }
1458
1463
  }
@@ -1486,6 +1491,7 @@ function createTaskTool(options) {
1486
1491
  subagentState.messages = [new _langchain_core_messages.HumanMessage({ content: description })];
1487
1492
  const result = await subagent.invoke(subagentState, config);
1488
1493
  if (!config.toolCall?.id) {
1494
+ if (result.structuredResponse != null) return JSON.stringify(result.structuredResponse);
1489
1495
  const messages = result.messages;
1490
1496
  let content = (messages?.[messages.length - 1])?.content || "Task completed";
1491
1497
  if (Array.isArray(content)) {
@@ -5033,7 +5039,10 @@ function createDeepAgent(params = {}) {
5033
5039
  checkpointer,
5034
5040
  store,
5035
5041
  name
5036
- }).withConfig({ recursionLimit: 1e4 });
5042
+ }).withConfig({
5043
+ recursionLimit: 1e4,
5044
+ metadata: { ls_integration: "deepagents" }
5045
+ });
5037
5046
  }
5038
5047
 
5039
5048
  //#endregion