@botbotgo/agent-harness 0.0.92 → 0.0.94

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 (41) hide show
  1. package/README.md +153 -31
  2. package/README.zh.md +108 -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 +318 -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 +49 -1
  11. package/dist/runtime/agent-runtime-adapter.js +1103 -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 +25 -0
  17. package/dist/runtime/langgraph-presets.js +165 -0
  18. package/dist/runtime/langgraph-profiles.d.ts +6 -0
  19. package/dist/runtime/langgraph-profiles.js +206 -0
  20. package/dist/runtime/policy-engine.js +0 -5
  21. package/dist/runtime/support/compiled-binding.d.ts +4 -1
  22. package/dist/runtime/support/compiled-binding.js +24 -2
  23. package/dist/runtime/support/harness-support.js +3 -3
  24. package/dist/runtime/support/runtime-entry.js +1 -1
  25. package/dist/workspace/agent-binding-compiler.js +111 -8
  26. package/dist/workspace/compile.js +1 -3
  27. package/dist/workspace/object-loader.js +46 -5
  28. package/dist/workspace/support/agent-capabilities.js +2 -2
  29. package/dist/workspace/support/workspace-ref-utils.d.ts +2 -1
  30. package/dist/workspace/support/workspace-ref-utils.js +21 -0
  31. package/dist/workspace/validate.js +1 -1
  32. package/package.json +2 -2
  33. /package/dist/config/{backends.yaml → catalogs/backends.yaml} +0 -0
  34. /package/dist/config/{embedding-models.yaml → catalogs/embedding-models.yaml} +0 -0
  35. /package/dist/config/{mcp.yaml → catalogs/mcp.yaml} +0 -0
  36. /package/dist/config/{models.yaml → catalogs/models.yaml} +0 -0
  37. /package/dist/config/{stores.yaml → catalogs/stores.yaml} +0 -0
  38. /package/dist/config/{tools.yaml → catalogs/tools.yaml} +0 -0
  39. /package/dist/config/{vector-stores.yaml → catalogs/vector-stores.yaml} +0 -0
  40. /package/dist/config/{runtime-memory.yaml → runtime/runtime-memory.yaml} +0 -0
  41. /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,118 @@ 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: llm
422
+ role: planner
423
+ - id: executor
424
+ kind: agent
425
+ edges:
426
+ - from: planner
427
+ to: executor
428
+ ```
429
+
430
+ ```yaml
431
+ apiVersion: agent-harness/v1alpha1
432
+ kind: Agent
433
+ metadata:
434
+ name: graph-entry
435
+ spec:
436
+ runtime:
437
+ runRoot: ./.agent
438
+ execution:
439
+ backend: langgraph
440
+ modelRef: model/default
441
+ config:
442
+ preset: review-loop
443
+ ```
444
+
445
+ Built-in LangGraph presets currently supported:
446
+
447
+ - `react`
448
+ - `prompt-chaining`
449
+ - `routing`
450
+ - `parallelization`
451
+ - `plan-execute`
452
+ - `review-loop`
453
+ - `evaluator-optimizer`
454
+ - `approval-gate`
455
+ - `handoff`
456
+ - `orchestrator-workers`
457
+
458
+ The repository also checks in matching YAML workflow resources for these patterns in
459
+ `config/workflows/langgraph-workflows.yaml`, so applications can reference them directly with
460
+ `workflow.ref: langgraph-workflow/<pattern-id>`.
461
+
462
+ For agent-driven presets such as `routing`, `parallelization`, `handoff`, and `orchestrator-workers`, also set:
463
+
464
+ ```yaml
465
+ config:
466
+ preset: handoff
467
+ agent: researcher
468
+ ```
469
+
470
+ LangGraph also supports profile-first entry config for common application shapes:
471
+
472
+ - `coding-runtime`
473
+ - `personal-assistant`
474
+ - `research-runtime`
475
+ - `approval-review-runtime`
476
+ - `claw-style-assistant`
477
+ - `chat-operator`
478
+ - `copilot-sidecar`
479
+ - `task-delegation-hub`
480
+
481
+ ```yaml
482
+ config:
483
+ profile: copilot-sidecar
484
+ with:
485
+ coderAgent: repo-coder-lite
486
+ ```
487
+
488
+ These presets are harness-owned workflow templates built on top of the LangGraph backend. They are not LangGraph-native node kinds or edge conditions.
489
+
490
+ Current workflow primitive node kinds:
491
+
492
+ - `llm`
493
+ - `agent`
494
+ - `tool`
495
+ - `approval`
496
+ - `condition`
497
+
498
+ Only these primitive node kinds are supported in workflow YAML. Role-shaped names such as `planner`, `reviewer`,
499
+ `replanner`, `specialist`, `executor`, and `finalizer` are not part of the final DSL.
500
+
501
+ Use an explicit workflow ref when an application wants full graph control:
502
+
503
+ ```yaml
504
+ apiVersion: agent-harness/v1alpha1
505
+ kind: Agent
506
+ metadata:
507
+ name: graph-entry
508
+ spec:
509
+ runtime:
510
+ runRoot: ./.agent
511
+ execution:
512
+ backend: langgraph
513
+ modelRef: model/default
514
+ config:
515
+ workflow:
516
+ ref: langgraph-workflow/default
517
+ ```
518
+
519
+ ### `config/runtime/workspace.yaml`
398
520
 
399
521
  Use this file for workspace-wide runtime policy.
400
522
 
@@ -450,7 +572,7 @@ Use this file for shared bootstrap memory loaded at agent construction time.
450
572
 
451
573
  Keep stable project context here. Treat it as startup context, not mutable long-term memory.
452
574
 
453
- ### `config/models.yaml`
575
+ ### `config/catalogs/models.yaml`
454
576
 
455
577
  Use named chat-model presets:
456
578
 
@@ -466,15 +588,15 @@ spec:
466
588
 
467
589
  These load as `model/default`.
468
590
 
469
- ### `config/embedding-models.yaml`
591
+ ### `config/catalogs/embedding-models.yaml`
470
592
 
471
593
  Use named embedding-model presets for retrieval-oriented tools.
472
594
 
473
- ### `config/vector-stores.yaml`
595
+ ### `config/catalogs/vector-stores.yaml`
474
596
 
475
597
  Use named vector-store presets referenced by retrieval tools.
476
598
 
477
- ### `config/stores.yaml`
599
+ ### `config/catalogs/stores.yaml`
478
600
 
479
601
  Use reusable store and checkpointer presets:
480
602
 
@@ -495,13 +617,13 @@ spec:
495
617
  path: checkpoints.sqlite
496
618
  ```
