@botbotgo/agent-harness 0.0.9 → 0.0.10
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/README.md +269 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
# @botbotgo/agent-harness
|
|
2
|
+
|
|
3
|
+
`@botbotgo/agent-harness` is a TypeScript framework for running local agent workspaces with declarative config, reusable tools, reusable skills, and configurable host-agent routing.
|
|
4
|
+
|
|
5
|
+
It is designed for two common use cases:
|
|
6
|
+
|
|
7
|
+
- build a reusable agent runtime package and publish it to npm
|
|
8
|
+
- build an application workspace that ships its own agents, tools, skills, and model config
|
|
9
|
+
|
|
10
|
+
The public API stays intentionally small:
|
|
11
|
+
|
|
12
|
+
- `createAgentHarness(...)`
|
|
13
|
+
- `run(...)`
|
|
14
|
+
- `subscribe(...)`
|
|
15
|
+
- `getThread(...)`
|
|
16
|
+
- `stop(...)`
|
|
17
|
+
|
|
18
|
+
## Product Overview
|
|
19
|
+
|
|
20
|
+
Agent Harness loads a workspace from disk, compiles its config into runnable agent bindings, and executes requests through either a lightweight LangChain v1 path or a DeepAgent path.
|
|
21
|
+
|
|
22
|
+
Out of the box, the framework supports:
|
|
23
|
+
|
|
24
|
+
- workspace loading from a directory root
|
|
25
|
+
- declarative `Model`, `EmbeddingModel`, `VectorStore`, `LangChainAgent`, `DeepAgent`, and `Runtime` objects
|
|
26
|
+
- host-agent routing between a direct path and an orchestration path
|
|
27
|
+
- tool loading from resource packages and external sources
|
|
28
|
+
- skill discovery from filesystem roots
|
|
29
|
+
- subagent discovery from filesystem roots
|
|
30
|
+
- thread persistence, run history, and resumable state
|
|
31
|
+
|
|
32
|
+
The default package config in this repo shows the intended model:
|
|
33
|
+
|
|
34
|
+
- `direct`: low-latency host for simple one-step requests
|
|
35
|
+
- `orchestra`: default host for multi-step work, tools, skills, and delegation
|
|
36
|
+
|
|
37
|
+
## Quick Start
|
|
38
|
+
|
|
39
|
+
Install the package:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install @botbotgo/agent-harness
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Create a workspace with at least:
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
your-workspace/
|
|
49
|
+
AGENTS.md
|
|
50
|
+
config/
|
|
51
|
+
model.yaml
|
|
52
|
+
runtime.yaml
|
|
53
|
+
direct.yaml
|
|
54
|
+
orchestra.yaml
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Minimal usage:
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import { createAgentHarness, run, stop } from "@botbotgo/agent-harness";
|
|
61
|
+
|
|
62
|
+
const harness = await createAgentHarness("/absolute/path/to/your-workspace");
|
|
63
|
+
|
|
64
|
+
try {
|
|
65
|
+
const result = await run(harness, {
|
|
66
|
+
agentId: "direct",
|
|
67
|
+
input: "Summarize what this workspace is for.",
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
console.log(result.output);
|
|
71
|
+
} finally {
|
|
72
|
+
await stop(harness);
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
If you want the framework to choose the host agent automatically, pass `agentId: "auto"` when your workspace has runtime routing configured.
|
|
77
|
+
|
|
78
|
+
## How To Use
|
|
79
|
+
|
|
80
|
+
There are two common ways to use the framework.
|
|
81
|
+
|
|
82
|
+
### 1. Use It As A Library
|
|
83
|
+
|
|
84
|
+
Load a workspace from disk and run requests through the public API.
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
import { createAgentHarness, getThread, run, subscribe, stop } from "@botbotgo/agent-harness";
|
|
88
|
+
|
|
89
|
+
const harness = await createAgentHarness("/absolute/path/to/workspace");
|
|
90
|
+
|
|
91
|
+
const unsubscribe = subscribe(harness, (event) => {
|
|
92
|
+
console.log(event.eventType, event.payload);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
try {
|
|
96
|
+
const firstRun = await run(harness, {
|
|
97
|
+
agentId: "orchestra",
|
|
98
|
+
input: "Inspect the workspace and explain the available agents.",
|
|
99
|
+
listeners: {
|
|
100
|
+
onChunk(chunk) {
|
|
101
|
+
process.stdout.write(chunk);
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const thread = await getThread(harness, firstRun.threadId);
|
|
107
|
+
console.log(thread?.messages.at(-1)?.content);
|
|
108
|
+
} finally {
|
|
109
|
+
unsubscribe();
|
|
110
|
+
await stop(harness);
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 2. Use It Inside An App Workspace
|
|
115
|
+
|
|
116
|
+
The example app in [`examples/stock-research-app`](/Users/boqiang.liang/900-project/agent-harness3/examples/stock-research-app/README.md) is the reference shape for an application workspace. It keeps the framework package separate from app-specific agents, tools, and skills.
|
|
117
|
+
|
|
118
|
+
Run the example:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
cd examples/stock-research-app
|
|
122
|
+
npm install
|
|
123
|
+
npm run start -- "Investigate NVDA and produce a balanced stock research brief."
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## How To Configure
|
|
127
|
+
|
|
128
|
+
Agent Harness is workspace-first. The runtime is assembled from files on disk rather than from a large constructor API.
|
|
129
|
+
|
|
130
|
+
### Core Files
|
|
131
|
+
|
|
132
|
+
- `AGENTS.md`: durable instructions and operating rules loaded into agent memory where configured
|
|
133
|
+
- `config/model.yaml`: default chat model
|
|
134
|
+
- `config/runtime.yaml`: workspace-wide runtime defaults such as `runRoot` and host routing
|
|
135
|
+
- `config/direct.yaml`: lightweight direct-response host agent
|
|
136
|
+
- `config/orchestra.yaml`: default orchestration host agent
|
|
137
|
+
- `config/embedding-model.yaml`: embeddings preset for retrieval flows
|
|
138
|
+
- `config/vector-store.yaml`: vector store preset for retrieval flows
|
|
139
|
+
|
|
140
|
+
### Minimal Model Config
|
|
141
|
+
|
|
142
|
+
```yaml
|
|
143
|
+
apiVersion: agent-harness/v1alpha1
|
|
144
|
+
kind: Model
|
|
145
|
+
metadata:
|
|
146
|
+
name: default
|
|
147
|
+
spec:
|
|
148
|
+
provider: ollama
|
|
149
|
+
model: gpt-oss:latest
|
|
150
|
+
init:
|
|
151
|
+
baseUrl: http://localhost:11434
|
|
152
|
+
temperature: 0.2
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Runtime Routing
|
|
156
|
+
|
|
157
|
+
`config/runtime.yaml` controls shared runtime behavior. In this repo it defines:
|
|
158
|
+
|
|
159
|
+
- `runRoot`: where thread state, run artifacts, approvals, and indexes are stored
|
|
160
|
+
- `routing.systemPrompt`: how the harness chooses between the primary and secondary host agents when `agentId: "auto"` is used
|
|
161
|
+
|
|
162
|
+
### Agent Config
|
|
163
|
+
|
|
164
|
+
Agent objects are declarative YAML files. The package currently supports:
|
|
165
|
+
|
|
166
|
+
- `LangChainAgent`
|
|
167
|
+
- `DeepAgent`
|
|
168
|
+
|
|
169
|
+
Typical fields include:
|
|
170
|
+
|
|
171
|
+
- `metadata.name`
|
|
172
|
+
- `metadata.description`
|
|
173
|
+
- `spec.modelRef`
|
|
174
|
+
- `spec.systemPrompt`
|
|
175
|
+
- `spec.checkpointer`
|
|
176
|
+
- `spec.memory`
|
|
177
|
+
- `spec.store`
|
|
178
|
+
- `spec.backend`
|
|
179
|
+
|
|
180
|
+
Use `LangChainAgent` for a fast direct path. Use `DeepAgent` when you need richer orchestration, tool-heavy execution, memory backends, and delegation.
|
|
181
|
+
|
|
182
|
+
## How To Extend
|
|
183
|
+
|
|
184
|
+
The extension model is filesystem-based. You extend the harness by adding new config objects, new discovery roots, or new resource packages.
|
|
185
|
+
|
|
186
|
+
### Add More Agents
|
|
187
|
+
|
|
188
|
+
Subagents can be discovered from configured roots. The discovery layer supports:
|
|
189
|
+
|
|
190
|
+
- local filesystem paths
|
|
191
|
+
- external resource sources
|
|
192
|
+
- builtin discovery paths
|
|
193
|
+
|
|
194
|
+
The harness scans YAML files under the discovered agent roots and adds them to the workspace graph.
|
|
195
|
+
|
|
196
|
+
### Add Skills
|
|
197
|
+
|
|
198
|
+
Skills are discovered from roots that contain either:
|
|
199
|
+
|
|
200
|
+
- a direct `SKILL.md`
|
|
201
|
+
- child directories where each directory contains its own `SKILL.md`
|
|
202
|
+
|
|
203
|
+
A practical layout looks like this:
|
|
204
|
+
|
|
205
|
+
```text
|
|
206
|
+
your-workspace/
|
|
207
|
+
resources/
|
|
208
|
+
skills/
|
|
209
|
+
code-review/
|
|
210
|
+
SKILL.md
|
|
211
|
+
release-check/
|
|
212
|
+
SKILL.md
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Add Tools
|
|
216
|
+
|
|
217
|
+
Tools can come from:
|
|
218
|
+
|
|
219
|
+
- resource packages
|
|
220
|
+
- external sources
|
|
221
|
+
- builtin resources
|
|
222
|
+
- declarative tool objects that bundle or reference other tools
|
|
223
|
+
|
|
224
|
+
The example application demonstrates a clean pattern: keep app-specific tools under `resources/tools/` and keep one tool per module.
|
|
225
|
+
|
|
226
|
+
### Add Retrieval
|
|
227
|
+
|
|
228
|
+
If your workspace needs RAG-style behavior:
|
|
229
|
+
|
|
230
|
+
1. add an `EmbeddingModel`
|
|
231
|
+
2. add a `VectorStore`
|
|
232
|
+
3. point retrieval-oriented tools at those refs
|
|
233
|
+
|
|
234
|
+
This repo already includes `config/embedding-model.yaml` and `config/vector-store.yaml` as the default pattern.
|
|
235
|
+
|
|
236
|
+
### Extend The Runtime In Code
|
|
237
|
+
|
|
238
|
+
The public API also accepts a prebuilt `WorkspaceBundle`, which lets you compile or inject workspace data yourself before creating the harness. That path is useful when you need tighter control in tests or in a higher-level product.
|
|
239
|
+
|
|
240
|
+
## Suggested Workspace Layout
|
|
241
|
+
|
|
242
|
+
```text
|
|
243
|
+
your-workspace/
|
|
244
|
+
AGENTS.md
|
|
245
|
+
config/
|
|
246
|
+
model.yaml
|
|
247
|
+
runtime.yaml
|
|
248
|
+
direct.yaml
|
|
249
|
+
orchestra.yaml
|
|
250
|
+
embedding-model.yaml
|
|
251
|
+
vector-store.yaml
|
|
252
|
+
resources/
|
|
253
|
+
agents/
|
|
254
|
+
skills/
|
|
255
|
+
tools/
|
|
256
|
+
.agent/
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## Development
|
|
260
|
+
|
|
261
|
+
Build and test this package locally:
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
npm run build
|
|
265
|
+
npm run check
|
|
266
|
+
npm test
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
The example workspace under [`examples/stock-research-app`](/Users/boqiang.liang/900-project/agent-harness3/examples/stock-research-app/README.md) is the fastest way to understand how an app should package its own agents, tools, and skills around this framework.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botbotgo/agent-harness",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "Agent Harness framework package",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "npm@10.9.2",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"scripts": {
|
|
45
45
|
"build": "rm -rf dist tsconfig.tsbuildinfo && tsc -p tsconfig.json && cp -R config dist/",
|
|
46
46
|
"check": "tsc -p tsconfig.json --noEmit",
|
|
47
|
-
"test": "vitest run test/public-api.test.ts test/resource-optional-provider.test.ts test/stock-research-app-load-harness.test.ts test/release-workflow.test.ts test/release-version.test.ts test/gitignore.test.ts test/package-lock.test.ts",
|
|
47
|
+
"test": "vitest run test/public-api.test.ts test/resource-optional-provider.test.ts test/stock-research-app-load-harness.test.ts test/release-workflow.test.ts test/release-version.test.ts test/gitignore.test.ts test/package-lock.test.ts test/readme.test.ts",
|
|
48
48
|
"release:pack": "npm pack --dry-run",
|
|
49
49
|
"release:publish": "npm publish --access public --registry https://registry.npmjs.org/"
|
|
50
50
|
},
|