@botbotgo/agent-harness 0.0.92 → 0.0.93

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.
Files changed (39) hide show
  1. package/README.md +123 -31
  2. package/README.zh.md +78 -28
  3. package/dist/benchmark/upstream-runtime-ab-benchmark.d.ts +1 -1
  4. package/dist/benchmark/upstream-runtime-ab-benchmark.js +2 -1
  5. package/dist/config/workflows/langgraph-workflows.yaml +292 -0
  6. package/dist/contracts/types.d.ts +8 -3
  7. package/dist/init-project.js +7 -7
  8. package/dist/package-version.d.ts +1 -1
  9. package/dist/package-version.js +1 -1
  10. package/dist/runtime/agent-runtime-adapter.d.ts +48 -1
  11. package/dist/runtime/agent-runtime-adapter.js +1001 -50
  12. package/dist/runtime/harness.d.ts +2 -0
  13. package/dist/runtime/harness.js +55 -11
  14. package/dist/runtime/inventory.d.ts +1 -1
  15. package/dist/runtime/inventory.js +1 -1
  16. package/dist/runtime/langgraph-presets.d.ts +23 -0
  17. package/dist/runtime/langgraph-presets.js +165 -0
  18. package/dist/runtime/policy-engine.js +0 -5
  19. package/dist/runtime/support/compiled-binding.d.ts +4 -1
  20. package/dist/runtime/support/compiled-binding.js +24 -2
  21. package/dist/runtime/support/harness-support.js +3 -3
  22. package/dist/runtime/support/runtime-entry.js +1 -1
  23. package/dist/workspace/agent-binding-compiler.js +82 -8
  24. package/dist/workspace/compile.js +1 -3
  25. package/dist/workspace/object-loader.js +46 -5
  26. package/dist/workspace/support/agent-capabilities.js +2 -2
  27. package/dist/workspace/support/workspace-ref-utils.d.ts +2 -1
  28. package/dist/workspace/support/workspace-ref-utils.js +21 -0
  29. package/dist/workspace/validate.js +1 -1
  30. package/package.json +2 -2
  31. /package/dist/config/{backends.yaml → catalogs/backends.yaml} +0 -0
  32. /package/dist/config/{embedding-models.yaml → catalogs/embedding-models.yaml} +0 -0
  33. /package/dist/config/{mcp.yaml → catalogs/mcp.yaml} +0 -0
  34. /package/dist/config/{models.yaml → catalogs/models.yaml} +0 -0
  35. /package/dist/config/{stores.yaml → catalogs/stores.yaml} +0 -0
  36. /package/dist/config/{tools.yaml → catalogs/tools.yaml} +0 -0
  37. /package/dist/config/{vector-stores.yaml → catalogs/vector-stores.yaml} +0 -0
  38. /package/dist/config/{runtime-memory.yaml → runtime/runtime-memory.yaml} +0 -0
  39. /package/dist/config/{workspace.yaml → runtime/workspace.yaml} +0 -0
package/README.md CHANGED
@@ -75,8 +75,15 @@ Boundary documents live in:
75
75
  - `docs/feature-checklist.md`
76
76
  - `docs/long-term-memory.md`
77
77
  - `docs/app-task-pattern.md`
78
+ - `docs/model-layering.md`
78
79
  - `docs/coding-agent-guide.md`
79
80
 
81
+ Recommended orchestration shape for long-running flows:
82
+
83
+ - let callers select the host agent explicitly whenever possible
84
+ - use `backend: deepagent` when you want high-level execution semantics with minimal application wiring
85
+ - use `backend: langgraph` when approvals, recovery, and long-running orchestration need application-owned workflow control
86
+
80
87
  ## Why This Exists
81
88
 
82
89
  Most agent demos stop at execution.
