@tangle-network/agent-runtime 0.94.13 → 0.96.1
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 +64 -15
- package/dist/activation-B0ZD7nfX.d.ts +63 -0
- package/dist/agent.d.ts +6 -193
- package/dist/agent.js +10 -234
- package/dist/agent.js.map +1 -1
- package/dist/analyst-loop.d.ts +7 -10
- package/dist/analyst-loop.js +1 -2
- package/dist/candidate-execution/index.d.ts +43 -16
- package/dist/candidate-execution/index.js +17 -8
- package/dist/{chunk-VYA2YEKA.js → chunk-2KGAN2HM.js} +83 -14
- package/dist/chunk-2KGAN2HM.js.map +1 -0
- package/dist/chunk-3XKSBI2U.js +474 -0
- package/dist/chunk-3XKSBI2U.js.map +1 -0
- package/dist/{chunk-TVJQAYQM.js → chunk-6XKPVJAZ.js} +107 -716
- package/dist/chunk-6XKPVJAZ.js.map +1 -0
- package/dist/chunk-BLQIYRVR.js +699 -0
- package/dist/chunk-BLQIYRVR.js.map +1 -0
- package/dist/{chunk-QDSOD7RC.js → chunk-FD2MBMOH.js} +13 -101
- package/dist/chunk-FD2MBMOH.js.map +1 -0
- package/dist/{chunk-U33YZ7B2.js → chunk-FXF2OL34.js} +8 -8
- package/dist/{chunk-EP6RVHMX.js → chunk-HZDEXTSL.js} +848 -2
- package/dist/chunk-HZDEXTSL.js.map +1 -0
- package/dist/{chunk-WIPGQ4GT.js → chunk-IMSNJSXH.js} +1 -1
- package/dist/{chunk-WIPGQ4GT.js.map → chunk-IMSNJSXH.js.map} +1 -1
- package/dist/{chunk-VSWBYWFK.js → chunk-M6MD6JBS.js} +20 -27
- package/dist/chunk-M6MD6JBS.js.map +1 -0
- package/dist/chunk-PSOCBNM3.js +2069 -0
- package/dist/chunk-PSOCBNM3.js.map +1 -0
- package/dist/{chunk-AEG3NGJ2.js → chunk-Q2JSAVQ3.js} +34 -2
- package/dist/chunk-Q2JSAVQ3.js.map +1 -0
- package/dist/{chunk-XP5KDM3R.js → chunk-SGQ4YIQW.js} +4 -4
- package/dist/{chunk-C3UKLQ54.js → chunk-UQ6PNNXM.js} +18 -10
- package/dist/chunk-UQ6PNNXM.js.map +1 -0
- package/dist/{chunk-33OG2NN3.js → chunk-WYC2XJF2.js} +2 -2
- package/dist/{chunk-ZEYAT33L.js → chunk-Y3SRWZMP.js} +2 -2
- package/dist/{chunk-CNH7DF7Z.js → chunk-YOLKCWRV.js} +1116 -591
- package/dist/chunk-YOLKCWRV.js.map +1 -0
- package/dist/{completion-gate-D1gX1-hg.d.ts → completion-gate-C80jiRfN.d.ts} +1 -1
- package/dist/conversation.d.ts +12 -1
- package/dist/conversation.js +2 -3
- package/dist/{coordination-Dr_axlAf.d.ts → coordination-BFE3Den7.d.ts} +10 -11
- package/dist/environment-provider.d.ts +2 -2
- package/dist/environment-provider.js +1 -2
- package/dist/{agentic-generator-DDMM45kZ.d.ts → improve-g75IE2Cx.d.ts} +152 -4
- package/dist/{improvement-adapter-BieWeK5J.d.ts → improvement-adapter-HAZz-7vK.d.ts} +8 -31
- package/dist/index.d.ts +55 -28
- package/dist/index.js +206 -82
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +185 -120
- package/dist/intelligence.js +509 -345
- package/dist/intelligence.js.map +1 -1
- package/dist/knowledge.d.ts +40 -12
- package/dist/knowledge.js +13 -7
- package/dist/{loop-runner-bin-BRQSQdHa.d.ts → loop-runner-bin-Cn1N2rRo.d.ts} +3 -3
- package/dist/loop-runner-bin.d.ts +6 -6
- package/dist/loop-runner-bin.js +8 -10
- package/dist/loops.d.ts +13 -13
- package/dist/loops.js +6 -8
- package/dist/mcp/bin.js +5 -7
- package/dist/mcp/bin.js.map +1 -1
- package/dist/mcp/index.d.ts +6 -6
- package/dist/mcp/index.js +12 -14
- package/dist/mcp/index.js.map +1 -1
- package/dist/platform.js +0 -2
- package/dist/platform.js.map +1 -1
- package/dist/primeintellect/index.js +1 -2
- package/dist/primeintellect/index.js.map +1 -1
- package/dist/profile-DbfaMTdk.d.ts +233 -0
- package/dist/profiles.d.ts +1 -1
- package/dist/profiles.js +0 -1
- package/dist/profiles.js.map +1 -1
- package/dist/{supervise-DmYOug5f.d.ts → supervise-BLPI50-w.d.ts} +3 -3
- package/dist/{types-ByAYqlVb.d.ts → types-B3vAW0Oq.d.ts} +1 -1
- package/dist/{prepare-CtdtsFNG.d.ts → types-CWqfCO8s.d.ts} +67 -298
- package/dist/{types-BC3bZpH0.d.ts → types-CmYCMbFT.d.ts} +12 -54
- package/dist/{types-1d5QGK3t.d.ts → types-CmnA2iL3.d.ts} +3 -3
- package/dist/{worktree-fanout-CPprU-qI.d.ts → worktree-fanout-DCA3G4bO.d.ts} +3 -3
- package/package.json +14 -16
- package/skills/build-with-agent-runtime/SKILL.md +122 -213
- package/dist/chunk-6O73TRHW.js +0 -142
- package/dist/chunk-6O73TRHW.js.map +0 -1
- package/dist/chunk-AEG3NGJ2.js.map +0 -1
- package/dist/chunk-C3UKLQ54.js.map +0 -1
- package/dist/chunk-CNH7DF7Z.js.map +0 -1
- package/dist/chunk-D3H7F6L2.js +0 -626
- package/dist/chunk-D3H7F6L2.js.map +0 -1
- package/dist/chunk-DGUM43GV.js +0 -11
- package/dist/chunk-DGUM43GV.js.map +0 -1
- package/dist/chunk-EP6RVHMX.js.map +0 -1
- package/dist/chunk-HGRW27YY.js +0 -214
- package/dist/chunk-HGRW27YY.js.map +0 -1
- package/dist/chunk-ISTDY47H.js +0 -849
- package/dist/chunk-ISTDY47H.js.map +0 -1
- package/dist/chunk-PCURO3DL.js +0 -661
- package/dist/chunk-PCURO3DL.js.map +0 -1
- package/dist/chunk-QDSOD7RC.js.map +0 -1
- package/dist/chunk-TVJQAYQM.js.map +0 -1
- package/dist/chunk-VSWBYWFK.js.map +0 -1
- package/dist/chunk-VYA2YEKA.js.map +0 -1
- package/dist/generator-YkAQrOoD.d.ts +0 -382
- package/dist/improve-BN3HyXIO.d.ts +0 -172
- package/dist/lifecycle.d.ts +0 -870
- package/dist/lifecycle.js +0 -981
- package/dist/lifecycle.js.map +0 -1
- package/dist/mcp-serve-verifier-DQQDbuyz.d.ts +0 -34
- package/skills/agent-runtime-adoption/SKILL.md +0 -246
- /package/dist/{chunk-U33YZ7B2.js.map → chunk-FXF2OL34.js.map} +0 -0
- /package/dist/{chunk-XP5KDM3R.js.map → chunk-SGQ4YIQW.js.map} +0 -0
- /package/dist/{chunk-33OG2NN3.js.map → chunk-WYC2XJF2.js.map} +0 -0
- /package/dist/{chunk-ZEYAT33L.js.map → chunk-Y3SRWZMP.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DefaultVerdict } from '@tangle-network/agent-eval';
|
|
2
2
|
import { AgentProfile } from '@tangle-network/agent-interface';
|
|
3
3
|
import { BackendType } from '@tangle-network/sandbox';
|
|
4
|
-
import { L as LoopTokenUsage, R as RuntimeHooks } from './types-
|
|
4
|
+
import { L as LoopTokenUsage, R as RuntimeHooks } from './types-B3vAW0Oq.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
@@ -385,8 +385,8 @@ type SpawnEvent = {
|
|
|
385
385
|
};
|
|
386
386
|
/**
|
|
387
387
|
* The spawn-tree event source (mirrors `ConversationJournal`'s begin/append/load shape).
|
|
388
|
-
* `loadTree`
|
|
389
|
-
*
|
|
388
|
+
* `loadTree` returns events for inspection and completed-settlement replay, not live process
|
|
389
|
+
* recovery; `appendEvent` runs only AFTER the event is observed-committed (never speculative).
|
|
390
390
|
*/
|
|
391
391
|
interface SpawnJournal {
|
|
392
392
|
loadTree(root: NodeId): Promise<SpawnEvent[] | undefined>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AgentProfile } from '@tangle-network/agent-interface';
|
|
2
2
|
import { AnalystFinding, DefaultVerdict } from '@tangle-network/agent-eval';
|
|
3
|
-
import { d as AgentSpec, e as ExecutorRegistry, B as Budget, A as Agent, f as SpawnJournal, a as ResultBlobStore, g as RootHandle, b as SupervisedResult, N as NodeId, h as Settled, i as Spend, S as Scope, c as Executor } from './types-
|
|
4
|
-
import { R as RuntimeHooks, I as Iteration } from './types-
|
|
3
|
+
import { d as AgentSpec, e as ExecutorRegistry, B as Budget, A as Agent, f as SpawnJournal, a as ResultBlobStore, g as RootHandle, b as SupervisedResult, N as NodeId, h as Settled, i as Spend, S as Scope, c as Executor } from './types-CmnA2iL3.js';
|
|
4
|
+
import { R as RuntimeHooks, I as Iteration } from './types-B3vAW0Oq.js';
|
|
5
5
|
import { BackendType } from '@tangle-network/sandbox';
|
|
6
|
-
import { W as WorktreeHarnessResult, G as GitRunner, a as WorktreeCheckRunner, D as DeliverableSpec } from './completion-gate-
|
|
6
|
+
import { W as WorktreeHarnessResult, G as GitRunner, a as WorktreeCheckRunner, D as DeliverableSpec } from './completion-gate-C80jiRfN.js';
|
|
7
7
|
import { L as LocalHarness, r as runLocalHarness } from './local-harness-ZqCx51u7.js';
|
|
8
8
|
|
|
9
9
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.96.1",
|
|
4
4
|
"description": "Shared task-lifecycle skeleton for agents: a recursive loop kernel for chat turns, one-shot tasks, and multi-attempt loops, with trace capture and eval-gated self-improvement. Domain behavior lives in adapters; scoring and ship-gates in @tangle-network/agent-eval.",
|
|
5
5
|
"homepage": "https://github.com/tangle-network/agent-runtime#readme",
|
|
6
6
|
"repository": {
|
|
@@ -49,11 +49,6 @@
|
|
|
49
49
|
"import": "./dist/analyst-loop.js",
|
|
50
50
|
"default": "./dist/analyst-loop.js"
|
|
51
51
|
},
|
|
52
|
-
"./lifecycle": {
|
|
53
|
-
"types": "./dist/lifecycle.d.ts",
|
|
54
|
-
"import": "./dist/lifecycle.js",
|
|
55
|
-
"default": "./dist/lifecycle.js"
|
|
56
|
-
},
|
|
57
52
|
"./knowledge": {
|
|
58
53
|
"types": "./dist/knowledge.d.ts",
|
|
59
54
|
"import": "./dist/knowledge.js",
|
|
@@ -100,25 +95,27 @@
|
|
|
100
95
|
"scripts": {
|
|
101
96
|
"build": "tsup",
|
|
102
97
|
"dev": "tsup --watch",
|
|
103
|
-
"
|
|
98
|
+
"prepublishOnly": "pnpm run build",
|
|
104
99
|
"test": "vitest run",
|
|
105
100
|
"test:watch": "vitest",
|
|
106
101
|
"lint": "biome check src tests examples",
|
|
107
102
|
"lint:fix": "biome check --write src tests examples",
|
|
108
103
|
"typecheck": "tsc --noEmit && pnpm run typecheck:examples",
|
|
109
104
|
"typecheck:examples": "tsc --noEmit -p tsconfig.examples.json",
|
|
105
|
+
"verify:bench": "pnpm --filter @tangle-network/agent-bench run typecheck:public && pnpm --filter @tangle-network/agent-bench test && pnpm --filter @tangle-network/agent-bench run verify:package:local-runtime",
|
|
106
|
+
"verify:bench:published": "pnpm --filter @tangle-network/agent-bench run typecheck:public && pnpm --filter @tangle-network/agent-bench test && pnpm --filter @tangle-network/agent-bench run verify:package",
|
|
110
107
|
"verify:package": "node scripts/verify-package-exports.mjs",
|
|
111
108
|
"verify:primeintellect": "pnpm build && node scripts/verify-primeintellect-v1.mjs",
|
|
112
109
|
"verify:primeintellect:live": "pnpm build && node scripts/verify-primeintellect-live.mjs",
|
|
113
|
-
"docs:api": "typedoc && node scripts/gen-primitive-catalog.mjs",
|
|
110
|
+
"docs:api": "pnpm run build && typedoc && node scripts/gen-primitive-catalog.mjs",
|
|
114
111
|
"docs:freshness": "node scripts/check-docs-freshness.mjs",
|
|
115
112
|
"docs:check": "pnpm run docs:api && git diff --exit-code -- docs/api && pnpm run docs:freshness"
|
|
116
113
|
},
|
|
117
114
|
"devDependencies": {
|
|
118
115
|
"@biomejs/biome": "^2.4.15",
|
|
119
|
-
"@tangle-network/agent-eval": "0.
|
|
120
|
-
"@tangle-network/agent-interface": "0.
|
|
121
|
-
"@tangle-network/sandbox": "^0.
|
|
116
|
+
"@tangle-network/agent-eval": "0.122.7",
|
|
117
|
+
"@tangle-network/agent-interface": "0.31.0",
|
|
118
|
+
"@tangle-network/sandbox": "^0.11.1",
|
|
122
119
|
"@types/node": "^25.9.3",
|
|
123
120
|
"@types/tar-stream": "3.1.4",
|
|
124
121
|
"playwright": "^1.61.0",
|
|
@@ -134,6 +131,7 @@
|
|
|
134
131
|
"minimumReleaseAgeExclude": [
|
|
135
132
|
"@tangle-network/agent-eval",
|
|
136
133
|
"@tangle-network/agent-interface",
|
|
134
|
+
"@tangle-network/agent-knowledge",
|
|
137
135
|
"@tangle-network/agent-profile-materialize",
|
|
138
136
|
"@tangle-network/sandbox"
|
|
139
137
|
],
|
|
@@ -147,9 +145,9 @@
|
|
|
147
145
|
"license": "MIT",
|
|
148
146
|
"packageManager": "pnpm@10.28.0",
|
|
149
147
|
"peerDependencies": {
|
|
150
|
-
"@tangle-network/agent-eval": ">=0.
|
|
151
|
-
"@tangle-network/agent-interface": ">=0.
|
|
152
|
-
"@tangle-network/sandbox": ">=0.
|
|
148
|
+
"@tangle-network/agent-eval": ">=0.122.7 <0.123.0",
|
|
149
|
+
"@tangle-network/agent-interface": ">=0.31.0 <0.32.0",
|
|
150
|
+
"@tangle-network/sandbox": ">=0.11.1 <1.0.0",
|
|
153
151
|
"playwright": "^1.40.0"
|
|
154
152
|
},
|
|
155
153
|
"peerDependenciesMeta": {
|
|
@@ -161,8 +159,8 @@
|
|
|
161
159
|
}
|
|
162
160
|
},
|
|
163
161
|
"dependencies": {
|
|
164
|
-
"@tangle-network/agent-knowledge": "^
|
|
165
|
-
"@tangle-network/agent-profile-materialize": "0.
|
|
162
|
+
"@tangle-network/agent-knowledge": "^3.2.1",
|
|
163
|
+
"@tangle-network/agent-profile-materialize": "0.5.1",
|
|
166
164
|
"tar-stream": "3.2.0"
|
|
167
165
|
}
|
|
168
166
|
}
|
|
@@ -1,217 +1,126 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: build-with-agent-runtime
|
|
3
|
-
description: Use before
|
|
3
|
+
description: Use before adding an agent loop, benchmark, optimizer, trace wrapper, or candidate activation path. Find and compose the existing Runtime, Eval, Knowledge, and Interface primitives.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
- `
|
|
127
|
-
budget pool breaks equal-compute claims).
|
|
128
|
-
- a per-step cost/token tally over events **≈** `createWaterfallCollector` (the
|
|
129
|
-
sum of spans IS the billed run cost; a parallel tally drifts).
|
|
130
|
-
- your own bootstrap loop / PRNG per gate **≈** `pairedLift` / `promotionGate`
|
|
131
|
-
(seeded, identical run-to-run; never report a point lift without `low/high/pairs`).
|
|
132
|
-
- a per-product `HARNESSES` / `HarnessBackend` list + a metadata-harness reader
|
|
133
|
-
**≈** `CODING_HARNESSES` + `expandProfileAxes` (the one canonical harness list;
|
|
134
|
-
vendor-locked harnesses SNAP to their native model via `HARNESS_NATIVE_MODEL`,
|
|
135
|
-
never dropped) and the
|
|
136
|
-
`AgentProfileCell` stamped by `runProfileMatrix`, pivoted via
|
|
137
|
-
`groupRunsByAgentProfileCell` — never bake the harness into the model id so the
|
|
138
|
-
same model can run under multiple harnesses.
|
|
139
|
-
- a per-product leaderboard CLI (flag parsing + run-dir management + axis
|
|
140
|
-
expansion + a `runProfileMatrix` call + export/markdown) **≈**
|
|
141
|
-
`defineLeaderboard` (0.84+; it owns that whole frame — FRESH default run-dir,
|
|
142
|
-
standard `--backend`/`--harnesses`/`--models`/`--cases`/`--shots`/`--reps`
|
|
143
|
-
flags, `toBenchmarkAdapter()`; the product writes ~150-250 domain lines).
|
|
144
|
-
- a backend factory / `if (backend === 'router') ... else ...` branch or a
|
|
145
|
-
hand-faked box around a non-box executor **≈** `resolveSandboxClient`
|
|
146
|
-
(harness-in-box: `'sandbox' | 'bridge' | 'router'`) or `resolveAgentBackend`
|
|
147
|
-
(in-process: `'router' | 'tcloud' | 'cli-bridge' | 'sandbox'`) — grep the
|
|
148
|
-
substrate first; `inlineSandboxClient` and the bridge executor exist.
|
|
149
|
-
- a per-provider stream→event mapper for a single agent turn **≈**
|
|
150
|
-
`streamAgentTurn` + `collectAgentTurn` (0.85+; one `RuntimeStreamEvent`
|
|
151
|
-
contract over box / executor / chat, guaranteed terminal result+usage).
|
|
152
|
-
|
|
153
|
-
## End-to-end recipe
|
|
154
|
-
|
|
155
|
-
`docs/canonical-api.md` §4 is the real composition — copy it from there, don't
|
|
156
|
-
re-derive: **define a genome → run driver⟷worker via the reactive substrate over
|
|
157
|
-
a multi-turn `AgenticSurface` → measure with `runBenchmark` → optimize a prompt
|
|
158
|
-
surface with `selfImprove` → certify on a frozen holdout with the gate.** For the
|
|
159
|
-
multi-generation flywheel, replace the measure/certify steps with one
|
|
160
|
-
`runStrategyEvolution(...)` and read `report.verdict` (NOT `report.trajectory`)
|
|
161
|
-
as the evidence. For a sandbox coding rollout judged by an external deterministic
|
|
162
|
-
checker, use the bench-gate path: `resolveAdapter(...)` to pick the benchmark,
|
|
163
|
-
then `openSandboxRun(client, { agentRun: sandboxAgentRun({ profile }), ... },
|
|
164
|
-
deliverable)` per task, A/B-ing a blind arm against an `llmAnalyst`-steered arm
|
|
165
|
-
at equal compute (both helpers live in `bench/src/sandbox-run.ts`; the blind arm
|
|
166
|
-
is the mandatory equal-compute control). See `bench/src/commit0-gate.mts` /
|
|
167
|
-
`gate.ts` for the live shape.
|
|
168
|
-
|
|
169
|
-
## Two substrates — pick one, don't invent a third
|
|
170
|
-
|
|
171
|
-
Both implement the same recursive-decision atom over the one `Executor` port and
|
|
172
|
-
share `defaultSelectWinner`. **Reactive** (`Supervisor`/`Scope` + personify
|
|
173
|
-
combinators: `runPersonified`/`runAgentic`/`runBenchmark`) — prefer for NEW
|
|
174
|
-
recursive work; equal-k by construction. **Round-synchronous** (`runLoop` driven
|
|
175
|
-
by a caller-supplied `Driver`, plus the bench gates over `openSandboxRun`) —
|
|
176
|
-
sandbox coding rollouts against external benchmarks. The full when-which map is
|
|
177
|
-
`docs/canonical-api.md` §6.
|
|
178
|
-
|
|
179
|
-
## Observe / ship with the Intelligence SDK
|
|
180
|
-
|
|
181
|
-
One hook wraps any agent with send + receive + billing boundary:
|
|
182
|
-
`withIntelligence(agent, { project, target, effort })`, `effort ∈
|
|
183
|
-
off|eco|standard|thorough|max` (`'off'` is the provable passthrough floor —
|
|
184
|
-
intelligence spend clamped to 0). It SENDs a typed `RunRecord` and RECEIVEs the
|
|
185
|
-
certified profile, building on `createOtelExporter` + `buildLoopOtelSpans` —
|
|
186
|
-
don't hand-roll a trace-wrapper, a second receive path, or effort/tier config.
|
|
187
|
-
Verify the live subpath against `src/intelligence/with-intelligence.ts`.
|
|
188
|
-
|
|
189
|
-
Two operational facts every consumer must know:
|
|
190
|
-
|
|
191
|
-
- **Send is a silent no-op without a tenant apiKey.** The export leg only ships
|
|
192
|
-
when an `apiKey` (or `TANGLE_API_KEY`) is present — the ingest requires the
|
|
193
|
-
tenant Bearer. One `baseUrl` (`TANGLE_INTELLIGENCE_URL`, default
|
|
194
|
-
`https://intelligence.tangle.tools`) drives both the OTLP send (`/v1/otlp`)
|
|
195
|
-
and the receive pull. The client's `doctor().exportConfigured` is the check
|
|
196
|
-
that a send will actually land.
|
|
197
|
-
- **Delivery pulls the certified profile from the plane.** `pullCertified` /
|
|
198
|
-
`withIntelligence` hit
|
|
199
|
-
`GET {baseUrl}/v1/profiles/:target/composed` with `Bearer TANGLE_API_KEY`;
|
|
200
|
-
the pull deserializes the typed `agentProfileDiffs` (surfaced as PROPOSALS,
|
|
201
|
-
never auto-applied) alongside the certified prompt. `withIntelligence` folds
|
|
202
|
-
the certified prompt onto the base surface, refreshes at most every 5 minutes,
|
|
203
|
-
and is fail-closed — a failed pull runs the agent on its base surface.
|
|
204
|
-
|
|
205
|
-
## Final check
|
|
206
|
-
|
|
207
|
-
- Picked a primitive from the decision table, not a hand-rolled parallel?
|
|
208
|
-
- Genome is ONE `AgentProfile`/`AgentSurfaces` surface, not split skill/tool/prompt knobs?
|
|
209
|
-
- Equal compute preserved (budget pool, or `arms[0]` control) — no `Promise.all` zoo?
|
|
210
|
-
- Selector ≠ judge: no judge score feeding a driver/another judge; holdout score write-only?
|
|
211
|
-
- Any win certified on a FROZEN holdout via a gate, never on the training composite?
|
|
212
|
-
- Map fixed in the same turn if source disagreed with `docs/canonical-api.md`?
|
|
213
|
-
|
|
214
|
-
See `_common.md` for shared conventions (frontmatter, fail-loud, no AI attribution).
|
|
215
|
-
|
|
216
|
-
Next: build the genome/loop/optimizer against `docs/canonical-api.md` §3–§4; if a
|
|
217
|
-
strategy beats incumbent on the holdout gate, `/ship` it.
|
|
6
|
+
# Build with agent-runtime
|
|
7
|
+
|
|
8
|
+
Use this skill before writing product-local agent infrastructure.
|
|
9
|
+
The goal is one portable agent definition, one execution path, one measurement system, and one reviewed activation path.
|
|
10
|
+
|
|
11
|
+
## Read first
|
|
12
|
+
|
|
13
|
+
1. Read `docs/canonical-api.md` for the current decision table.
|
|
14
|
+
2. Check exports in `src/index.ts`, `src/runtime/index.ts`, `src/improvement/index.ts`, `src/intelligence/index.ts`, and `src/knowledge/index.ts`.
|
|
15
|
+
3. Read the nearest runnable example.
|
|
16
|
+
4. Treat source as authoritative when docs disagree, then correct the stale doc in the same change.
|
|
17
|
+
|
|
18
|
+
## Ownership
|
|
19
|
+
|
|
20
|
+
| Concern | Owner |
|
|
21
|
+
|---|---|
|
|
22
|
+
| Portable prompt, skills, tools, MCP, hooks, subagents, model hints | `AgentProfile` from `@tangle-network/agent-interface` |
|
|
23
|
+
| Agent execution, supervision, budgets, streaming, candidate execution | `@tangle-network/agent-runtime` |
|
|
24
|
+
| Tasks, graders, search, paired statistics, cost and latency comparison | `@tangle-network/agent-eval` |
|
|
25
|
+
| Sources, retrieval, citations, freshness, memory adapters, knowledge promotion | `@tangle-network/agent-knowledge` |
|
|
26
|
+
| Product records, permissions, funding, UI, and atomic storage writes | The consuming product |
|
|
27
|
+
|
|
28
|
+
Do not move shared measurement into Runtime or product code.
|
|
29
|
+
Do not move product storage transactions into a provider-neutral package.
|
|
30
|
+
|
|
31
|
+
## Choose the entry point
|
|
32
|
+
|
|
33
|
+
| Need | Use |
|
|
34
|
+
|---|---|
|
|
35
|
+
| One product chat turn | `handleChatTurn(...)` |
|
|
36
|
+
| One normalized streamed agent turn | `streamAgentTurn(...)` and `collectAgentTurn(...)` |
|
|
37
|
+
| One task or multi-turn loop | `runAgentTask(...)`, `runAgentTaskStream(...)`, or `runLoop(...)` |
|
|
38
|
+
| Supervisor and workers | `supervise(...)` or `superviseSurface(...)` |
|
|
39
|
+
| Parallel work with a shared budget | `fanout(...)` |
|
|
40
|
+
| Fixed composition | `pipeline(...)`, `panel(...)`, or `verify(...)` |
|
|
41
|
+
| Product benchmark | `defineLeaderboard(...)` |
|
|
42
|
+
| Profile matrix | `expandProfileAxes(...)` and `runProfileMatrix(...)` from agent-eval |
|
|
43
|
+
| Search one agent surface | `improve(...)` |
|
|
44
|
+
| Analyze traces through a measured proposal | `proposeAgentImprovement(...)` |
|
|
45
|
+
| Review and authorize an exact proposal | `reviewAgentImprovementProposal(...)` and `createAgentImprovementActivation(...)` |
|
|
46
|
+
| Apply or restore an approved candidate | `executeAgentImprovementActivation(...)` with a product transaction |
|
|
47
|
+
| Build a knowledge candidate | `runKnowledgeImprovementJob(...)` |
|
|
48
|
+
| Apply a knowledge candidate | `createKnowledgeImprovementActivationExecutor(...)` through the same activation path |
|
|
49
|
+
| Observe and pull approved changes on a live agent | `withIntelligence(...)` |
|
|
50
|
+
|
|
51
|
+
## Improvement flow
|
|
52
|
+
|
|
53
|
+
`improve(profile, findings, options)` searches one surface and returns a detached winner.
|
|
54
|
+
It never changes a profile, document, repository, memory store, or knowledge base.
|
|
55
|
+
|
|
56
|
+
Supported profile surfaces are prompt, one named inline skill, tools, MCP, hooks, subagents, whole profile, and curated memory in `profile.resources.instructions`.
|
|
57
|
+
Code uses isolated worktrees and returns a sealed patch candidate.
|
|
58
|
+
Knowledge uses `runKnowledgeImprovementJob(...)` and returns paired snapshots.
|
|
59
|
+
|
|
60
|
+
Use `proposeAgentImprovement(...)` for a production proposal.
|
|
61
|
+
It performs these steps in order:
|
|
62
|
+
|
|
63
|
+
1. Analyze completed traces.
|
|
64
|
+
2. Search for a candidate on development tasks.
|
|
65
|
+
3. Freeze the baseline and winner into one exact experiment.
|
|
66
|
+
4. Reject the experiment if its candidate differs from the search winner.
|
|
67
|
+
5. Run baseline and candidate on the same held-back tasks.
|
|
68
|
+
6. Produce findings, confidence intervals, quality, cost, latency, and a decision.
|
|
69
|
+
|
|
70
|
+
After a person or tenant policy approves the proposal, call `createAgentImprovementActivation(...)` with target identities, funding owner, authority, intent, and expiry.
|
|
71
|
+
Runtime derives the expected current digests from the measured experiment.
|
|
72
|
+
Call `executeAgentImprovementActivation(...)` with one product-owned transaction that compares current state, writes every target atomically, and stores the result under the activation digest.
|
|
73
|
+
Pass a read-only reconciliation function so retries can distinguish committed, uncommitted, and uncertain outcomes.
|
|
74
|
+
|
|
75
|
+
Never apply a change from analyst confidence alone.
|
|
76
|
+
Never measure one candidate and apply another.
|
|
77
|
+
Never let search code write live state.
|
|
78
|
+
Never treat a lost response as a failed write without reconciling it.
|
|
79
|
+
|
|
80
|
+
## Surface rules
|
|
81
|
+
|
|
82
|
+
- Prompt changes `profile.prompt` only.
|
|
83
|
+
- Skill optimization selects one inline skill by `skills.resourceName`; profile resources must fail closed.
|
|
84
|
+
- Curated memory changes `profile.resources.instructions`; retrieval stores and memory databases belong in the knowledge flow.
|
|
85
|
+
- Tools, MCP, hooks, subagents, and whole-profile changes require an explicit proposer because Runtime cannot invent domain capabilities safely.
|
|
86
|
+
- Code candidates must come from the Runtime worktree path so patch identity and cleanup stay intact.
|
|
87
|
+
- Workflow and policy files are code surfaces; parameter sweeps come from agent-eval.
|
|
88
|
+
- Knowledge candidates remain detached until the shared activation path applies or restores their frozen snapshots.
|
|
89
|
+
|
|
90
|
+
## Product integration
|
|
91
|
+
|
|
92
|
+
The product supplies only the pieces that vary by deployment:
|
|
93
|
+
|
|
94
|
+
- How traces and current profiles are loaded.
|
|
95
|
+
- How exact candidate execution is placed on compute.
|
|
96
|
+
- How proposal, review, activation, and result records are persisted.
|
|
97
|
+
- How a target is changed atomically.
|
|
98
|
+
- Who may approve, reject, request changes, fund, apply, or restore.
|
|
99
|
+
- How those records and actions appear in the UI or API.
|
|
100
|
+
|
|
101
|
+
The product must not recreate candidate hashing, paired comparison, confidence intervals, review binding, expiry, retry identity, or result validation.
|
|
102
|
+
|
|
103
|
+
## Do not duplicate
|
|
104
|
+
|
|
105
|
+
- Do not write a provider-specific profile wrapper; extend `AgentProfile` and its materializer.
|
|
106
|
+
- Do not write a second optimizer loop; compose Eval proposers through `improve(...)`.
|
|
107
|
+
- Do not write a second candidate catalog; persist the immutable proposal records.
|
|
108
|
+
- Do not let an analyst or adapter commit, push, open a pull request, or edit a live store.
|
|
109
|
+
- Do not hand-roll SSE parsing, usage totals, profile matrices, bootstrap statistics, sandbox acquisition, or worktree cleanup.
|
|
110
|
+
- Do not add a product-local approval format for knowledge, code, or profile changes.
|
|
111
|
+
|
|
112
|
+
## Finish
|
|
113
|
+
|
|
114
|
+
- The same agent definition runs in product and measurement paths.
|
|
115
|
+
- The held-back tasks were not visible during search.
|
|
116
|
+
- Candidate identity is checked before execution and again before activation.
|
|
117
|
+
- Quality, cost, latency, sample count, and uncertainty are retained.
|
|
118
|
+
- Rejection and request-changes are first-class outcomes.
|
|
119
|
+
- Activation is authorized, expiring, idempotent, and reconcilable.
|
|
120
|
+
- No customer write, message, trigger, or billing occurs in read-only proof mode.
|
|
121
|
+
- Public examples, package exports, generated API docs, type checks, tests, build, and package verification pass.
|
|
122
|
+
|
|
123
|
+
## Then consider
|
|
124
|
+
|
|
125
|
+
- Use `critical-audit` when the change introduces or alters a public contract.
|
|
126
|
+
- Use `verify` before publishing or adopting the package in a product.
|