@datalayer/agent-runtimes 1.0.9 → 1.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/lib/chat/base/ChatBase.js +39 -1
- package/lib/client/AgentsMixin.d.ts +4 -4
- package/lib/client/AgentsMixin.js +7 -7
- package/lib/components/ToolApprovalCard.js +13 -3
- package/lib/config/AgentConfiguration.d.ts +2 -2
- package/lib/config/index.d.ts +1 -1
- package/lib/examples/AgentCheckpointsExample.js +12 -12
- package/lib/examples/AgentEvalsExample.js +3 -3
- package/lib/examples/AgentGuardrailsExample.js +5 -5
- package/lib/examples/AgentHooksExample.js +3 -3
- package/lib/examples/AgentInferenceProviderExample.js +5 -5
- package/lib/examples/AgentMCPExample.js +2 -2
- package/lib/examples/AgentMemoryExample.js +2 -2
- package/lib/examples/AgentMonitoringExample.js +2 -2
- package/lib/examples/AgentNotificationsExample.js +2 -2
- package/lib/examples/AgentOtelExample.js +5 -5
- package/lib/examples/AgentOutputsExample.js +2 -2
- package/lib/examples/AgentParametersExample.js +4 -4
- package/lib/examples/AgentSandboxExample.js +2 -2
- package/lib/examples/AgentSkillsExample.js +2 -2
- package/lib/examples/AgentSubagentsExample.js +2 -2
- package/lib/examples/AgentToolApprovalsExample.js +33 -7
- package/lib/examples/AgentTriggersExample.js +4 -4
- package/lib/examples/ChatExample.js +3 -3
- package/lib/hooks/useAgentRuntimes.js +2 -2
- package/lib/hooks/useAgentsCatalog.d.ts +3 -3
- package/lib/hooks/useAgentsCatalog.js +4 -4
- package/lib/hooks/useCheckpoints.js +2 -2
- package/lib/hooks/useToolApprovals.d.ts +8 -0
- package/lib/hooks/useToolApprovals.js +20 -1
- package/lib/index.d.ts +1 -1
- package/lib/specs/agents/agents.d.ts +51 -50
- package/lib/specs/agents/agents.js +154 -141
- package/lib/specs/agents/index.d.ts +5 -5
- package/lib/specs/agents/index.js +9 -9
- package/lib/types/agents.d.ts +3 -3
- package/lib/types/agentspecs.d.ts +5 -3
- package/lib/types/teams.d.ts +2 -2
- package/package.json +7 -7
- package/scripts/codegen/generate_agents.py +75 -57
- package/scripts/codegen/generate_teams.py +4 -4
- package/scripts/codegen/__pycache__/generate_agents.cpython-313.pyc +0 -0
- package/scripts/codegen/__pycache__/generate_benchmarks.cpython-313.pyc +0 -0
- package/scripts/codegen/__pycache__/generate_evals.cpython-313.pyc +0 -0
- package/scripts/codegen/__pycache__/generate_events.cpython-313.pyc +0 -0
- package/scripts/codegen/__pycache__/versioning.cpython-313.pyc +0 -0
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
*
|
|
4
4
|
* THIS FILE IS AUTO-GENERATED. DO NOT EDIT MANUALLY.
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
7
|
-
export declare const
|
|
6
|
+
import type { Agentspec } from '../../types';
|
|
7
|
+
export declare const AGENTSPECS: Record<string, Agentspec>;
|
|
8
8
|
/**
|
|
9
9
|
* Get an agent specification by ID.
|
|
10
10
|
*/
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function getAgentspecs(agentId: string): Agentspec | undefined;
|
|
12
12
|
/**
|
|
13
13
|
* List all available agent specifications.
|
|
14
14
|
*
|
|
15
15
|
* @param prefix - If provided, only return specs whose ID starts with this prefix.
|
|
16
16
|
*/
|
|
17
|
-
export declare function
|
|
17
|
+
export declare function listAgentspecs(prefix?: string): Agentspec[];
|
|
18
18
|
/**
|
|
19
19
|
* Collect all required environment variables for an agent spec.
|
|
20
20
|
*/
|
|
21
|
-
export declare function
|
|
21
|
+
export declare function getAgentspecRequiredEnvVars(spec: Agentspec): string[];
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { AGENTSPECS as ROOT_AGENTS } from './agents';
|
|
6
6
|
// Merge all agent specs from subfolders
|
|
7
|
-
export const
|
|
7
|
+
export const AGENTSPECS = {
|
|
8
8
|
...ROOT_AGENTS,
|
|
9
9
|
};
|
|
10
10
|
function resolveAgentId(agentId) {
|
|
11
|
-
if (agentId in
|
|
11
|
+
if (agentId in AGENTSPECS)
|
|
12
12
|
return agentId;
|
|
13
13
|
const idx = agentId.lastIndexOf(':');
|
|
14
14
|
if (idx > 0) {
|
|
15
15
|
const base = agentId.slice(0, idx);
|
|
16
|
-
if (base in
|
|
16
|
+
if (base in AGENTSPECS)
|
|
17
17
|
return base;
|
|
18
18
|
}
|
|
19
19
|
return agentId;
|
|
@@ -21,16 +21,16 @@ function resolveAgentId(agentId) {
|
|
|
21
21
|
/**
|
|
22
22
|
* Get an agent specification by ID.
|
|
23
23
|
*/
|
|
24
|
-
export function
|
|
25
|
-
return
|
|
24
|
+
export function getAgentspecs(agentId) {
|
|
25
|
+
return AGENTSPECS[resolveAgentId(agentId)];
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* List all available agent specifications.
|
|
29
29
|
*
|
|
30
30
|
* @param prefix - If provided, only return specs whose ID starts with this prefix.
|
|
31
31
|
*/
|
|
32
|
-
export function
|
|
33
|
-
const specs = Object.values(
|
|
32
|
+
export function listAgentspecs(prefix) {
|
|
33
|
+
const specs = Object.values(AGENTSPECS);
|
|
34
34
|
return prefix !== undefined
|
|
35
35
|
? specs.filter(s => s.id.startsWith(prefix))
|
|
36
36
|
: specs;
|
|
@@ -38,7 +38,7 @@ export function listAgentSpecs(prefix) {
|
|
|
38
38
|
/**
|
|
39
39
|
* Collect all required environment variables for an agent spec.
|
|
40
40
|
*/
|
|
41
|
-
export function
|
|
41
|
+
export function getAgentspecRequiredEnvVars(spec) {
|
|
42
42
|
const vars = new Set();
|
|
43
43
|
for (const server of spec.mcpServers) {
|
|
44
44
|
for (const v of server.requiredEnvVars ?? []) {
|
package/lib/types/agents.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AI Agent model
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { Agentspec } from './agentspecs';
|
|
5
5
|
import type { AgentConnection } from './connection';
|
|
6
6
|
export type AgentLibrary = 'pydantic-ai' | 'langchain' | 'google-adk';
|
|
7
7
|
/**
|
|
@@ -51,7 +51,7 @@ export type AgentRuntimeData = {
|
|
|
51
51
|
ingress?: string;
|
|
52
52
|
url?: string;
|
|
53
53
|
token?: string;
|
|
54
|
-
agentSpec?:
|
|
54
|
+
agentSpec?: Agentspec;
|
|
55
55
|
agent_spec_id?: string;
|
|
56
56
|
billable_account_uid?: string;
|
|
57
57
|
billable_account_type?: 'user' | 'organization' | 'team';
|
|
@@ -67,7 +67,7 @@ export interface RunningAgent {
|
|
|
67
67
|
podName: string;
|
|
68
68
|
/** Agent display name */
|
|
69
69
|
name: string;
|
|
70
|
-
/**
|
|
70
|
+
/** Agentspec ID used to create the agent */
|
|
71
71
|
specId?: string;
|
|
72
72
|
/** Current agent status */
|
|
73
73
|
status: AgentStatus;
|
|
@@ -14,7 +14,7 @@ import type { AgentCodemodeConfig, AgentAdvancedConfig } from './config';
|
|
|
14
14
|
* Defines the configuration for a reusable agent template that can be
|
|
15
15
|
* instantiated as an Agent Runtime.
|
|
16
16
|
*/
|
|
17
|
-
export interface
|
|
17
|
+
export interface Agentspec {
|
|
18
18
|
/** Unique agent identifier */
|
|
19
19
|
id: string;
|
|
20
20
|
/** Version */
|
|
@@ -41,6 +41,8 @@ export interface AgentSpec {
|
|
|
41
41
|
skills: SkillSpec[];
|
|
42
42
|
/** Runtime tools available to this agent */
|
|
43
43
|
tools?: ToolSpec[];
|
|
44
|
+
/** Disable tool approvals for this spec (default: false). */
|
|
45
|
+
disableToolApprovals?: boolean;
|
|
44
46
|
/** Frontend tool sets available to this agent */
|
|
45
47
|
frontendTools?: FrontendToolSpec[];
|
|
46
48
|
/** Runtime environment name for this agent */
|
|
@@ -108,7 +110,7 @@ export interface AgentSpec {
|
|
|
108
110
|
/**
|
|
109
111
|
* Configuration for a subagent within an agent specification.
|
|
110
112
|
*/
|
|
111
|
-
export interface
|
|
113
|
+
export interface SubAgentspecConfig {
|
|
112
114
|
/** Unique identifier for the subagent */
|
|
113
115
|
name: string;
|
|
114
116
|
/** Brief description shown to the parent agent */
|
|
@@ -133,7 +135,7 @@ export interface SubAgentSpecConfig {
|
|
|
133
135
|
*/
|
|
134
136
|
export interface SubAgentsConfig {
|
|
135
137
|
/** List of subagent configurations */
|
|
136
|
-
subagents:
|
|
138
|
+
subagents: SubAgentspecConfig[];
|
|
137
139
|
/** Default model for subagents that don't specify one */
|
|
138
140
|
defaultModel?: string;
|
|
139
141
|
/** Include a general-purpose fallback subagent */
|
package/lib/types/teams.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Specification for an agent within a team.
|
|
3
3
|
*/
|
|
4
|
-
export interface
|
|
4
|
+
export interface TeamAgentspec {
|
|
5
5
|
/** Agent identifier within the team */
|
|
6
6
|
id: string;
|
|
7
7
|
/** Display name for the team agent */
|
|
@@ -121,7 +121,7 @@ export interface TeamSpec {
|
|
|
121
121
|
/** Validation settings for the team */
|
|
122
122
|
validation?: TeamValidationSpec;
|
|
123
123
|
/** List of agents in the team */
|
|
124
|
-
agents:
|
|
124
|
+
agents: TeamAgentspec[];
|
|
125
125
|
/** Reaction rules for automatic event handling */
|
|
126
126
|
reactionRules?: TeamReactionRule[];
|
|
127
127
|
/** Health monitoring configuration */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datalayer/agent-runtimes",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"workspaces": [
|
|
6
6
|
".",
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"@ag-ui/encoder": "^0.0.42",
|
|
133
133
|
"@ag-ui/proto": "^0.0.42",
|
|
134
134
|
"@agentclientprotocol/sdk": "^0.8.0",
|
|
135
|
-
"@ai-sdk/react": "^4.0.0-beta.
|
|
135
|
+
"@ai-sdk/react": "^4.0.0-beta.116",
|
|
136
136
|
"@anthropic-ai/sdk": "^0.52.0",
|
|
137
137
|
"@datalayer/core": "^1.0.22",
|
|
138
138
|
"@datalayer/icons-react": "^1.0.7",
|
|
@@ -199,7 +199,7 @@
|
|
|
199
199
|
"@tanstack/react-query": "^5.90.6",
|
|
200
200
|
"@toon-format/toon": "^1.3.0",
|
|
201
201
|
"@xyflow/react": "^12.10.0",
|
|
202
|
-
"ai": "^
|
|
202
|
+
"ai": "^7.0.0-beta.116",
|
|
203
203
|
"ansi-to-html": "^0.7.2",
|
|
204
204
|
"axios": "^1.7.7",
|
|
205
205
|
"boring-avatars": "^2.0.1",
|
|
@@ -308,7 +308,7 @@
|
|
|
308
308
|
},
|
|
309
309
|
"resolutions": {
|
|
310
310
|
"@langchain/core": "^0.3.80",
|
|
311
|
-
"@ai-sdk/react": "^4.0.0-beta.
|
|
311
|
+
"@ai-sdk/react": "^4.0.0-beta.116",
|
|
312
312
|
"@microsoft/fast-colors": "5.3.1",
|
|
313
313
|
"@microsoft/fast-components": "2.30.6",
|
|
314
314
|
"@microsoft/fast-element": "1.13.0",
|
|
@@ -318,7 +318,7 @@
|
|
|
318
318
|
"@microsoft/load-themed-styles": "1.10.295",
|
|
319
319
|
"@types/react": "18.3.20",
|
|
320
320
|
"@types/react-dom": "18.3.6",
|
|
321
|
-
"ai": "^
|
|
321
|
+
"ai": "^7.0.0-beta.116",
|
|
322
322
|
"pyodide": "0.28.0",
|
|
323
323
|
"react": "18.3.1",
|
|
324
324
|
"react-dom": "18.3.1",
|
|
@@ -326,7 +326,7 @@
|
|
|
326
326
|
},
|
|
327
327
|
"overrides": {
|
|
328
328
|
"@langchain/core": "^0.3.80",
|
|
329
|
-
"@ai-sdk/react": "^4.0.0-beta.
|
|
329
|
+
"@ai-sdk/react": "^4.0.0-beta.116",
|
|
330
330
|
"@microsoft/fast-colors": "5.3.1",
|
|
331
331
|
"@microsoft/fast-components": "2.30.6",
|
|
332
332
|
"@microsoft/fast-element": "1.13.0",
|
|
@@ -336,7 +336,7 @@
|
|
|
336
336
|
"@microsoft/load-themed-styles": "1.10.295",
|
|
337
337
|
"@types/react": "18.3.20",
|
|
338
338
|
"@types/react-dom": "18.3.6",
|
|
339
|
-
"ai": "^
|
|
339
|
+
"ai": "^7.0.0-beta.116",
|
|
340
340
|
"pyodide": "0.28.0",
|
|
341
341
|
"react": "18.3.1",
|
|
342
342
|
"react-dom": "18.3.1",
|
|
@@ -154,7 +154,7 @@ Generated from YAML specifications in specs/agents/
|
|
|
154
154
|
from typing import Dict
|
|
155
155
|
|
|
156
156
|
from agent_runtimes.mcp.catalog_mcp_servers import MCP_SERVER_CATALOG
|
|
157
|
-
from agent_runtimes.types import
|
|
157
|
+
from agent_runtimes.types import Agentspec, SubAgentspecConfig, SubAgentsConfig
|
|
158
158
|
|
|
159
159
|
# ============================================================================
|
|
160
160
|
# Agent Specs
|
|
@@ -191,15 +191,15 @@ from agent_runtimes.types import AgentSpec, SubAgentSpecConfig, SubAgentsConfig
|
|
|
191
191
|
version = spec["version"]
|
|
192
192
|
# Prefix agent ID with folder name for uniqueness
|
|
193
193
|
full_agent_id = f"{folder}/{agent_id}" if folder else agent_id
|
|
194
|
-
# Create constant name: e.g., "data-acquisition" -> "
|
|
195
|
-
# But if id already ends with "-agent", don't duplicate: "github-agent" -> "
|
|
194
|
+
# Create constant name: e.g., "data-acquisition" -> "DATA_ACQUISITION_AGENTSPEC"
|
|
195
|
+
# But if id already ends with "-agent", don't duplicate: "github-agent" -> "GITHUB_AGENTSPEC"
|
|
196
196
|
# NO folder prefix for Python constants
|
|
197
197
|
base_name = agent_id.upper().replace("-", "_")
|
|
198
198
|
|
|
199
199
|
if agent_id.endswith("-agent"):
|
|
200
200
|
const_name = base_name + "_SPEC"
|
|
201
201
|
else:
|
|
202
|
-
const_name = base_name + "
|
|
202
|
+
const_name = base_name + "_AGENTSPEC"
|
|
203
203
|
const_name += version_suffix(version)
|
|
204
204
|
agent_ids.append((full_agent_id, const_name, folder))
|
|
205
205
|
|
|
@@ -278,6 +278,14 @@ from agent_runtimes.types import AgentSpec, SubAgentSpecConfig, SubAgentsConfig
|
|
|
278
278
|
inference_provider_str = (
|
|
279
279
|
f'"{inference_provider}"' if inference_provider else "None"
|
|
280
280
|
)
|
|
281
|
+
disable_tool_approvals = spec.get(
|
|
282
|
+
"disable_tool_approvals", spec.get("disableToolApprovals")
|
|
283
|
+
)
|
|
284
|
+
disable_tool_approvals_line = (
|
|
285
|
+
f" disable_tool_approvals={str(bool(disable_tool_approvals))},\n"
|
|
286
|
+
if disable_tool_approvals is not None
|
|
287
|
+
else ""
|
|
288
|
+
)
|
|
281
289
|
|
|
282
290
|
# Sandbox variant field
|
|
283
291
|
sandbox_variant = spec.get("sandbox_variant")
|
|
@@ -335,7 +343,7 @@ from agent_runtimes.types import AgentSpec, SubAgentSpecConfig, SubAgentsConfig
|
|
|
335
343
|
opt_val = sa.get(opt_key)
|
|
336
344
|
if opt_val is not None:
|
|
337
345
|
sa_fields.append(f"{opt_key}={_fmt_py_literal(opt_val)}")
|
|
338
|
-
sa_items.append("
|
|
346
|
+
sa_items.append("SubAgentspecConfig(" + ", ".join(sa_fields) + ")")
|
|
339
347
|
sa_list_str = "[" + ", ".join(sa_items) + "]"
|
|
340
348
|
cfg_parts = [f"subagents={sa_list_str}"]
|
|
341
349
|
if subagents_val.get("default_model") is not None:
|
|
@@ -352,7 +360,7 @@ from agent_runtimes.types import AgentSpec, SubAgentSpecConfig, SubAgentsConfig
|
|
|
352
360
|
)
|
|
353
361
|
subagents_str = "SubAgentsConfig(" + ", ".join(cfg_parts) + ")"
|
|
354
362
|
|
|
355
|
-
code += f'''{const_name} =
|
|
363
|
+
code += f'''{const_name} = Agentspec(
|
|
356
364
|
id="{full_agent_id}",
|
|
357
365
|
version="{version}",
|
|
358
366
|
name="{spec["name"]}",
|
|
@@ -364,7 +372,7 @@ from agent_runtimes.types import AgentSpec, SubAgentSpecConfig, SubAgentsConfig
|
|
|
364
372
|
mcp_servers=[{mcp_servers_str}],
|
|
365
373
|
skills={_fmt_list(skill_refs)},
|
|
366
374
|
tools={_fmt_list(tool_refs)},
|
|
367
|
-
frontend_tools={_fmt_list(frontend_tool_refs)},
|
|
375
|
+
{disable_tool_approvals_line} frontend_tools={_fmt_list(frontend_tool_refs)},
|
|
368
376
|
environment_name="{spec.get("environment_name", "ai-agents-env")}",
|
|
369
377
|
icon={icon},
|
|
370
378
|
emoji={emoji},
|
|
@@ -405,7 +413,7 @@ from agent_runtimes.types import AgentSpec, SubAgentSpecConfig, SubAgentsConfig
|
|
|
405
413
|
# Agent Specs Registry
|
|
406
414
|
# ============================================================================
|
|
407
415
|
|
|
408
|
-
|
|
416
|
+
AGENTSPECS: Dict[str, Agentspec] = {
|
|
409
417
|
"""
|
|
410
418
|
|
|
411
419
|
# Sort by folder for organized registry
|
|
@@ -421,7 +429,7 @@ AGENT_SPECS: Dict[str, AgentSpec] = {
|
|
|
421
429
|
code += """}
|
|
422
430
|
|
|
423
431
|
|
|
424
|
-
def get_agent_spec(agent_id: str) ->
|
|
432
|
+
def get_agent_spec(agent_id: str) -> Agentspec | None:
|
|
425
433
|
\"\"\"
|
|
426
434
|
Get an agent specification by ID (accepts both bare and versioned refs).
|
|
427
435
|
|
|
@@ -429,18 +437,18 @@ def get_agent_spec(agent_id: str) -> AgentSpec | None:
|
|
|
429
437
|
agent_id: The unique identifier of the agent.
|
|
430
438
|
|
|
431
439
|
Returns:
|
|
432
|
-
The
|
|
440
|
+
The Agentspec configuration, or None if not found.
|
|
433
441
|
\"\"\"
|
|
434
|
-
spec =
|
|
442
|
+
spec = AGENTSPECS.get(agent_id)
|
|
435
443
|
if spec is not None:
|
|
436
444
|
return spec
|
|
437
445
|
base, _, ver = agent_id.rpartition(':')
|
|
438
446
|
if base and '.' in ver:
|
|
439
|
-
return
|
|
447
|
+
return AGENTSPECS.get(base)
|
|
440
448
|
return None
|
|
441
449
|
|
|
442
450
|
|
|
443
|
-
def
|
|
451
|
+
def list_agentspecs(prefix: str | None = None) -> list[Agentspec]:
|
|
444
452
|
\"\"\"
|
|
445
453
|
List all available agent specifications.
|
|
446
454
|
|
|
@@ -448,9 +456,9 @@ def list_agent_specs(prefix: str | None = None) -> list[AgentSpec]:
|
|
|
448
456
|
prefix: If provided, only return specs whose ID starts with this prefix.
|
|
449
457
|
|
|
450
458
|
Returns:
|
|
451
|
-
List of all
|
|
459
|
+
List of all Agentspec configurations.
|
|
452
460
|
\"\"\"
|
|
453
|
-
specs = list(
|
|
461
|
+
specs = list(AGENTSPECS.values())
|
|
454
462
|
if prefix is not None:
|
|
455
463
|
specs = [s for s in specs if s.id.startswith(prefix)]
|
|
456
464
|
return specs
|
|
@@ -618,7 +626,7 @@ def generate_typescript_code(
|
|
|
618
626
|
* Generated from YAML specifications in specs/agents/
|
|
619
627
|
*/
|
|
620
628
|
|
|
621
|
-
import type {
|
|
629
|
+
import type { Agentspec } from '"""
|
|
622
630
|
code += types_import_path
|
|
623
631
|
code += """';
|
|
624
632
|
"""
|
|
@@ -752,15 +760,15 @@ const FRONTEND_TOOL_MAP: Record<string, any> = {
|
|
|
752
760
|
version = spec["version"]
|
|
753
761
|
# Prefix agent ID with folder name for uniqueness
|
|
754
762
|
full_agent_id = f"{folder}/{agent_id}" if folder else agent_id
|
|
755
|
-
# Create constant name: e.g., "data-acquisition" -> "
|
|
756
|
-
# But if id already ends with "-agent", don't duplicate: "github-agent" -> "
|
|
763
|
+
# Create constant name: e.g., "data-acquisition" -> "DATA_ACQUISITION_AGENTSPEC"
|
|
764
|
+
# But if id already ends with "-agent", don't duplicate: "github-agent" -> "GITHUB_AGENTSPEC"
|
|
757
765
|
# NO folder prefix for TypeScript constants
|
|
758
766
|
base_name = agent_id.upper().replace("-", "_")
|
|
759
767
|
|
|
760
768
|
if agent_id.endswith("-agent"):
|
|
761
769
|
const_name = base_name + "_SPEC"
|
|
762
770
|
else:
|
|
763
|
-
const_name = base_name + "
|
|
771
|
+
const_name = base_name + "_AGENTSPEC"
|
|
764
772
|
const_name += version_suffix(version)
|
|
765
773
|
agent_ids.append((full_agent_id, const_name, folder))
|
|
766
774
|
|
|
@@ -855,6 +863,14 @@ const FRONTEND_TOOL_MAP: Record<string, any> = {
|
|
|
855
863
|
inference_provider_ts = (
|
|
856
864
|
f"'{inference_provider}'" if inference_provider else "undefined"
|
|
857
865
|
)
|
|
866
|
+
disable_tool_approvals = spec.get(
|
|
867
|
+
"disable_tool_approvals", spec.get("disableToolApprovals")
|
|
868
|
+
)
|
|
869
|
+
disable_tool_approvals_line = (
|
|
870
|
+
f" disableToolApprovals: {'true' if bool(disable_tool_approvals) else 'false'},\n"
|
|
871
|
+
if disable_tool_approvals is not None
|
|
872
|
+
else ""
|
|
873
|
+
)
|
|
858
874
|
|
|
859
875
|
# Sandbox variant field
|
|
860
876
|
sandbox_variant = spec.get("sandbox_variant")
|
|
@@ -902,7 +918,7 @@ const FRONTEND_TOOL_MAP: Record<string, any> = {
|
|
|
902
918
|
else ""
|
|
903
919
|
)
|
|
904
920
|
|
|
905
|
-
code += f"""export const {const_name}:
|
|
921
|
+
code += f"""export const {const_name}: Agentspec = {{
|
|
906
922
|
id: '{full_agent_id}',
|
|
907
923
|
version: '{version}',
|
|
908
924
|
name: '{spec["name"]}',
|
|
@@ -913,7 +929,7 @@ const FRONTEND_TOOL_MAP: Record<string, any> = {
|
|
|
913
929
|
{inference_provider_line} mcpServers: [{mcp_servers_str}],
|
|
914
930
|
skills: [{skills_str}].filter(Boolean) as SkillSpec[],
|
|
915
931
|
tools: [{tools_str}],
|
|
916
|
-
frontendTools: [{frontend_tools_str}],
|
|
932
|
+
{disable_tool_approvals_line} frontendTools: [{frontend_tools_str}],
|
|
917
933
|
environmentName: '{spec.get("environment_name", "ai-agents-env")}',
|
|
918
934
|
icon: {icon},
|
|
919
935
|
emoji: {emoji},
|
|
@@ -953,7 +969,7 @@ const FRONTEND_TOOL_MAP: Record<string, any> = {
|
|
|
953
969
|
// Agent Specs Registry
|
|
954
970
|
// ============================================================================
|
|
955
971
|
|
|
956
|
-
export const
|
|
972
|
+
export const AGENTSPECS: Record<string, Agentspec> = {
|
|
957
973
|
"""
|
|
958
974
|
|
|
959
975
|
# Sort by folder for organized registry
|
|
@@ -969,11 +985,11 @@ export const AGENT_SPECS: Record<string, AgentSpec> = {
|
|
|
969
985
|
code += """};
|
|
970
986
|
|
|
971
987
|
function resolveAgentId(agentId: string): string {
|
|
972
|
-
if (agentId in
|
|
988
|
+
if (agentId in AGENTSPECS) return agentId;
|
|
973
989
|
const idx = agentId.lastIndexOf(':');
|
|
974
990
|
if (idx > 0) {
|
|
975
991
|
const base = agentId.slice(0, idx);
|
|
976
|
-
if (base in
|
|
992
|
+
if (base in AGENTSPECS) return base;
|
|
977
993
|
}
|
|
978
994
|
return agentId;
|
|
979
995
|
}
|
|
@@ -981,8 +997,8 @@ function resolveAgentId(agentId: string): string {
|
|
|
981
997
|
/**
|
|
982
998
|
* Get an agent specification by ID.
|
|
983
999
|
*/
|
|
984
|
-
export function
|
|
985
|
-
return
|
|
1000
|
+
export function getAgentspecs(agentId: string): Agentspec | undefined {
|
|
1001
|
+
return AGENTSPECS[resolveAgentId(agentId)];
|
|
986
1002
|
}
|
|
987
1003
|
|
|
988
1004
|
/**
|
|
@@ -990,8 +1006,8 @@ export function getAgentSpecs(agentId: string): AgentSpec | undefined {
|
|
|
990
1006
|
*
|
|
991
1007
|
* @param prefix - If provided, only return specs whose ID starts with this prefix.
|
|
992
1008
|
*/
|
|
993
|
-
export function
|
|
994
|
-
const specs = Object.values(
|
|
1009
|
+
export function listAgentspecs(prefix?: string): Agentspec[] {
|
|
1010
|
+
const specs = Object.values(AGENTSPECS);
|
|
995
1011
|
return prefix !== undefined ? specs.filter(s => s.id.startsWith(prefix)) : specs;
|
|
996
1012
|
}
|
|
997
1013
|
|
|
@@ -1001,7 +1017,7 @@ export function listAgentSpecs(prefix?: string): AgentSpec[] {
|
|
|
1001
1017
|
* Iterates over the spec's MCP servers and skills and returns the
|
|
1002
1018
|
* deduplicated union of their `requiredEnvVars` arrays.
|
|
1003
1019
|
*/
|
|
1004
|
-
export function
|
|
1020
|
+
export function getAgentspecRequiredEnvVars(spec: Agentspec): string[] {
|
|
1005
1021
|
const vars = new Set<string>();
|
|
1006
1022
|
const baseEnvVar = (v: string): string => v.split(':')[0] ?? v;
|
|
1007
1023
|
for (const server of spec.mcpServers) {
|
|
@@ -1039,7 +1055,7 @@ def update_init_file(
|
|
|
1039
1055
|
if agent_id.endswith("-agent"):
|
|
1040
1056
|
const_name = base_name + "_SPEC"
|
|
1041
1057
|
else:
|
|
1042
|
-
const_name = base_name + "
|
|
1058
|
+
const_name = base_name + "_AGENTSPEC"
|
|
1043
1059
|
const_names.append(const_name)
|
|
1044
1060
|
|
|
1045
1061
|
# Sort for consistent ordering
|
|
@@ -1056,11 +1072,11 @@ def update_init_file(
|
|
|
1056
1072
|
pattern = r"(from \.agents import \(\n)(.*?)(\n\))"
|
|
1057
1073
|
|
|
1058
1074
|
# Build new imports
|
|
1059
|
-
new_imports = "
|
|
1075
|
+
new_imports = " AGENTSPECS,\n"
|
|
1060
1076
|
for const_name in const_names:
|
|
1061
1077
|
new_imports += f" {const_name},\n"
|
|
1062
1078
|
new_imports += " get_agent_spec,\n"
|
|
1063
|
-
new_imports += "
|
|
1079
|
+
new_imports += " list_agentspecs,"
|
|
1064
1080
|
|
|
1065
1081
|
# Replace the imports
|
|
1066
1082
|
new_content = re.sub(pattern, r"\1" + new_imports + r"\3", content, flags=re.DOTALL)
|
|
@@ -1128,15 +1144,15 @@ def generate_subfolder_structure(specs: List[tuple[str, Dict[str, Any]]], args):
|
|
|
1128
1144
|
|
|
1129
1145
|
from .agents import *
|
|
1130
1146
|
|
|
1131
|
-
__all__ = ["
|
|
1147
|
+
__all__ = ["AGENTSPECS", "get_agent_spec", "list_agentspecs"]
|
|
1132
1148
|
""")
|
|
1133
1149
|
|
|
1134
1150
|
# Collect imports for main index
|
|
1135
1151
|
if is_root:
|
|
1136
|
-
all_python_imports.append("from .agents import
|
|
1152
|
+
all_python_imports.append("from .agents import AGENTSPECS as ROOT_AGENTS")
|
|
1137
1153
|
else:
|
|
1138
1154
|
all_python_imports.append(
|
|
1139
|
-
f"from .{folder_python_name} import
|
|
1155
|
+
f"from .{folder_python_name} import AGENTSPECS as {folder_python_name.upper()}_AGENTS"
|
|
1140
1156
|
)
|
|
1141
1157
|
|
|
1142
1158
|
# Create TypeScript output file
|
|
@@ -1187,7 +1203,7 @@ THIS FILE IS AUTO-GENERATED. DO NOT EDIT MANUALLY.
|
|
|
1187
1203
|
\"\"\"
|
|
1188
1204
|
|
|
1189
1205
|
from typing import Dict
|
|
1190
|
-
from agent_runtimes.types import
|
|
1206
|
+
from agent_runtimes.types import Agentspec
|
|
1191
1207
|
|
|
1192
1208
|
"""
|
|
1193
1209
|
|
|
@@ -1198,43 +1214,43 @@ from agent_runtimes.types import AgentSpec
|
|
|
1198
1214
|
# Merge all agent specs
|
|
1199
1215
|
python_index_content += """
|
|
1200
1216
|
# Merge all agent specs from subfolders
|
|
1201
|
-
|
|
1217
|
+
AGENTSPECS: Dict[str, Agentspec] = {}
|
|
1202
1218
|
"""
|
|
1203
1219
|
|
|
1204
1220
|
for folder in sorted(specs_by_folder.keys()):
|
|
1205
1221
|
if folder:
|
|
1206
1222
|
folder_python_name = folder.replace("-", "_")
|
|
1207
1223
|
python_index_content += (
|
|
1208
|
-
f"
|
|
1224
|
+
f"AGENTSPECS.update({folder_python_name.upper()}_AGENTS)\n"
|
|
1209
1225
|
)
|
|
1210
1226
|
else:
|
|
1211
|
-
python_index_content += "
|
|
1227
|
+
python_index_content += "AGENTSPECS.update(ROOT_AGENTS)\n"
|
|
1212
1228
|
|
|
1213
1229
|
python_index_content += """
|
|
1214
1230
|
|
|
1215
|
-
def get_agent_spec(agent_id: str) ->
|
|
1231
|
+
def get_agent_spec(agent_id: str) -> Agentspec | None:
|
|
1216
1232
|
\"\"\"Get an agent specification by ID.\"\"\"
|
|
1217
|
-
spec =
|
|
1233
|
+
spec = AGENTSPECS.get(agent_id)
|
|
1218
1234
|
if spec is not None:
|
|
1219
1235
|
return spec
|
|
1220
1236
|
base, _, ver = agent_id.rpartition(':')
|
|
1221
1237
|
if base and '.' in ver:
|
|
1222
|
-
return
|
|
1238
|
+
return AGENTSPECS.get(base)
|
|
1223
1239
|
return None
|
|
1224
1240
|
|
|
1225
1241
|
|
|
1226
|
-
def
|
|
1242
|
+
def list_agentspecs(prefix: str | None = None) -> list[Agentspec]:
|
|
1227
1243
|
\"\"\"List all available agent specifications.
|
|
1228
1244
|
|
|
1229
1245
|
Args:
|
|
1230
1246
|
prefix: If provided, only return specs whose ID starts with this prefix.
|
|
1231
1247
|
\"\"\"
|
|
1232
|
-
specs = list(
|
|
1248
|
+
specs = list(AGENTSPECS.values())
|
|
1233
1249
|
if prefix is not None:
|
|
1234
1250
|
specs = [s for s in specs if s.id.startswith(prefix)]
|
|
1235
1251
|
return specs
|
|
1236
1252
|
|
|
1237
|
-
__all__ = ["
|
|
1253
|
+
__all__ = ["AGENTSPECS", "get_agent_spec", "list_agentspecs"]
|
|
1238
1254
|
"""
|
|
1239
1255
|
|
|
1240
1256
|
with open(python_index, "w") as f:
|
|
@@ -1253,23 +1269,25 @@ __all__ = ["AGENT_SPECS", "get_agent_spec", "list_agent_specs"]
|
|
|
1253
1269
|
* THIS FILE IS AUTO-GENERATED. DO NOT EDIT MANUALLY.
|
|
1254
1270
|
*/
|
|
1255
1271
|
|
|
1256
|
-
import type {
|
|
1272
|
+
import type { Agentspec } from '../../types';
|
|
1257
1273
|
|
|
1258
1274
|
"""
|
|
1259
1275
|
|
|
1260
|
-
# Import
|
|
1276
|
+
# Import AGENTSPECS from each subfolder
|
|
1261
1277
|
for folder in sorted(specs_by_folder.keys()):
|
|
1262
1278
|
if folder:
|
|
1263
1279
|
folder_const = folder.replace("-", "_").upper()
|
|
1264
|
-
typescript_index_content +=
|
|
1280
|
+
typescript_index_content += (
|
|
1281
|
+
f"import {{ AGENTSPECS as {folder_const}_AGENTS }} from './{folder}';\n"
|
|
1282
|
+
)
|
|
1265
1283
|
else:
|
|
1266
1284
|
typescript_index_content += (
|
|
1267
|
-
"import {
|
|
1285
|
+
"import { AGENTSPECS as ROOT_AGENTS } from './agents';\n"
|
|
1268
1286
|
)
|
|
1269
1287
|
|
|
1270
1288
|
typescript_index_content += """
|
|
1271
1289
|
// Merge all agent specs from subfolders
|
|
1272
|
-
export const
|
|
1290
|
+
export const AGENTSPECS: Record<string, Agentspec> = {
|
|
1273
1291
|
"""
|
|
1274
1292
|
|
|
1275
1293
|
for folder in sorted(specs_by_folder.keys()):
|
|
@@ -1282,11 +1300,11 @@ export const AGENT_SPECS: Record<string, AgentSpec> = {
|
|
|
1282
1300
|
typescript_index_content += """};
|
|
1283
1301
|
|
|
1284
1302
|
function resolveAgentId(agentId: string): string {
|
|
1285
|
-
if (agentId in
|
|
1303
|
+
if (agentId in AGENTSPECS) return agentId;
|
|
1286
1304
|
const idx = agentId.lastIndexOf(':');
|
|
1287
1305
|
if (idx > 0) {
|
|
1288
1306
|
const base = agentId.slice(0, idx);
|
|
1289
|
-
if (base in
|
|
1307
|
+
if (base in AGENTSPECS) return base;
|
|
1290
1308
|
}
|
|
1291
1309
|
return agentId;
|
|
1292
1310
|
}
|
|
@@ -1294,8 +1312,8 @@ function resolveAgentId(agentId: string): string {
|
|
|
1294
1312
|
/**
|
|
1295
1313
|
* Get an agent specification by ID.
|
|
1296
1314
|
*/
|
|
1297
|
-
export function
|
|
1298
|
-
return
|
|
1315
|
+
export function getAgentspecs(agentId: string): Agentspec | undefined {
|
|
1316
|
+
return AGENTSPECS[resolveAgentId(agentId)];
|
|
1299
1317
|
}
|
|
1300
1318
|
|
|
1301
1319
|
/**
|
|
@@ -1303,15 +1321,15 @@ export function getAgentSpecs(agentId: string): AgentSpec | undefined {
|
|
|
1303
1321
|
*
|
|
1304
1322
|
* @param prefix - If provided, only return specs whose ID starts with this prefix.
|
|
1305
1323
|
*/
|
|
1306
|
-
export function
|
|
1307
|
-
const specs = Object.values(
|
|
1324
|
+
export function listAgentspecs(prefix?: string): Agentspec[] {
|
|
1325
|
+
const specs = Object.values(AGENTSPECS);
|
|
1308
1326
|
return prefix !== undefined ? specs.filter(s => s.id.startsWith(prefix)) : specs;
|
|
1309
1327
|
}
|
|
1310
1328
|
|
|
1311
1329
|
/**
|
|
1312
1330
|
* Collect all required environment variables for an agent spec.
|
|
1313
1331
|
*/
|
|
1314
|
-
export function
|
|
1332
|
+
export function getAgentspecRequiredEnvVars(spec: Agentspec): string[] {
|
|
1315
1333
|
const vars = new Set<string>();
|
|
1316
1334
|
for (const server of spec.mcpServers) {
|
|
1317
1335
|
for (const v of server.requiredEnvVars ?? []) {
|
|
@@ -104,9 +104,9 @@ def load_yaml_specs(specs_dir: Path) -> List[tuple[str, Dict[str, Any]]]:
|
|
|
104
104
|
|
|
105
105
|
|
|
106
106
|
def _generate_team_agent_py(agent: Dict[str, Any]) -> str:
|
|
107
|
-
"""Generate Python code for a
|
|
107
|
+
"""Generate Python code for a TeamAgentspec."""
|
|
108
108
|
lines = []
|
|
109
|
-
lines.append("
|
|
109
|
+
lines.append("TeamAgentspec(")
|
|
110
110
|
lines.append(f' id="{agent.get("id", "")}",')
|
|
111
111
|
lines.append(f' name="{agent.get("name", "")}",')
|
|
112
112
|
lines.append(f' role="{agent.get("role", "")}",')
|
|
@@ -124,7 +124,7 @@ def _generate_team_agent_py(agent: Dict[str, Any]) -> str:
|
|
|
124
124
|
|
|
125
125
|
|
|
126
126
|
def _generate_team_agent_ts(agent: Dict[str, Any]) -> str:
|
|
127
|
-
"""Generate TypeScript code for a
|
|
127
|
+
"""Generate TypeScript code for a TeamAgentspec."""
|
|
128
128
|
goal = agent.get("goal", "").replace("`", "\\`").replace("\n", " ").strip()
|
|
129
129
|
tools = json.dumps(agent.get("tools", []))
|
|
130
130
|
trigger = agent.get("trigger", "").replace("'", "\\'")
|
|
@@ -156,7 +156,7 @@ DO NOT EDIT MANUALLY - run 'make specs' to regenerate.
|
|
|
156
156
|
from typing import Dict, Optional
|
|
157
157
|
|
|
158
158
|
from agent_runtimes.types import (
|
|
159
|
-
|
|
159
|
+
TeamAgentspec,
|
|
160
160
|
TeamHealthMonitoring,
|
|
161
161
|
TeamOutputSpec,
|
|
162
162
|
TeamReactionRule,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|