@@ -111,16 +118,20 @@ Workspace layout:
111
118
  ```text
112
119
  your-workspace/
113
120
  config/
114
- workspace.yaml
115
121
  agent-context.md
116
- models.yaml
117
- embedding-models.yaml
118
- vector-stores.yaml
119
- stores.yaml
120
- runtime-memory.yaml
121
- backends.yaml
122
- tools.yaml
123
- mcp.yaml
122
+ runtime/
123
+ workspace.yaml
124
+ runtime-memory.yaml
125
+ catalogs/
126
+ models.yaml
127
+ embedding-models.yaml
128
+ vector-stores.yaml
129
+ stores.yaml
130
+ backends.yaml
131
+ tools.yaml
132
+ mcp.yaml
133
+ workflows/
134
+ langgraph-workflows.yaml
124
135
  agents/
125
136
  direct.yaml
126
137
  orchestra.yaml
@@ -250,7 +261,7 @@ const result = await run(runtime, {
250
261
  });
251
262
  ```
252
263
 
253
- `agentId: "auto"` evaluates ordered routing rules in `config/workspace.yaml`, then `routing.defaultAgentId`, and only falls back to model routing when `routing.modelRouting: true`.
264
+ `agentId: "auto"` evaluates ordered routing rules in `config/runtime/workspace.yaml`, then `routing.defaultAgentId`, and only falls back to model routing when `routing.modelRouting: true`.
254
265
 
255
266
  ### Stream Output And Events
256
267
 
@@ -355,16 +366,17 @@ Use Kubernetes-style YAML:
355
366
 
356
367
  Core workspace files:
357
368
 
358
- - `config/workspace.yaml`
369
+ - `config/runtime/workspace.yaml`
359
370
  - `config/agent-context.md`
360
- - `config/models.yaml`
361
- - `config/embedding-models.yaml`
362
- - `config/vector-stores.yaml`
363
- - `config/stores.yaml`
364
- - `config/runtime-memory.yaml`
365
- - `config/backends.yaml`
366
- - `config/tools.yaml`
367
- - `config/mcp.yaml`
371
+ - `config/catalogs/models.yaml`
372
+ - `config/catalogs/embedding-models.yaml`
373
+ - `config/catalogs/vector-stores.yaml`
374
+ - `config/catalogs/stores.yaml`
375
+ - `config/runtime/runtime-memory.yaml`
376
+ - `config/catalogs/backends.yaml`
377
+ - `config/catalogs/tools.yaml`
378
+ - `config/catalogs/mcp.yaml`
379
+ - `config/workflows/langgraph-workflows.yaml`
368
380
  - `config/agents/direct.yaml`
369
381
  - `config/agents/orchestra.yaml`
370
382
  - `resources/tools/`
@@ -375,13 +387,14 @@ Any other local module shape is not supported, and unsupported shapes are reject
375
387
 
376
388
  There are three main configuration layers:
377
389
 
378
- - runtime policy in `config/workspace.yaml`
379
- - reusable object catalogs in `config/*.yaml`
390
+ - runtime policy in `config/runtime/workspace.yaml`
391
+ - reusable object catalogs in `config/catalogs/*.yaml`
380
392
  - agent assembly in `config/agents/*.yaml`
381
393
 
382
- ### Temporary LangChain v1 Notes
394
+ ### Backend Guidance
383
395
 
384
396
  At the moment, the most stable path for complex production-style runs is `backend: deepagent`.
397
+ `backend: langgraph` now exists as an explicit adapter boundary for LangGraph-shaped runtime entry design, but it still reuses the current LangChain-style runnable path internally rather than exposing a fully custom graph DSL.
385
398
 
386
399
  Current temporary limits on the `backend: langchain-v1` path are:
387
400
 
@@ -392,9 +405,88 @@ Current temporary limits on the `backend: langchain-v1` path are:
392
405
  Practical guidance:
393
406
 
394
407
  - use `backend: deepagent` for approvals, resume, multi-agent orchestration, rich memory flows, and heavier tool chains
