@agentforge/patterns 0.15.12 → 0.15.14

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
@@ -1374,19 +1374,30 @@ function createFinisherNode() {
1374
1374
  }
1375
1375
 
1376
1376
  // src/plan-execute/agent.ts
1377
+ var executorRouteMap = {
1378
+ execute: "executor",
1379
+ replan: "replanner",
1380
+ finish: "finisher",
1381
+ error: import_langgraph2.END
1382
+ };
1383
+ var replannerRouteMap = {
1384
+ replan: "planner",
1385
+ execute: "executor",
1386
+ error: import_langgraph2.END,
1387
+ finish: import_langgraph2.END
1388
+ };
1377
1389
  function createPlanExecuteAgent(config) {
1378
1390
  const {
1379
1391
  planner,
1380
1392
  executor,
1381
1393
  replanner,
1382
1394
  maxIterations = 5,
1383
- verbose = false,
1384
1395
  checkpointer
1385
1396
  } = config;
1386
1397
  const plannerNode = createPlannerNode(planner);
1387
1398
  const executorNode = createExecutorNode(executor);
1388
1399
  const finisherNode = createFinisherNode();
1389
- const replannerNode = replanner ? createReplannerNode(replanner) : async (state) => ({ status: "executing" });
1400
+ const replannerNode = replanner ? createReplannerNode(replanner) : async () => ({ status: "executing" });
1390
1401
  const workflow = new import_langgraph2.StateGraph(PlanExecuteState).addNode("planner", plannerNode).addNode("executor", executorNode).addNode("finisher", finisherNode).addNode("replanner", replannerNode);
1391
1402
  const routeAfterExecutor = (state) => {
1392
1403
  if (state.status === "failed") {
@@ -1422,24 +1433,13 @@ function createPlanExecuteAgent(config) {
1422
1433
  workflow.addConditionalEdges(
1423
1434
  "executor",
1424
1435
  routeAfterExecutor,
1425
- {
1426
- execute: "executor",
1427
- // Loop back to execute next step
1428
- replan: "replanner",
1429
- finish: "finisher",
1430
- error: import_langgraph2.END
1431
- }
1436
+ executorRouteMap
1432
1437
  );
1433
1438
  workflow.addEdge("finisher", import_langgraph2.END);
1434
1439
  workflow.addConditionalEdges(
1435
1440
  "replanner",
1436
1441
  routeAfterReplanner,
1437
- {
1438
- replan: "planner",
1439
- execute: "executor",
1440
- error: import_langgraph2.END,
1441
- finish: import_langgraph2.END
1442
- }
1442
+ replannerRouteMap
1443
1443
  );
1444
1444
  return workflow.compile(checkpointer ? { checkpointer } : void 0);
1445
1445
  }
package/dist/index.d.cts CHANGED
@@ -1175,14 +1175,6 @@ type PlanExecuteRoute = 'execute' | 'replan' | 'finish' | 'error';
1175
1175
  */
1176
1176
  type PlanExecuteRouter = (state: PlanExecuteStateType) => PlanExecuteRoute;
1177
1177
 
1178
- /**
1179
- * Plan-and-Execute Agent Factory
1180
- *
1181
- * This module provides the main factory function for creating Plan-and-Execute agents.
1182
- *
1183
- * @module patterns/plan-execute/agent
1184
- */
1185
-
1186
1178
  /**
1187
1179
  * Create a Plan-and-Execute agent
1188
1180
  *
@@ -1242,7 +1234,190 @@ type PlanExecuteRouter = (state: PlanExecuteStateType) => PlanExecuteRoute;
1242
1234
  * );
1243
1235
  * ```
1244
1236
  */
1245
- declare function createPlanExecuteAgent(config: PlanExecuteAgentConfig): any;
1237
+ declare function createPlanExecuteAgent(config: PlanExecuteAgentConfig): _langchain_langgraph.CompiledStateGraph<{
1238
+ input: string;
1239
+ plan: {
1240
+ steps: {
1241
+ id: string;
1242
+ description: string;
1243
+ tool?: string | undefined;
1244
+ args?: Record<string, any> | undefined;
1245
+ dependencies?: string[] | undefined;
1246
+ }[];
1247
+ goal: string;
1248
+ createdAt: string;
1249
+ confidence?: number | undefined;
1250
+ } | undefined;
1251
+ pastSteps: {
1252
+ timestamp: string;
1253
+ step: {
1254
+ id: string;
1255
+ description: string;
1256
+ tool?: string | undefined;
1257
+ args?: Record<string, any> | undefined;
1258
+ dependencies?: string[] | undefined;
1259
+ };
1260
+ success: boolean;
1261
+ result?: any;
1262
+ error?: string | undefined;
1263
+ }[];
1264
+ currentStepIndex: number | undefined;
1265
+ status: "failed" | "planning" | "executing" | "replanning" | "completed";
1266
+ response: string | undefined;
1267
+ error: string | undefined;
1268
+ iteration: number;
1269
+ maxIterations: number;
1270
+ }, {
1271
+ input?: string | undefined;
1272
+ plan?: {
1273
+ steps: {
1274
+ id: string;
1275
+ description: string;
1276
+ tool?: string | undefined;
1277
+ args?: Record<string, any> | undefined;
1278
+ dependencies?: string[] | undefined;
1279
+ }[];
1280
+ goal: string;
1281
+ createdAt: string;
1282
+ confidence?: number | undefined;
1283
+ } | undefined;
1284
+ pastSteps?: {
1285
+ timestamp: string;
1286
+ step: {
1287
+ id: string;
1288
+ description: string;
1289
+ tool?: string | undefined;
1290
+ args?: Record<string, any> | undefined;
1291
+ dependencies?: string[] | undefined;
1292
+ };
1293
+ success: boolean;
1294
+ result?: any;
1295
+ error?: string | undefined;
1296
+ }[] | undefined;
1297
+ currentStepIndex?: number | undefined;
1298
+ status?: "failed" | "planning" | "executing" | "replanning" | "completed" | undefined;
1299
+ response?: string | undefined;
1300
+ error?: string | undefined;
1301
+ iteration?: number | undefined;
1302
+ maxIterations?: number | undefined;
1303
+ }, "__start__" | "executor" | "replanner" | "finisher" | "planner", {
1304
+ input: _langchain_langgraph.BaseChannel<string, string, unknown>;
1305
+ plan: _langchain_langgraph.BaseChannel<{
1306
+ steps: {
1307
+ id: string;
1308
+ description: string;
1309
+ tool?: string | undefined;
1310
+ args?: Record<string, any> | undefined;
1311
+ dependencies?: string[] | undefined;
1312
+ }[];
1313
+ goal: string;
1314
+ createdAt: string;
1315
+ confidence?: number | undefined;
1316
+ } | undefined, {
1317
+ steps: {
1318
+ id: string;
1319
+ description: string;
1320
+ tool?: string | undefined;
1321
+ args?: Record<string, any> | undefined;
1322
+ dependencies?: string[] | undefined;
1323
+ }[];
1324
+ goal: string;
1325
+ createdAt: string;
1326
+ confidence?: number | undefined;
1327
+ } | undefined, unknown>;
1328
+ pastSteps: _langchain_langgraph.BaseChannel<{
1329
+ timestamp: string;
1330
+ step: {
1331
+ id: string;
1332
+ description: string;
1333
+ tool?: string | undefined;
1334
+ args?: Record<string, any> | undefined;
1335
+ dependencies?: string[] | undefined;
1336
+ };
1337
+ success: boolean;
1338
+ result?: any;
1339
+ error?: string | undefined;
1340
+ }[], {
1341
+ timestamp: string;
1342
+ step: {
1343
+ id: string;
1344
+ description: string;
1345
+ tool?: string | undefined;
1346
+ args?: Record<string, any> | undefined;
1347
+ dependencies?: string[] | undefined;
1348
+ };
1349
+ success: boolean;
1350
+ result?: any;
1351
+ error?: string | undefined;
1352
+ }[], unknown>;
1353
+ currentStepIndex: _langchain_langgraph.BaseChannel<number | undefined, number | undefined, unknown>;
1354
+ status: _langchain_langgraph.BaseChannel<"failed" | "planning" | "executing" | "replanning" | "completed", "failed" | "planning" | "executing" | "replanning" | "completed", unknown>;
1355
+ response: _langchain_langgraph.BaseChannel<string | undefined, string | undefined, unknown>;
1356
+ error: _langchain_langgraph.BaseChannel<string | undefined, string | undefined, unknown>;
1357
+ iteration: _langchain_langgraph.BaseChannel<number, number, unknown>;
1358
+ maxIterations: _langchain_langgraph.BaseChannel<number, number, unknown>;
1359
+ }, {
1360
+ input: _langchain_langgraph.BaseChannel<string, string, unknown>;
1361
+ plan: _langchain_langgraph.BaseChannel<{
1362
+ steps: {
1363
+ id: string;
1364
+ description: string;
1365
+ tool?: string | undefined;
1366
+ args?: Record<string, any> | undefined;
1367
+ dependencies?: string[] | undefined;
1368
+ }[];
1369
+ goal: string;
1370
+ createdAt: string;
1371
+ confidence?: number | undefined;
1372
+ } | undefined, {
1373
+ steps: {
1374
+ id: string;
1375
+ description: string;
1376
+ tool?: string | undefined;
1377
+ args?: Record<string, any> | undefined;
1378
+ dependencies?: string[] | undefined;
1379
+ }[];
1380
+ goal: string;
1381
+ createdAt: string;
1382
+ confidence?: number | undefined;
1383
+ } | undefined, unknown>;
1384
+ pastSteps: _langchain_langgraph.BaseChannel<{
1385
+ timestamp: string;
1386
+ step: {
1387
+ id: string;
1388
+ description: string;
1389
+ tool?: string | undefined;
1390
+ args?: Record<string, any> | undefined;
1391
+ dependencies?: string[] | undefined;
1392
+ };
1393
+ success: boolean;
1394
+ result?: any;
1395
+ error?: string | undefined;
1396
+ }[], {
1397
+ timestamp: string;
1398
+ step: {
1399
+ id: string;
1400
+ description: string;
1401
+ tool?: string | undefined;
1402
+ args?: Record<string, any> | undefined;
1403
+ dependencies?: string[] | undefined;
1404
+ };
1405
+ success: boolean;
1406
+ result?: any;
1407
+ error?: string | undefined;
1408
+ }[], unknown>;
1409
+ currentStepIndex: _langchain_langgraph.BaseChannel<number | undefined, number | undefined, unknown>;
1410
+ status: _langchain_langgraph.BaseChannel<"failed" | "planning" | "executing" | "replanning" | "completed", "failed" | "planning" | "executing" | "replanning" | "completed", unknown>;
1411
+ response: _langchain_langgraph.BaseChannel<string | undefined, string | undefined, unknown>;
1412
+ error: _langchain_langgraph.BaseChannel<string | undefined, string | undefined, unknown>;
1413
+ iteration: _langchain_langgraph.BaseChannel<number, number, unknown>;
1414
+ maxIterations: _langchain_langgraph.BaseChannel<number, number, unknown>;
1415
+ }, _langchain_langgraph.StateDefinition, {
1416
+ planner: Partial<PlanExecuteStateType>;
1417
+ executor: Partial<PlanExecuteStateType>;
1418
+ finisher: Partial<PlanExecuteStateType>;
1419
+ replanner: Partial<PlanExecuteStateType>;
1420
+ }, unknown, unknown>;
1246
1421
 
1247
1422
  /**
1248
1423
  * Node Implementations for Plan-and-Execute Pattern
package/dist/index.d.ts CHANGED
@@ -1175,14 +1175,6 @@ type PlanExecuteRoute = 'execute' | 'replan' | 'finish' | 'error';
1175
1175
  */
1176
1176
  type PlanExecuteRouter = (state: PlanExecuteStateType) => PlanExecuteRoute;
1177
1177
 
1178
- /**
1179
- * Plan-and-Execute Agent Factory
1180
- *
1181
- * This module provides the main factory function for creating Plan-and-Execute agents.
1182
- *
1183
- * @module patterns/plan-execute/agent
1184
- */
1185
-
1186
1178
  /**
1187
1179
  * Create a Plan-and-Execute agent
1188
1180
  *
@@ -1242,7 +1234,190 @@ type PlanExecuteRouter = (state: PlanExecuteStateType) => PlanExecuteRoute;
1242
1234
  * );
1243
1235
  * ```
1244
1236
  */
1245
- declare function createPlanExecuteAgent(config: PlanExecuteAgentConfig): any;
1237
+ declare function createPlanExecuteAgent(config: PlanExecuteAgentConfig): _langchain_langgraph.CompiledStateGraph<{
1238
+ input: string;
1239
+ plan: {
1240
+ steps: {
1241
+ id: string;
1242
+ description: string;
1243
+ tool?: string | undefined;
1244
+ args?: Record<string, any> | undefined;
1245
+ dependencies?: string[] | undefined;
1246
+ }[];
1247
+ goal: string;
1248
+ createdAt: string;
1249
+ confidence?: number | undefined;
1250
+ } | undefined;
1251
+ pastSteps: {
1252
+ timestamp: string;
1253
+ step: {
1254
+ id: string;
1255
+ description: string;
1256
+ tool?: string | undefined;
1257
+ args?: Record<string, any> | undefined;
1258
+ dependencies?: string[] | undefined;
1259
+ };
1260
+ success: boolean;
1261
+ result?: any;
1262
+ error?: string | undefined;
1263
+ }[];
1264
+ currentStepIndex: number | undefined;
1265
+ status: "failed" | "planning" | "executing" | "replanning" | "completed";
1266
+ response: string | undefined;
1267
+ error: string | undefined;
1268
+ iteration: number;
1269
+ maxIterations: number;
1270
+ }, {
1271
+ input?: string | undefined;
1272
+ plan?: {
1273
+ steps: {
1274
+ id: string;
1275
+ description: string;
1276
+ tool?: string | undefined;
1277
+ args?: Record<string, any> | undefined;
1278
+ dependencies?: string[] | undefined;
1279
+ }[];
1280
+ goal: string;
1281
+ createdAt: string;
1282
+ confidence?: number | undefined;
1283
+ } | undefined;
1284
+ pastSteps?: {
1285
+ timestamp: string;
1286
+ step: {
1287
+ id: string;
1288
+ description: string;
1289
+ tool?: string | undefined;
1290
+ args?: Record<string, any> | undefined;
1291
+ dependencies?: string[] | undefined;
1292
+ };
1293
+ success: boolean;
1294
+ result?: any;
1295
+ error?: string | undefined;
1296
+ }[] | undefined;
1297
+ currentStepIndex?: number | undefined;
1298
+ status?: "failed" | "planning" | "executing" | "replanning" | "completed" | undefined;
1299
+ response?: string | undefined;
1300
+ error?: string | undefined;
1301
+ iteration?: number | undefined;
1302
+ maxIterations?: number | undefined;
1303
+ }, "__start__" | "executor" | "replanner" | "finisher" | "planner", {
1304
+ input: _langchain_langgraph.BaseChannel<string, string, unknown>;
1305
+ plan: _langchain_langgraph.BaseChannel<{
1306
+ steps: {
1307
+ id: string;
1308
+ description: string;
1309
+ tool?: string | undefined;
1310
+ args?: Record<string, any> | undefined;
1311
+ dependencies?: string[] | undefined;
1312
+ }[];
1313
+ goal: string;
1314
+ createdAt: string;
1315
+ confidence?: number | undefined;
1316
+ } | undefined, {
1317
+ steps: {
1318
+ id: string;
1319
+ description: string;
1320
+ tool?: string | undefined;
1321
+ args?: Record<string, any> | undefined;
1322
+ dependencies?: string[] | undefined;
1323
+ }[];
1324
+ goal: string;
1325
+ createdAt: string;
1326
+ confidence?: number | undefined;
1327
+ } | undefined, unknown>;
1328
+ pastSteps: _langchain_langgraph.BaseChannel<{
1329
+ timestamp: string;
1330
+ step: {
1331
+ id: string;
1332
+ description: string;
1333
+ tool?: string | undefined;
1334
+ args?: Record<string, any> | undefined;
1335
+ dependencies?: string[] | undefined;
1336
+ };
1337
+ success: boolean;
1338
+ result?: any;
1339
+ error?: string | undefined;
1340
+ }[], {
1341
+ timestamp: string;
1342
+ step: {
1343
+ id: string;
1344
+ description: string;
1345
+ tool?: string | undefined;
1346
+ args?: Record<string, any> | undefined;
1347
+ dependencies?: string[] | undefined;
1348
+ };
1349
+ success: boolean;
1350
+ result?: any;
1351
+ error?: string | undefined;
1352
+ }[], unknown>;
1353
+ currentStepIndex: _langchain_langgraph.BaseChannel<number | undefined, number | undefined, unknown>;
1354
+ status: _langchain_langgraph.BaseChannel<"failed" | "planning" | "executing" | "replanning" | "completed", "failed" | "planning" | "executing" | "replanning" | "completed", unknown>;
1355
+ response: _langchain_langgraph.BaseChannel<string | undefined, string | undefined, unknown>;
1356
+ error: _langchain_langgraph.BaseChannel<string | undefined, string | undefined, unknown>;
1357
+ iteration: _langchain_langgraph.BaseChannel<number, number, unknown>;
1358
+ maxIterations: _langchain_langgraph.BaseChannel<number, number, unknown>;
1359
+ }, {
1360
+ input: _langchain_langgraph.BaseChannel<string, string, unknown>;
1361
+ plan: _langchain_langgraph.BaseChannel<{
1362
+ steps: {
1363
+ id: string;
1364
+ description: string;
1365
+ tool?: string | undefined;
1366
+ args?: Record<string, any> | undefined;
1367
+ dependencies?: string[] | undefined;
1368
+ }[];
1369
+ goal: string;
1370
+ createdAt: string;
1371
+ confidence?: number | undefined;
1372
+ } | undefined, {
1373
+ steps: {
1374
+ id: string;
1375
+ description: string;
1376
+ tool?: string | undefined;
1377
+ args?: Record<string, any> | undefined;
1378
+ dependencies?: string[] | undefined;
1379
+ }[];
1380
+ goal: string;
1381
+ createdAt: string;
1382
+ confidence?: number | undefined;
1383
+ } | undefined, unknown>;
1384
+ pastSteps: _langchain_langgraph.BaseChannel<{
1385
+ timestamp: string;
1386
+ step: {
1387
+ id: string;
1388
+ description: string;
1389
+ tool?: string | undefined;
1390
+ args?: Record<string, any> | undefined;
1391
+ dependencies?: string[] | undefined;
1392
+ };
1393
+ success: boolean;
1394
+ result?: any;
1395
+ error?: string | undefined;
1396
+ }[], {
1397
+ timestamp: string;
1398
+ step: {
1399
+ id: string;
1400
+ description: string;
1401
+ tool?: string | undefined;
1402
+ args?: Record<string, any> | undefined;
1403
+ dependencies?: string[] | undefined;
1404
+ };
1405
+ success: boolean;
1406
+ result?: any;
1407
+ error?: string | undefined;
1408
+ }[], unknown>;
1409
+ currentStepIndex: _langchain_langgraph.BaseChannel<number | undefined, number | undefined, unknown>;
1410
+ status: _langchain_langgraph.BaseChannel<"failed" | "planning" | "executing" | "replanning" | "completed", "failed" | "planning" | "executing" | "replanning" | "completed", unknown>;
1411
+ response: _langchain_langgraph.BaseChannel<string | undefined, string | undefined, unknown>;
1412
+ error: _langchain_langgraph.BaseChannel<string | undefined, string | undefined, unknown>;
1413
+ iteration: _langchain_langgraph.BaseChannel<number, number, unknown>;
1414
+ maxIterations: _langchain_langgraph.BaseChannel<number, number, unknown>;
1415
+ }, _langchain_langgraph.StateDefinition, {
1416
+ planner: Partial<PlanExecuteStateType>;
1417
+ executor: Partial<PlanExecuteStateType>;
1418
+ finisher: Partial<PlanExecuteStateType>;
1419
+ replanner: Partial<PlanExecuteStateType>;
1420
+ }, unknown, unknown>;
1246
1421
 
1247
1422
  /**
1248
1423
  * Node Implementations for Plan-and-Execute Pattern
package/dist/index.js CHANGED
@@ -1276,19 +1276,30 @@ function createFinisherNode() {
1276
1276
  }
1277
1277
 
1278
1278
  // src/plan-execute/agent.ts
1279
+ var executorRouteMap = {
1280
+ execute: "executor",
1281
+ replan: "replanner",
1282
+ finish: "finisher",
1283
+ error: END2
1284
+ };
1285
+ var replannerRouteMap = {
1286
+ replan: "planner",
1287
+ execute: "executor",
1288
+ error: END2,
1289
+ finish: END2
1290
+ };
1279
1291
  function createPlanExecuteAgent(config) {
1280
1292
  const {
1281
1293
  planner,
1282
1294
  executor,
1283
1295
  replanner,
1284
1296
  maxIterations = 5,
1285
- verbose = false,
1286
1297
  checkpointer
1287
1298
  } = config;
1288
1299
  const plannerNode = createPlannerNode(planner);
1289
1300
  const executorNode = createExecutorNode(executor);
1290
1301
  const finisherNode = createFinisherNode();
1291
- const replannerNode = replanner ? createReplannerNode(replanner) : async (state) => ({ status: "executing" });
1302
+ const replannerNode = replanner ? createReplannerNode(replanner) : async () => ({ status: "executing" });
1292
1303
  const workflow = new StateGraph2(PlanExecuteState).addNode("planner", plannerNode).addNode("executor", executorNode).addNode("finisher", finisherNode).addNode("replanner", replannerNode);
1293
1304
  const routeAfterExecutor = (state) => {
1294
1305
  if (state.status === "failed") {
@@ -1324,24 +1335,13 @@ function createPlanExecuteAgent(config) {
1324
1335
  workflow.addConditionalEdges(
1325
1336
  "executor",
1326
1337
  routeAfterExecutor,
1327
- {
1328
- execute: "executor",
1329
- // Loop back to execute next step
1330
- replan: "replanner",
1331
- finish: "finisher",
1332
- error: END2
1333
- }
1338
+ executorRouteMap
1334
1339
  );
1335
1340
  workflow.addEdge("finisher", END2);
1336
1341
  workflow.addConditionalEdges(
1337
1342
  "replanner",
1338
1343
  routeAfterReplanner,
1339
- {
1340
- replan: "planner",
1341
- execute: "executor",
1342
- error: END2,
1343
- finish: END2
1344
- }
1344
+ replannerRouteMap
1345
1345
  );
1346
1346
  return workflow.compile(checkpointer ? { checkpointer } : void 0);
1347
1347
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge/patterns",
3
- "version": "0.15.12",
3
+ "version": "0.15.14",
4
4
  "description": "Production-ready agent workflow patterns for TypeScript including ReAct and Planner-Executor, built on LangGraph.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -41,13 +41,13 @@
41
41
  "url": "https://github.com/TVScoundrel/agentforge/issues"
42
42
  },
43
43
  "dependencies": {
44
- "@agentforge/core": "0.15.12",
44
+ "@agentforge/core": "0.15.14",
45
45
  "@langchain/core": "^1.1.17",
46
46
  "@langchain/langgraph": "^1.1.2",
47
47
  "zod": "^3.23.8"
48
48
  },
49
49
  "devDependencies": {
50
- "@agentforge/testing": "0.15.12",
50
+ "@agentforge/testing": "0.15.14",
51
51
  "@eslint/js": "^9.17.0",
52
52
  "@types/node": "^22.10.2",
53
53
  "eslint": "^9.17.0",