@datalayer/agent-runtimes 1.3.53 → 1.3.55
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/lib/examples/AgentStrategyExample.d.ts +12 -0
- package/lib/examples/{AgentLoopExample.js → AgentStrategyExample.js} +62 -62
- package/lib/examples/example-selector.js +1 -1
- package/lib/examples/index.d.ts +1 -1
- package/lib/examples/index.js +1 -1
- package/lib/examples/main.js +3 -3
- package/lib/loop/apps/visitorToken.d.ts +35 -0
- package/lib/loop/apps/visitorToken.js +114 -0
- package/lib/loop/embed/LoopEmbed.js +1 -0
- package/lib/loop/plugins/agents/DatalayerAgentBridge.js +15 -3
- package/lib/loop/plugins/agents/plugin.d.ts +24 -0
- package/lib/loop/plugins/agents/plugin.js +0 -17
- package/lib/loop/plugins/chat/ChatView.js +10 -1
- package/lib/loop/presets.d.ts +2 -0
- package/lib/loop/presets.js +2 -1
- package/lib/specs/index.d.ts +1 -1
- package/lib/specs/index.js +1 -1
- package/lib/specs/strategies.d.ts +34 -0
- package/lib/specs/{loops.js → strategies.js} +30 -30
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.js +1 -1
- package/lib/types/{loops.d.ts → strategies.d.ts} +17 -17
- package/package.json +2 -2
- package/scripts/codegen/generate_agents.py +1 -1
- package/scripts/codegen/{generate_loops.py → generate_strategies.py} +81 -81
- package/lib/examples/AgentLoopExample.d.ts +0 -12
- package/lib/specs/loops.d.ts +0 -34
- /package/lib/types/{loops.js → strategies.js} +0 -0
package/lib/specs/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export * from './teams';
|
|
|
8
8
|
export * from './envvars';
|
|
9
9
|
export * from './evals';
|
|
10
10
|
export * from './guardrails';
|
|
11
|
-
export * from './
|
|
11
|
+
export * from './strategies';
|
|
12
12
|
export * from './mcpServers';
|
|
13
13
|
export * from './memory';
|
|
14
14
|
export * from './models';
|
package/lib/specs/index.js
CHANGED
|
@@ -12,7 +12,7 @@ export * from './teams';
|
|
|
12
12
|
export * from './envvars';
|
|
13
13
|
export * from './evals';
|
|
14
14
|
export * from './guardrails';
|
|
15
|
-
export * from './
|
|
15
|
+
export * from './strategies';
|
|
16
16
|
export * from './mcpServers';
|
|
17
17
|
export * from './memory';
|
|
18
18
|
export * from './models';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strategy Catalog
|
|
3
|
+
*
|
|
4
|
+
* Predefined agent reasoning strategies (control loops).
|
|
5
|
+
*
|
|
6
|
+
* This file is AUTO-GENERATED from YAML specifications.
|
|
7
|
+
* DO NOT EDIT MANUALLY - run 'make specs' to regenerate.
|
|
8
|
+
*/
|
|
9
|
+
import type { StrategySpec } from '../types';
|
|
10
|
+
export declare const Strategies: {
|
|
11
|
+
readonly DATA_ANALYSIS: "data-analysis";
|
|
12
|
+
readonly HUMAN_IN_THE_LOOP: "human-in-the-loop";
|
|
13
|
+
readonly OODA: "ooda";
|
|
14
|
+
readonly PLAN_EXECUTE_CRITIC: "plan-execute-critic";
|
|
15
|
+
};
|
|
16
|
+
export type StrategyId = (typeof Strategies)[keyof typeof Strategies];
|
|
17
|
+
export declare const DATA_ANALYSIS_STRATEGY_0_0_1: StrategySpec;
|
|
18
|
+
export declare const HUMAN_IN_THE_LOOP_STRATEGY_0_0_1: StrategySpec;
|
|
19
|
+
export declare const OODA_STRATEGY_0_0_1: StrategySpec;
|
|
20
|
+
export declare const PLAN_EXECUTE_CRITIC_STRATEGY_0_0_1: StrategySpec;
|
|
21
|
+
export declare const STRATEGY_CATALOGUE: Record<string, StrategySpec>;
|
|
22
|
+
export declare const DEFAULT_STRATEGY: StrategyId;
|
|
23
|
+
/**
|
|
24
|
+
* Get a strategy specification by ID.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getStrategy(strategyId: string): StrategySpec | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Get the default strategy.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getDefaultStrategy(): StrategySpec | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* List all available strategies.
|
|
33
|
+
*/
|
|
34
|
+
export declare function listStrategies(): StrategySpec[];
|
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
5
|
// ============================================================================
|
|
6
|
-
//
|
|
6
|
+
// Strategies Enum
|
|
7
7
|
// ============================================================================
|
|
8
|
-
export const
|
|
8
|
+
export const Strategies = {
|
|
9
9
|
DATA_ANALYSIS: 'data-analysis',
|
|
10
10
|
HUMAN_IN_THE_LOOP: 'human-in-the-loop',
|
|
11
11
|
OODA: 'ooda',
|
|
12
12
|
PLAN_EXECUTE_CRITIC: 'plan-execute-critic',
|
|
13
13
|
};
|
|
14
14
|
// ============================================================================
|
|
15
|
-
//
|
|
15
|
+
// Strategy Definitions
|
|
16
16
|
// ============================================================================
|
|
17
|
-
export const
|
|
17
|
+
export const DATA_ANALYSIS_STRATEGY_0_0_1 = {
|
|
18
18
|
id: 'data-analysis',
|
|
19
19
|
version: '0.0.1',
|
|
20
20
|
name: 'Data Analysis Loop',
|
|
@@ -47,7 +47,7 @@ export const DATA_ANALYSIS_LOOP_0_0_1 = {
|
|
|
47
47
|
icon: 'graph',
|
|
48
48
|
emoji: '📊',
|
|
49
49
|
};
|
|
50
|
-
export const
|
|
50
|
+
export const HUMAN_IN_THE_LOOP_STRATEGY_0_0_1 = {
|
|
51
51
|
id: 'human-in-the-loop',
|
|
52
52
|
version: '0.0.1',
|
|
53
53
|
name: 'Human-in-the-Loop',
|
|
@@ -83,7 +83,7 @@ export const HUMAN_IN_THE_LOOP_LOOP_0_0_1 = {
|
|
|
83
83
|
icon: 'person',
|
|
84
84
|
emoji: '🙋',
|
|
85
85
|
};
|
|
86
|
-
export const
|
|
86
|
+
export const OODA_STRATEGY_0_0_1 = {
|
|
87
87
|
id: 'ooda',
|
|
88
88
|
version: '0.0.1',
|
|
89
89
|
name: 'OODA Loop',
|
|
@@ -112,7 +112,7 @@ export const OODA_LOOP_0_0_1 = {
|
|
|
112
112
|
icon: 'sync',
|
|
113
113
|
emoji: '🔄',
|
|
114
114
|
};
|
|
115
|
-
export const
|
|
115
|
+
export const PLAN_EXECUTE_CRITIC_STRATEGY_0_0_1 = {
|
|
116
116
|
id: 'plan-execute-critic',
|
|
117
117
|
version: '0.0.1',
|
|
118
118
|
name: 'Plan / Execute / Critic Loop',
|
|
@@ -148,41 +148,41 @@ export const PLAN_EXECUTE_CRITIC_LOOP_0_0_1 = {
|
|
|
148
148
|
emoji: '✅',
|
|
149
149
|
};
|
|
150
150
|
// ============================================================================
|
|
151
|
-
//
|
|
151
|
+
// Strategy Catalog
|
|
152
152
|
// ============================================================================
|
|
153
|
-
export const
|
|
154
|
-
'data-analysis':
|
|
155
|
-
'human-in-the-loop':
|
|
156
|
-
ooda:
|
|
157
|
-
'plan-execute-critic':
|
|
153
|
+
export const STRATEGY_CATALOGUE = {
|
|
154
|
+
'data-analysis': DATA_ANALYSIS_STRATEGY_0_0_1,
|
|
155
|
+
'human-in-the-loop': HUMAN_IN_THE_LOOP_STRATEGY_0_0_1,
|
|
156
|
+
ooda: OODA_STRATEGY_0_0_1,
|
|
157
|
+
'plan-execute-critic': PLAN_EXECUTE_CRITIC_STRATEGY_0_0_1,
|
|
158
158
|
};
|
|
159
|
-
export const
|
|
160
|
-
function
|
|
161
|
-
if (
|
|
162
|
-
return
|
|
163
|
-
const idx =
|
|
159
|
+
export const DEFAULT_STRATEGY = Strategies.DATA_ANALYSIS;
|
|
160
|
+
function resolveStrategyId(strategyId) {
|
|
161
|
+
if (strategyId in STRATEGY_CATALOGUE)
|
|
162
|
+
return strategyId;
|
|
163
|
+
const idx = strategyId.lastIndexOf(':');
|
|
164
164
|
if (idx > 0) {
|
|
165
|
-
const base =
|
|
166
|
-
if (base in
|
|
165
|
+
const base = strategyId.slice(0, idx);
|
|
166
|
+
if (base in STRATEGY_CATALOGUE)
|
|
167
167
|
return base;
|
|
168
168
|
}
|
|
169
|
-
return
|
|
169
|
+
return strategyId;
|
|
170
170
|
}
|
|
171
171
|
/**
|
|
172
|
-
* Get a
|
|
172
|
+
* Get a strategy specification by ID.
|
|
173
173
|
*/
|
|
174
|
-
export function
|
|
175
|
-
return
|
|
174
|
+
export function getStrategy(strategyId) {
|
|
175
|
+
return STRATEGY_CATALOGUE[resolveStrategyId(strategyId)];
|
|
176
176
|
}
|
|
177
177
|
/**
|
|
178
|
-
* Get the default
|
|
178
|
+
* Get the default strategy.
|
|
179
179
|
*/
|
|
180
|
-
export function
|
|
181
|
-
return
|
|
180
|
+
export function getDefaultStrategy() {
|
|
181
|
+
return STRATEGY_CATALOGUE[DEFAULT_STRATEGY];
|
|
182
182
|
}
|
|
183
183
|
/**
|
|
184
|
-
* List all available
|
|
184
|
+
* List all available strategies.
|
|
185
185
|
*/
|
|
186
|
-
export function
|
|
187
|
-
return Object.values(
|
|
186
|
+
export function listStrategies() {
|
|
187
|
+
return Object.values(STRATEGY_CATALOGUE);
|
|
188
188
|
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export * from './execution';
|
|
|
20
20
|
export * from './uiPlugins';
|
|
21
21
|
export * from './guardrails';
|
|
22
22
|
export * from './inference';
|
|
23
|
-
export * from './
|
|
23
|
+
export * from './strategies';
|
|
24
24
|
export * from './mcp';
|
|
25
25
|
export * from './memory';
|
|
26
26
|
export * from './messages';
|
package/lib/types/index.js
CHANGED
|
@@ -24,7 +24,7 @@ export * from './execution';
|
|
|
24
24
|
export * from './uiPlugins';
|
|
25
25
|
export * from './guardrails';
|
|
26
26
|
export * from './inference';
|
|
27
|
-
export * from './
|
|
27
|
+
export * from './strategies';
|
|
28
28
|
export * from './mcp';
|
|
29
29
|
export * from './memory';
|
|
30
30
|
export * from './messages';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* How the human participates in (or around) an agent
|
|
2
|
+
* How the human participates in (or around) an agent reasoning strategy.
|
|
3
3
|
*/
|
|
4
|
-
export interface
|
|
4
|
+
export interface StrategyHuman {
|
|
5
5
|
/** Human interaction pattern: none, initiate, approve, feedback, or tool */
|
|
6
6
|
mode: string;
|
|
7
|
-
/** Whether the
|
|
7
|
+
/** Whether the strategy pauses for human approval before sensitive actions */
|
|
8
8
|
approvalRequired: boolean;
|
|
9
9
|
/** Actions that require explicit human approval */
|
|
10
10
|
approvalFor: string[];
|
|
@@ -12,48 +12,48 @@ export interface LoopHuman {
|
|
|
12
12
|
description: string;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* When and how an agent
|
|
15
|
+
* When and how an agent reasoning strategy stops iterating.
|
|
16
16
|
*/
|
|
17
|
-
export interface
|
|
18
|
-
/** Maximum iterations before the
|
|
17
|
+
export interface StrategyTermination {
|
|
18
|
+
/** Maximum iterations before the strategy is stopped */
|
|
19
19
|
maxIterations: number;
|
|
20
20
|
/** Conditions that mark the goal as reached */
|
|
21
21
|
successCriteria: string[];
|
|
22
|
-
/** Conditions that mark the
|
|
22
|
+
/** Conditions that mark the strategy as failed */
|
|
23
23
|
failureCriteria: string[];
|
|
24
24
|
/** What to do when blocked: ask-human, retry, or abort */
|
|
25
25
|
onBlocked: string;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
* Specification for an agent
|
|
28
|
+
* Specification for an agent reasoning strategy (a control loop).
|
|
29
29
|
*
|
|
30
30
|
* A framework-agnostic description of how an agent progresses from one
|
|
31
31
|
* decision to the next: the control cycle (observe/think/act/evaluate), the
|
|
32
32
|
* objective, constraints, where state lives, human participation, and the
|
|
33
33
|
* termination policy.
|
|
34
34
|
*/
|
|
35
|
-
export interface
|
|
36
|
-
/** Unique
|
|
35
|
+
export interface StrategySpec {
|
|
36
|
+
/** Unique strategy identifier (e.g., 'data-analysis') */
|
|
37
37
|
id: string;
|
|
38
38
|
/** Version */
|
|
39
39
|
version: string;
|
|
40
|
-
/** Display name for the
|
|
40
|
+
/** Display name for the strategy */
|
|
41
41
|
name: string;
|
|
42
|
-
/**
|
|
42
|
+
/** Strategy description */
|
|
43
43
|
description: string;
|
|
44
|
-
/** Default goal/objective the
|
|
44
|
+
/** Default goal/objective the strategy works toward */
|
|
45
45
|
objective: string;
|
|
46
|
-
/**
|
|
46
|
+
/** Strategy family */
|
|
47
47
|
strategy: string;
|
|
48
48
|
/** Ordered phase names that make up one iteration */
|
|
49
49
|
phases: string[];
|
|
50
50
|
/** Boundaries the agent must respect */
|
|
51
51
|
constraints: string[];
|
|
52
52
|
/** Termination policy */
|
|
53
|
-
termination?:
|
|
53
|
+
termination?: StrategyTermination;
|
|
54
54
|
/** Human-in-the-loop participation settings */
|
|
55
|
-
human?:
|
|
56
|
-
/** Where
|
|
55
|
+
human?: StrategyHuman;
|
|
56
|
+
/** Where strategy state lives between iterations */
|
|
57
57
|
stateBackends: string[];
|
|
58
58
|
/** Categorization tags */
|
|
59
59
|
tags: string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datalayer/agent-runtimes",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.55",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"workspaces": [
|
|
6
6
|
".",
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
"@datalayer/agent-teams": "^1.0.0",
|
|
148
148
|
"@datalayer/core": "^1.2.14",
|
|
149
149
|
"@datalayer/decks": "^1.0.4",
|
|
150
|
-
"@datalayer/icons-react": "^1.0.
|
|
150
|
+
"@datalayer/icons-react": "^1.0.16",
|
|
151
151
|
"@datalayer/jupyter-lexical": "^2.0.18",
|
|
152
152
|
"@datalayer/jupyter-react": "^2.0.18",
|
|
153
153
|
"@datalayer/jupyter-server-nbmodel": "^0.2.8",
|
|
@@ -1616,7 +1616,7 @@ export * from './teams';
|
|
|
1616
1616
|
export * from './envvars';
|
|
1617
1617
|
export * from './evals';
|
|
1618
1618
|
export * from './guardrails';
|
|
1619
|
-
export * from './
|
|
1619
|
+
export * from './strategies';
|
|
1620
1620
|
export * from './mcpServers';
|
|
1621
1621
|
export * from './memory';
|
|
1622
1622
|
export * from './models';
|