408
+ - use `backend: langgraph` when you want the agent to bind to a built-in preset or an explicit LangGraph workflow resource in config
395
409
  - keep `backend: langchain-v1` for lighter direct-response or explicitly chosen V1 agent shapes while this upstream behavior settles
396
410
 
397
- ### `config/workspace.yaml`
411
+ Minimal Kubernetes-style LangGraph example:
412
+
413
+ ```yaml
414
+ apiVersion: agent-harness/v1alpha1
415
+ kind: LangGraphWorkflows
416
+ spec:
417
+ - id: default
418
+ entryNode: planner
419
+ nodes:
420
+ - id: planner
421
+ kind: planner
422
+ - id: executor
423
+ kind: executor
424
+ edges:
425
+ - from: planner
426
+ to: executor
427
+ ```
428
+
429
+ ```yaml
430
+ apiVersion: agent-harness/v1alpha1
431
+ kind: Agent
432
+ metadata:
433
+ name: graph-entry
434
+ spec:
435
+ runtime:
436
+ runRoot: ./.agent
437
+ execution:
438
+ backend: langgraph
439
+ modelRef: model/default
440
+ config:
441
+ preset: review-loop
442
+ ```
443
+
444
+ Built-in LangGraph presets currently supported:
445
+
446
+ - `react`
447
+ - `prompt-chaining`
448
+ - `routing`
449
+ - `parallelization`
450
+ - `plan-execute`
451
+ - `review-loop`
452
+ - `evaluator-optimizer`
453
+ - `approval-gate`
454
+ - `handoff`
455
+ - `orchestrator-workers`
456
+
457
+ The repository also checks in matching YAML workflow resources for these patterns in
458
+ `config/workflows/langgraph-workflows.yaml`, so applications can reference them directly with
459
+ `workflow.ref: langgraph-workflow/<pattern-id>`.
460
+
461
+ For specialist-driven presets such as `routing`, `parallelization`, `handoff`, and `orchestrator-workers`, also set:
462
+
463
+ ```yaml
464
+ config:
465
+ preset: handoff
466
+ specialist: researcher
467
+ ```
468
+
469
+ These presets are harness-owned workflow templates built on top of the LangGraph backend. They are not LangGraph-native node kinds or edge conditions.
470
+
471
+ Use an explicit workflow ref when an application wants full graph control:
472
+
473
+ ```yaml
474
+ apiVersion: agent-harness/v1alpha1
475
+ kind: Agent
476
+ metadata:
477
+ name: graph-entry
478
+ spec:
479
+ runtime:
480
+ runRoot: ./.agent
481
+ execution:
482
+ backend: langgraph
483
+ modelRef: model/default
484
+ config:
485
+ workflow:
486
+ ref: langgraph-workflow/default
487
+ ```
488
+
489
+ ### `config/runtime/workspace.yaml`
398
490
 
399
491
  Use this file for workspace-wide runtime policy.
400
492
 
@@ -450,7 +542,7 @@ Use this file for shared bootstrap memory loaded at agent construction time.
450
542
 
451
543
  Keep stable project context here. Treat it as startup context, not mutable long-term memory.
452
544
 
453
- ### `config/models.yaml`
545
+ ### `config/catalogs/models.yaml`
454
546
 
455
547
  Use named chat-model presets:
456
548
 
@@ -466,15 +558,15 @@ spec:
466
558
 
467
559
  These load as `model/default`.
468
560
 
469
- ### `config/embedding-models.yaml`
561
+ ### `config/catalogs/embedding-models.yaml`
470
562
 
471
563
  Use named embedding-model presets for retrieval-oriented tools.
472
564
 
473
- ### `config/vector-stores.yaml`
565
+ ### `config/catalogs/vector-stores.yaml`
474
566
 
475
567
  Use named vector-store presets referenced by retrieval tools.
476
568
 
477
- ### `config/stores.yaml`
569
+ ### `config/catalogs/stores.yaml`
478
570
 