497
619
 
498
- ### `config/runtime-memory.yaml`
620
+ ### `config/runtime/runtime-memory.yaml`
499
621
 
500
622
  Use this singleton file for runtime-owned durable long-term memory defaults.
501
623
 
502
624
  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
625
 
504
- ### `config/backends.yaml`
626
+ ### `config/catalogs/backends.yaml`
505
627
 
506
628
  Use reusable DeepAgents backend presets so filesystem and `/memories/*` topology stays in YAML:
507
629
 
@@ -522,13 +644,13 @@ spec:
522
644
  kind: StoreBackend
523
645
  ```
524
646
 
525
- ### `config/tools.yaml`
647
+ ### `config/catalogs/tools.yaml`
526
648
 
527
649
  Use this file for reusable tool objects.
528
650
 
529
651
  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
652
 
531
- ### `config/mcp.yaml`
653
+ ### `config/catalogs/mcp.yaml`
532
654
 
533
655
  Use this file for named MCP server presets.
534
656
 
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,74 @@ 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: llm
422
+ role: planner
423
+ - id: executor
424
+ kind: agent
425
+ edges:
426
+ - from: planner
427
+ to: executor
428
+ ```
429
+
430
+ 当前建议优先使用的 workflow primitive node kinds:
431
+
432
+ - `llm`
433
+ - `agent`
434
+ - `tool`
435
+ - `approval`
436
+ - `condition`
437
+
438
+ 最终版 workflow YAML 只支持这些 primitive node kinds。`planner`、`reviewer`、`replanner`、`specialist`、
439
+ `executor`、`finalizer` 这类角色型名字不属于最终 DSL。
440
+
441
+ LangGraph 也支持面向常见应用入口的 profile-first 配置:
442
+
443
+ - `coding-runtime`
444
+ - `personal-assistant`
445
+ - `research-runtime`
446
+ - `approval-review-runtime`
447
+ - `claw-style-assistant`
448
+ - `chat-operator`
449
+ - `copilot-sidecar`
450
+ - `task-delegation-hub`
451
+
452
+ ```yaml
453
+ config:
454
+ profile: copilot-sidecar
455
+ with:
456
+ coderAgent: repo-coder-lite
457
+ ```
458
+
459
+ ```yaml
460
+ apiVersion: agent-harness/v1alpha1
461
+ kind: Agent
462
+ metadata:
463
+ name: graph-entry
464
+ spec:
465
+ runtime:
466
+ runRoot: ./.agent
467
+ execution:
468
+ backend: langgraph
469
+ modelRef: model/default
470
+ config:
471
+ workflow:
472
+ ref: langgraph-workflow/default
473
+ ```
474
+
475
+ ### `config/runtime/workspace.yaml`
396
476
 
397
477
  用于工作区范围的运行时策略。
398
478
 
@@ -448,7 +528,7 @@ spec:
448
528
 
449
529
  在此放置稳定的项目上下文;视为启动上下文,而非可变长期记忆。
450
530
 
451
- ### `config/models.yaml`
531
+ ### `config/catalogs/models.yaml`
452
532
 
453
533
  命名聊天模型预设:
454
534
 
@@ -464,15 +544,15 @@ spec:
464
544
 
465
545
  加载为 `model/default`。
466
546
 
467
- ### `config/embedding-models.yaml`
547
+ ### `config/catalogs/embedding-models.yaml`
468
548
 
469
549
  面向检索类工具的命名嵌入模型预设。
470
550
 
471
- ### `config/vector-stores.yaml`
551
+ ### `config/catalogs/vector-stores.yaml`
472
552
 
473
553
  检索工具引用的命名向量库预设。
474
554
 
475
- ### `config/stores.yaml`
555
+ ### `config/catalogs/stores.yaml`
476
556
 
477
557
  可复用的存储与 checkpointer 预设:
478
558
 
@@ -493,7 +573,7 @@ spec:
493
573
  path: checkpoints.sqlite
494
574
  ```
495
575
 
496
- ### `config/backends.yaml`
576
+ ### `config/catalogs/backends.yaml`
497
577
 
498
578
  可复用的 DeepAgents 后端预设,使文件系统与 `/memories/*` 拓扑保留在 YAML 中:
499
579
 
@@ -514,13 +594,13 @@ spec:
514
594
  kind: StoreBackend
515
595
  ```
516
596
 
517
- ### `config/tools.yaml`
597
+ ### `config/catalogs/tools.yaml`
518
598
 
519
599
  可复用工具对象。
520
600
 
521
601
  内置工具族包括函数工具、后端工具、MCP 工具、bundle 与原生 provider 工具。原生 provider 工具在 YAML 中声明并直接解析到上游工厂。
522
602
 
523
- ### `config/mcp.yaml`
603
+ ### `config/catalogs/mcp.yaml`
524
604
 
525
605
  命名 MCP 服务预设。
526
606
 
@@ -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) {