479
571
  Use reusable store and checkpointer presets:
480
572
 
@@ -495,13 +587,13 @@ spec:
495
587
  path: checkpoints.sqlite
496
588
  ```
497
589
 
498
- ### `config/runtime-memory.yaml`
590
+ ### `config/runtime/runtime-memory.yaml`
499
591
 
500
592
  Use this singleton file for runtime-owned durable long-term memory defaults.
501
593
 
502
594
  Keep bootstrap context in `config/agent-context.md`. Keep resumable execution state in the checkpointer. Use `RuntimeMemory` for durable memory policy and retrieval defaults.
503
595
 
504
- ### `config/backends.yaml`
596
+ ### `config/catalogs/backends.yaml`
505
597
 
506
598
  Use reusable DeepAgents backend presets so filesystem and `/memories/*` topology stays in YAML:
507
599
 
@@ -522,13 +614,13 @@ spec:
522
614
  kind: StoreBackend
523
615
  ```
524
616
 
525
- ### `config/tools.yaml`
617
+ ### `config/catalogs/tools.yaml`
526
618
 
527
619
  Use this file for reusable tool objects.
528
620
 
529
621
  Built-in tool families include function tools, backend tools, MCP tools, bundles, and provider-native tools. Provider-native tools are declared in YAML and resolved directly to upstream factories.
530
622
 
531
- ### `config/mcp.yaml`
623
+ ### `config/catalogs/mcp.yaml`
532
624
 
533
625
  Use this file for named MCP server presets.
534
626
 
package/README.zh.md CHANGED
@@ -75,8 +75,15 @@
75
75
  - `docs/feature-checklist.md`
76
76
  - `docs/long-term-memory.md`
77
77
  - `docs/app-task-pattern.md`
78
+ - `docs/model-layering.md`
78
79
  - `docs/coding-agent-guide.md`
79
80
 
81
+ 长链路编排的推荐形态:
82
+
83
+ - 尽量由调用方显式指定要运行的 host agent
84
+ - 想用高层执行语义、少写应用编排时,优先选择 `backend: deepagent`
85
+ - 当 approvals、recovery 与长链路 orchestration 需要由应用自己控制时,使用 `backend: langgraph`
86
+
80
87
  ## 为何需要它
81
88
 
82
89
  多数 agent 演示停在「能跑」。
@@ -111,15 +118,20 @@ npm install @botbotgo/agent-harness
111
118
  ```text
112
119
  your-workspace/
113
120
  config/
114
- workspace.yaml
115
121
  agent-context.md
116
- models.yaml
117
- embedding-models.yaml
118
- vector-stores.yaml
119
- stores.yaml
120
- backends.yaml
121
- tools.yaml
122
- mcp.yaml
122
+ runtime/
123
+ workspace.yaml
124
+ runtime-memory.yaml
125
+ catalogs/
126
+ models.yaml
127
+ embedding-models.yaml
128
+ vector-stores.yaml
129
+ stores.yaml
130
+ backends.yaml
131
+ tools.yaml
132
+ mcp.yaml
133
+ workflows/
134
+ langgraph-workflows.yaml
123
135
  agents/
124
136
  direct.yaml
125
137
  orchestra.yaml
@@ -249,7 +261,7 @@ const result = await run(runtime, {
249
261
  });
250
262
  ```
251
263
 
252
- `agentId: "auto"` 会按顺序评估 `config/workspace.yaml` 中的路由规则,再使用 `routing.defaultAgentId`,且仅当 `routing.modelRouting: true` 时才回退到模型路由。
264
+ `agentId: "auto"` 会按顺序评估 `config/runtime/workspace.yaml` 中的路由规则,再使用 `routing.defaultAgentId`,且仅当 `routing.modelRouting: true` 时才回退到模型路由。
253
265
 
254
266
  ### 流式输出与事件
255
267
 
@@ -354,15 +366,17 @@ await stop(runtime);
354
366
 
355
367
  核心工作区文件:
356
368
 
357
- - `config/workspace.yaml`
369
+ - `config/runtime/workspace.yaml`
358
370
  - `config/agent-context.md`
359
- - `config/models.yaml`
360
- - `config/embedding-models.yaml`
361
- - `config/vector-stores.yaml`
362
- - `config/stores.yaml`
363
- - `config/backends.yaml`
364
- - `config/tools.yaml`
365
- - `config/mcp.yaml`
371
+ - `config/catalogs/models.yaml`
372
+ - `config/catalogs/embedding-models.yaml`
373
+ - `config/catalogs/vector-stores.yaml`
374
+ - `config/catalogs/stores.yaml`
375
+ - `config/runtime/runtime-memory.yaml`
376
+ - `config/catalogs/backends.yaml`
377
+ - `config/catalogs/tools.yaml`
378
+ - `config/catalogs/mcp.yaml`
379
+ - `config/workflows/langgraph-workflows.yaml`
366
380
  - `config/agents/direct.yaml`
367
381
  - `config/agents/orchestra.yaml`
368
382
  - `resources/tools/`
@@ -373,13 +387,14 @@ await stop(runtime);
373
387
 
374
388
  主要有三层配置:
375
389
 
376
- - `config/workspace.yaml` 中的运行时策略
377
- - `config/*.yaml` 中的可复用对象目录
390
+ - `config/runtime/workspace.yaml` 中的运行时策略
391
+ - `config/catalogs/*.yaml` 中的可复用对象目录
378
392
  - `config/agents/*.yaml` 中的 agent 装配
379
393
 
380
- ### LangChain v1 的暂时说明
394
+ ### Backend 选择建议
381
395
 
382
396
  当前对于复杂、生产化风格的运行链路,最稳定的路径仍然是 `backend: deepagent`。
397
+ 现在也支持 `backend: langgraph` 作为显式的 LangGraph 风格 adapter 边界;不过内部实现当前仍复用现有 LangChain runnable 路径,还不是完整自定义 graph DSL。
383
398
 
384
399
  目前 `backend: langchain-v1` 这条路径的暂时限制是:
385
400
 
@@ -390,9 +405,44 @@ await stop(runtime);
390
405
  实际建议:
391
406
 
392
407
  - approvals、resume、多 agent orchestration、复杂 memory 流、重工具链,优先使用 `backend: deepagent`
408
+ - 如果你想让 agent 在配置层显式绑定到一个 LangGraph workflow 资源,使用 `backend: langgraph`
393
409
  - `backend: langchain-v1` 先保留给轻量 direct-response 场景,或明确需要 V1 agent 语义的工作区
394
410
 
395
- ### `config/workspace.yaml`
411
+ 最小的 Kubernetes 风格 LangGraph 示例:
412
+
413
+ ```yaml
414
+ apiVersion: agent-harness/v1alpha1
415
+ kind: LangGraphWorkflows
416
+ spec:
417
+ - id: default
418
+ entryNode: planner
419
+ nodes:
420
+ - id: planner
421
+ kind: planner
422
+ - id: executor
423
+ kind: executor
424
+ edges:
425
+ - from: planner
426
+ to: executor
427
+ ```
428
+
429
+ ```yaml
430
+ apiVersion: agent-harness/v1alpha1
431
+ kind: Agent
432
+ metadata:
433
+ name: graph-entry
434
+ spec:
435
+ runtime:
436
+ runRoot: ./.agent
437
+ execution:
438
+ backend: langgraph
439
+ modelRef: model/default
440
+ config:
441
+ workflow:
442
+ ref: langgraph-workflow/default
443
+ ```
444
+
445
+ ### `config/runtime/workspace.yaml`
396
446
 
397
447
  用于工作区范围的运行时策略。
398
448
 
@@ -448,7 +498,7 @@ spec:
448
498
 
449
499
  在此放置稳定的项目上下文;视为启动上下文,而非可变长期记忆。
450
500
 
451
- ### `config/models.yaml`
501
+ ### `config/catalogs/models.yaml`
452
502
 
453
503
  命名聊天模型预设:
454
504
 
@@ -464,15 +514,15 @@ spec:
464
514
 
465
515
  加载为 `model/default`。
466
516
 
467
- ### `config/embedding-models.yaml`
517
+ ### `config/catalogs/embedding-models.yaml`
468
518
 
469
519
  面向检索类工具的命名嵌入模型预设。
470
520
 
471
- ### `config/vector-stores.yaml`
521
+ ### `config/catalogs/vector-stores.yaml`
472
522
 
473
523
  检索工具引用的命名向量库预设。
474
524
 
475
- ### `config/stores.yaml`
525
+ ### `config/catalogs/stores.yaml`
476
526
 
477
527
  可复用的存储与 checkpointer 预设:
478
528
 
@@ -493,7 +543,7 @@ spec:
493
543
  path: checkpoints.sqlite
494
544
  ```
495
545
 
496
- ### `config/backends.yaml`
546
+ ### `config/catalogs/backends.yaml`
497
547
 
498
548
  可复用的 DeepAgents 后端预设,使文件系统与 `/memories/*` 拓扑保留在 YAML 中:
499
549
 
@@ -514,13 +564,13 @@ spec:
514
564
  kind: StoreBackend
515
565
  ```
516
566
 
517
- ### `config/tools.yaml`
567
+ ### `config/catalogs/tools.yaml`
518
568
 
519
569
  可复用工具对象。
520
570
 
521
571
  内置工具族包括函数工具、后端工具、MCP 工具、bundle 与原生 provider 工具。原生 provider 工具在 YAML 中声明并直接解析到上游工厂。
522
572
 
523
- ### `config/mcp.yaml`
573
+ ### `config/catalogs/mcp.yaml`
524
574
 
525
575
  命名 MCP 服务预设。
526
576
 
@@ -1,4 +1,4 @@
1
- export declare const DEFAULT_UPSTREAM_BENCHMARK_PATHS: readonly ["harness", "raw-langchain-v1", "raw-deepagent"];
1
+ export declare const DEFAULT_UPSTREAM_BENCHMARK_PATHS: readonly ["harness", "raw-langchain-v1", "raw-langgraph", "raw-deepagent"];
2
2
  export declare const DEFAULT_UPSTREAM_BENCHMARK_WORKLOAD: "tool";
3
3
  export type UpstreamBenchmarkPath = (typeof DEFAULT_UPSTREAM_BENCHMARK_PATHS)[number];
4
4
  export type UpstreamBenchmarkWorkload = "tool" | "no-tool";
@@ -1,6 +1,7 @@
1
1
  export const DEFAULT_UPSTREAM_BENCHMARK_PATHS = Object.freeze([
2
2
  "harness",
3
3
  "raw-langchain-v1",
4
+ "raw-langgraph",
4
5
  "raw-deepagent",
5
6
  ]);
6
7
  export const DEFAULT_UPSTREAM_BENCHMARK_WORKLOAD = "tool";
@@ -47,7 +48,7 @@ export function resolveUpstreamBenchmarkPaths(rawValue) {
47
48
  const parsed = rawValue
48
49
  .split(",")
49
50
  .map((value) => value.trim().toLowerCase())
50
- .filter((value) => value === "harness" || value === "raw-langchain-v1" || value === "raw-deepagent");
51
+ .filter((value) => value === "harness" || value === "raw-langchain-v1" || value === "raw-langgraph" || value === "raw-deepagent");
51
52
  return parsed.length > 0 ? parsed : [...DEFAULT_UPSTREAM_BENCHMARK_PATHS];
52
53
  }
53
54
  export function resolveUpstreamBenchmarkWorkload(rawValue) {