@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
|
@@ -604,6 +604,42 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
604
604
|
requestAiAgentsApprovalHistory,
|
|
605
605
|
sendAiAgentsApprovalDecision,
|
|
606
606
|
]);
|
|
607
|
+
const reconcileResolvedApprovalInStore = useCallback((approval) => {
|
|
608
|
+
const state = agentRuntimeStore.getState();
|
|
609
|
+
const removalIds = new Set([approval.id]);
|
|
610
|
+
const hasResolvedToolName = Boolean(approval.tool_name);
|
|
611
|
+
const resolvedSignature = hasResolvedToolName
|
|
612
|
+
? approvalSignature(approval.tool_name, approval.tool_args ?? {})
|
|
613
|
+
: null;
|
|
614
|
+
for (const existing of state.approvals) {
|
|
615
|
+
if (existing.status !== 'pending') {
|
|
616
|
+
continue;
|
|
617
|
+
}
|
|
618
|
+
if (!isApprovalForAgent(existing, activeAgentId)) {
|
|
619
|
+
continue;
|
|
620
|
+
}
|
|
621
|
+
if (existing.id === approval.id) {
|
|
622
|
+
removalIds.add(existing.id);
|
|
623
|
+
continue;
|
|
624
|
+
}
|
|
625
|
+
if (approval.tool_call_id &&
|
|
626
|
+
existing.tool_call_id &&
|
|
627
|
+
existing.tool_call_id === approval.tool_call_id) {
|
|
628
|
+
removalIds.add(existing.id);
|
|
629
|
+
continue;
|
|
630
|
+
}
|
|
631
|
+
if (!resolvedSignature || !existing.tool_name) {
|
|
632
|
+
continue;
|
|
633
|
+
}
|
|
634
|
+
const existingSignature = approvalSignature(existing.tool_name, existing.tool_args ?? {});
|
|
635
|
+
if (existingSignature === resolvedSignature) {
|
|
636
|
+
removalIds.add(existing.id);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
for (const id of removalIds) {
|
|
640
|
+
state.removeApproval(id);
|
|
641
|
+
}
|
|
642
|
+
}, [activeAgentId]);
|
|
607
643
|
// Optional ai-agents bridge for server-mode visibility.
|
|
608
644
|
// This keeps approval synchronization in ChatBase so examples do not need
|
|
609
645
|
// their own approval websocket plumbing.
|
|
@@ -702,7 +738,7 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
702
738
|
state.upsertApproval(scopedApproval);
|
|
703
739
|
}
|
|
704
740
|
else {
|
|
705
|
-
|
|
741
|
+
reconcileResolvedApprovalInStore(scopedApproval);
|
|
706
742
|
}
|
|
707
743
|
}
|
|
708
744
|
}
|
|
@@ -730,6 +766,7 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
730
766
|
aiAgentsAuthToken,
|
|
731
767
|
activeAgentId,
|
|
732
768
|
isSuppressedPending,
|
|
769
|
+
reconcileResolvedApprovalInStore,
|
|
733
770
|
]);
|
|
734
771
|
// The outer ChatBase wrapper always resolves a string Protocol to a full
|
|
735
772
|
// ProtocolConfig (or undefined). Narrow the type for internal use.
|
|
@@ -964,6 +1001,7 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
964
1001
|
}
|
|
965
1002
|
return;
|
|
966
1003
|
}
|
|
1004
|
+
reconcileResolvedApprovalInStore(payload);
|
|
967
1005
|
applyServerApprovalDecision(payload, msg.type === 'tool_approval_approved', payload.note ?? undefined);
|
|
968
1006
|
},
|
|
969
1007
|
});
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* @module client/AgentsMixin
|
|
12
12
|
*/
|
|
13
13
|
import type { Constructor } from '@datalayer/core/lib/client/utils/mixins';
|
|
14
|
-
import type { AgentEvent, CreateAgentEventRequest, GetAgentEventResponse, ListAgentEventsParams, ListAgentEventsResponse, UpdateAgentEventRequest, RunningAgent, AgentUsageSummary, ConversationCheckpoint, AgentNotification, NotificationFilters, OutputArtifact, EvalReport, RunEvalsRequest, ContextUsage, CostUsage,
|
|
14
|
+
import type { AgentEvent, CreateAgentEventRequest, GetAgentEventResponse, ListAgentEventsParams, ListAgentEventsResponse, UpdateAgentEventRequest, RunningAgent, AgentUsageSummary, ConversationCheckpoint, AgentNotification, NotificationFilters, OutputArtifact, EvalReport, RunEvalsRequest, ContextUsage, CostUsage, Agentspec } from '../types';
|
|
15
15
|
import type { CreateAgentRuntimeRequest, CreateRuntimeApiResponse } from '../types/agents-lifecycle';
|
|
16
16
|
/** Agents mixin providing durable agent management. */
|
|
17
17
|
export declare function AgentsMixin<TBase extends Constructor>(Base: TBase): {
|
|
@@ -153,19 +153,19 @@ export declare function AgentsMixin<TBase extends Constructor>(Base: TBase): {
|
|
|
153
153
|
* @param agentSpecId - Agent spec identifier.
|
|
154
154
|
* @returns The agent spec, or undefined if not found.
|
|
155
155
|
*/
|
|
156
|
-
|
|
156
|
+
getAgentspec(agentSpecId: string): Agentspec | undefined;
|
|
157
157
|
/**
|
|
158
158
|
* List all available agent specifications.
|
|
159
159
|
* @param prefix - If provided, only return specs whose ID starts with this prefix.
|
|
160
160
|
* @returns Array of agent specifications.
|
|
161
161
|
*/
|
|
162
|
-
|
|
162
|
+
listAgentspecs(prefix?: string): Agentspec[];
|
|
163
163
|
/**
|
|
164
164
|
* Get required environment variables for an agent spec.
|
|
165
165
|
* @param spec - The agent specification.
|
|
166
166
|
* @returns Deduplicated array of required environment variable names.
|
|
167
167
|
*/
|
|
168
|
-
|
|
168
|
+
getAgentspecRequiredEnvVars(spec: Agentspec): string[];
|
|
169
169
|
/**
|
|
170
170
|
* Assign an agent runtime to a project.
|
|
171
171
|
* @param projectUid - Project UID.
|
|
@@ -8,7 +8,7 @@ import * as events from '../api/events';
|
|
|
8
8
|
import * as output from '../api/output';
|
|
9
9
|
import * as evals from '../api/evals';
|
|
10
10
|
import * as context from '../api/context';
|
|
11
|
-
import * as
|
|
11
|
+
import * as agentspecs from '../specs/agents';
|
|
12
12
|
import { requestDatalayerAPI } from '@datalayer/core/lib/api/DatalayerApi';
|
|
13
13
|
/** Agents mixin providing durable agent management. */
|
|
14
14
|
export function AgentsMixin(Base) {
|
|
@@ -261,24 +261,24 @@ export function AgentsMixin(Base) {
|
|
|
261
261
|
* @param agentSpecId - Agent spec identifier.
|
|
262
262
|
* @returns The agent spec, or undefined if not found.
|
|
263
263
|
*/
|
|
264
|
-
|
|
265
|
-
return
|
|
264
|
+
getAgentspec(agentSpecId) {
|
|
265
|
+
return agentspecs.getAgentspecs(agentSpecId);
|
|
266
266
|
}
|
|
267
267
|
/**
|
|
268
268
|
* List all available agent specifications.
|
|
269
269
|
* @param prefix - If provided, only return specs whose ID starts with this prefix.
|
|
270
270
|
* @returns Array of agent specifications.
|
|
271
271
|
*/
|
|
272
|
-
|
|
273
|
-
return
|
|
272
|
+
listAgentspecs(prefix) {
|
|
273
|
+
return agentspecs.listAgentspecs(prefix);
|
|
274
274
|
}
|
|
275
275
|
/**
|
|
276
276
|
* Get required environment variables for an agent spec.
|
|
277
277
|
* @param spec - The agent specification.
|
|
278
278
|
* @returns Deduplicated array of required environment variable names.
|
|
279
279
|
*/
|
|
280
|
-
|
|
281
|
-
return
|
|
280
|
+
getAgentspecRequiredEnvVars(spec) {
|
|
281
|
+
return agentspecs.getAgentspecRequiredEnvVars(spec);
|
|
282
282
|
}
|
|
283
283
|
// ========================================================================
|
|
284
284
|
// Project Agent Assignment
|
|
@@ -30,6 +30,18 @@ export function ToolApprovalCard({ approval, onApprove, onReject, onToggleRead,
|
|
|
30
30
|
const detailLabelSx = { color: 'fg.muted' };
|
|
31
31
|
const detailValueSx = { color: 'fg.default' };
|
|
32
32
|
const isRead = approval.isRead ?? false;
|
|
33
|
+
const statusDescriptor = approval.status === 'approved_with_changes'
|
|
34
|
+
? 'approved with changes'
|
|
35
|
+
: approval.status;
|
|
36
|
+
// Review text must follow status, not only reviewedAt.
|
|
37
|
+
// Some websocket flows can have an already-decided status before reviewer
|
|
38
|
+
// metadata is hydrated; rendering "review pending" in that window is
|
|
39
|
+
// misleading, so non-pending statuses get a status-based summary.
|
|
40
|
+
const reviewSummary = approval.reviewedAt
|
|
41
|
+
? `, reviewed by ${approval.reviewedBy || 'reviewer'} ${formatRelativeTime(approval.reviewedAt)}`
|
|
42
|
+
: approval.status === 'pending'
|
|
43
|
+
? ', review pending'
|
|
44
|
+
: `, ${statusDescriptor}`;
|
|
33
45
|
return (_jsx(Box, { sx: {
|
|
34
46
|
p: 3,
|
|
35
47
|
borderRadius: 2,
|
|
@@ -47,9 +59,7 @@ export function ToolApprovalCard({ approval, onApprove, onReject, onToggleRead,
|
|
|
47
59
|
gap: 2,
|
|
48
60
|
mb: 1,
|
|
49
61
|
flexWrap: 'wrap',
|
|
50
|
-
}, children: [_jsx(Text, { sx: { fontWeight: 'bold', fontSize: 2 }, children: approval.toolName }), _jsx(Label, { variant: statusConfig.variant, children: statusConfig.label }), _jsx(Label, { variant: riskConfig.variant, children: riskConfig.label }), !isRead && _jsx(Label, { variant: "accent", children: "Unread" })] }), _jsxs(Text, { sx: { color: 'fg.muted', fontSize: 0, display: 'block' }, children: ["Requested by ", approval.requestedBy, ' ', formatRelativeTime(approval.requestedAt),
|
|
51
|
-
? `, reviewed by ${approval.reviewedBy || 'reviewer'} ${formatRelativeTime(approval.reviewedAt)}`
|
|
52
|
-
: ', review pending'] }), _jsx(Box, { sx: {
|
|
62
|
+
}, children: [_jsx(Text, { sx: { fontWeight: 'bold', fontSize: 2 }, children: approval.toolName }), _jsx(Label, { variant: statusConfig.variant, children: statusConfig.label }), _jsx(Label, { variant: riskConfig.variant, children: riskConfig.label }), !isRead && _jsx(Label, { variant: "accent", children: "Unread" })] }), _jsxs(Text, { sx: { color: 'fg.muted', fontSize: 0, display: 'block' }, children: ["Requested by ", approval.requestedBy, ' ', formatRelativeTime(approval.requestedAt), reviewSummary] }), _jsx(Box, { sx: {
|
|
53
63
|
mt: 2,
|
|
54
64
|
width: '100%',
|
|
55
65
|
p: 2,
|
|
@@ -5,7 +5,7 @@ import type { AgentLibrary, Extension, McpServerSelection, Protocol } from '../t
|
|
|
5
5
|
/**
|
|
6
6
|
* Agent spec entry from the library endpoint.
|
|
7
7
|
*/
|
|
8
|
-
export interface
|
|
8
|
+
export interface LibraryAgentspec {
|
|
9
9
|
[key: string]: unknown;
|
|
10
10
|
id: string;
|
|
11
11
|
version?: string;
|
|
@@ -121,7 +121,7 @@ export interface AgentConfigurationProps {
|
|
|
121
121
|
/** Selected MCP servers */
|
|
122
122
|
selectedMcpServers?: McpServerSelection[];
|
|
123
123
|
/** Cloud-discovered specs fetched from a remote runtime catalog. */
|
|
124
|
-
cloudLibrarySpecs?:
|
|
124
|
+
cloudLibrarySpecs?: LibraryAgentspec[];
|
|
125
125
|
/** Loading state for cloud library specs. */
|
|
126
126
|
cloudLibraryLoading?: boolean;
|
|
127
127
|
/** Optional cloud library fetch error message. */
|
package/lib/config/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './utils';
|
|
2
2
|
export { AgentConfiguration, AGENT_LIBRARIES, TRANSPORTS, EXTENSIONS, isSpecSelection, getSpecId, } from './AgentConfiguration';
|
|
3
|
-
export type { AgentConfigurationProps, SkillOption,
|
|
3
|
+
export type { AgentConfigurationProps, SkillOption, LibraryAgentspec, } from './AgentConfiguration';
|
|
@@ -35,8 +35,8 @@ import { useDeletePausedAgentRuntime } from '../hooks/useCheckpoints';
|
|
|
35
35
|
import { AGENT_STATUS_COLORS } from '../types/agents';
|
|
36
36
|
const queryClient = new QueryClient();
|
|
37
37
|
// ─── Defaults ──────────────────────────────────────────────────────────────
|
|
38
|
-
const
|
|
39
|
-
const DEMO_AGENT_NAME =
|
|
38
|
+
const AGENTSPEC_ID = 'monitor-sales-kpis';
|
|
39
|
+
const DEMO_AGENT_NAME = AGENTSPEC_ID;
|
|
40
40
|
const LIGHT_CHECKPOINT_MESSAGES = [
|
|
41
41
|
'[Checkpoint] Captured message history snapshot',
|
|
42
42
|
'[Checkpoint] Saved conversational context for lightweight resume',
|
|
@@ -45,7 +45,7 @@ const LIGHT_CHECKPOINT_MESSAGES = [
|
|
|
45
45
|
* Agent spec attributes displayed in the sidebar.
|
|
46
46
|
* In production this would be fetched from the agentspecs service.
|
|
47
47
|
*/
|
|
48
|
-
const
|
|
48
|
+
const AGENTSPEC = {
|
|
49
49
|
id: 'monitor-sales-kpis',
|
|
50
50
|
name: 'Monitor Sales KPIs',
|
|
51
51
|
description: 'Monitor and analyze sales KPIs from the CRM system. Generate daily reports, identify trends, and flag anomalies.',
|
|
@@ -86,9 +86,9 @@ const SpecRow = ({ icon: Icon, label, value }) => (_jsxs(Box, { sx: {
|
|
|
86
86
|
// ─── Inner component (rendered after auth) ─────────────────────────────────
|
|
87
87
|
const AgentCheckpointsInner = ({ onLogout, }) => {
|
|
88
88
|
const { runtime, status: runtimeStatus, endpoint: _agentEndpoint, isReady, error: hookError, launchRuntime, connectToRuntime, disconnect, } = useAgentRuntimes({
|
|
89
|
-
agentSpecId:
|
|
89
|
+
agentSpecId: AGENTSPEC_ID,
|
|
90
90
|
autoStart: false,
|
|
91
|
-
agentSpec:
|
|
91
|
+
agentSpec: AGENTSPEC,
|
|
92
92
|
agentConfig: {
|
|
93
93
|
name: DEMO_AGENT_NAME,
|
|
94
94
|
model: 'bedrock:us.anthropic.claude-sonnet-4-5-20250929-v1:0',
|
|
@@ -97,8 +97,8 @@ const AgentCheckpointsInner = ({ onLogout, }) => {
|
|
|
97
97
|
},
|
|
98
98
|
});
|
|
99
99
|
const { pause, resume, terminate, refreshCheckpoints, checkpoints } = useAgentLifecycle({
|
|
100
|
-
agentSpecId:
|
|
101
|
-
agentSpec:
|
|
100
|
+
agentSpecId: AGENTSPEC_ID,
|
|
101
|
+
agentSpec: AGENTSPEC,
|
|
102
102
|
runtime,
|
|
103
103
|
connectToRuntime,
|
|
104
104
|
disconnect,
|
|
@@ -120,7 +120,7 @@ const AgentCheckpointsInner = ({ onLogout, }) => {
|
|
|
120
120
|
const autoConnectAttemptRef = useRef(null);
|
|
121
121
|
const displayError = hookError || actionError;
|
|
122
122
|
const podName = runtime?.podName || '(launching…)';
|
|
123
|
-
const agentId = runtime?.agentId ||
|
|
123
|
+
const agentId = runtime?.agentId || AGENTSPEC_ID;
|
|
124
124
|
const agentBaseUrl = runtime?.agentBaseUrl || '';
|
|
125
125
|
const handleLaunch = useCallback(async () => {
|
|
126
126
|
setIsStarting(true);
|
|
@@ -319,7 +319,7 @@ const AgentCheckpointsInner = ({ onLogout, }) => {
|
|
|
319
319
|
p: 3,
|
|
320
320
|
borderBottom: '1px solid',
|
|
321
321
|
borderColor: 'border.default',
|
|
322
|
-
}, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2, mb: 2 }, children: [_jsx(Text, { sx: { fontSize: '20px' }, children:
|
|
322
|
+
}, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2, mb: 2 }, children: [_jsx(Text, { sx: { fontSize: '20px' }, children: AGENTSPEC.emoji }), _jsx(Heading, { as: "h4", sx: { fontSize: 2, m: 0 }, children: AGENTSPEC.name })] }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted', display: 'block', mb: 3 }, children: AGENTSPEC.description }), _jsx(SpecRow, { icon: AiModelIcon, label: "Model", value: AGENTSPEC.model }), _jsx(SpecRow, { icon: GlobeIcon, label: "Protocol", value: AGENTSPEC.protocol }), _jsx(SpecRow, { icon: ZapIcon, label: "Memory", value: AGENTSPEC.memory }), _jsx(SpecRow, { icon: GraphIcon, label: "Environment", value: AGENTSPEC.environment_name }), _jsx(SpecRow, { icon: ClockIcon, label: "Trigger", value: AGENTSPEC.trigger.description }), _jsx(SpecRow, { icon: TagIcon, label: "Tags", value: AGENTSPEC.tags.join(', ') }), _jsxs(Box, { sx: {
|
|
323
323
|
mt: 2,
|
|
324
324
|
pt: 2,
|
|
325
325
|
borderTop: '1px solid',
|
|
@@ -329,7 +329,7 @@ const AgentCheckpointsInner = ({ onLogout, }) => {
|
|
|
329
329
|
fontSize: 0,
|
|
330
330
|
display: 'block',
|
|
331
331
|
mb: 1,
|
|
332
|
-
}, children: "Advanced" }), _jsx(SpecRow, { label: "Cost limit", value:
|
|
332
|
+
}, children: "Advanced" }), _jsx(SpecRow, { label: "Cost limit", value: AGENTSPEC.advanced.cost_limit }), _jsx(SpecRow, { label: "Time limit", value: AGENTSPEC.advanced.time_limit }), _jsx(SpecRow, { label: "Max iterations", value: String(AGENTSPEC.advanced.max_iterations) }), _jsx(SpecRow, { label: "Checkpoint interval", value: `${AGENTSPEC.advanced.checkpoint_interval}s` }), _jsx(SpecRow, { label: "Temperature", value: String(AGENTSPEC.model_config.temperature) }), _jsx(SpecRow, { label: "Max tokens", value: String(AGENTSPEC.model_config.max_tokens) })] })] }), _jsxs(Box, { sx: {
|
|
333
333
|
order: 2,
|
|
334
334
|
p: 3,
|
|
335
335
|
borderBottom: '1px solid',
|
|
@@ -426,7 +426,7 @@ const AgentCheckpointsInner = ({ onLogout, }) => {
|
|
|
426
426
|
height: '100%',
|
|
427
427
|
gap: 3,
|
|
428
428
|
}, children: [_jsx(Spinner, { size: "large" }), _jsx(Text, { sx: { color: 'fg.muted' }, children: runtimeStatus === 'launching'
|
|
429
|
-
? `Launching runtime for ${
|
|
429
|
+
? `Launching runtime for ${AGENTSPEC_ID}…`
|
|
430
430
|
: 'Creating agent on runtime…' })] })) : showNoAgentRunningView ? (_jsxs(Box, { sx: {
|
|
431
431
|
display: 'flex',
|
|
432
432
|
flexDirection: 'column',
|
|
@@ -435,7 +435,7 @@ const AgentCheckpointsInner = ({ onLogout, }) => {
|
|
|
435
435
|
height: '100%',
|
|
436
436
|
gap: 3,
|
|
437
437
|
px: 3,
|
|
438
|
-
}, children: [_jsx(AgentIcon, { size: 48 }), _jsx(Heading, { as: "h2", sx: { fontSize: 3 }, children: "Checkpoint Agent" }), _jsxs(Text, { sx: { color: 'fg.muted', textAlign: 'center', maxWidth: 560 }, children: ["Launch a cloud agent runtime with pause/resume checkpointing. The agent will be deployed from the", ' ', _jsx("strong", { children:
|
|
438
|
+
}, children: [_jsx(AgentIcon, { size: 48 }), _jsx(Heading, { as: "h2", sx: { fontSize: 3 }, children: "Checkpoint Agent" }), _jsxs(Text, { sx: { color: 'fg.muted', textAlign: 'center', maxWidth: 560 }, children: ["Launch a cloud agent runtime with pause/resume checkpointing. The agent will be deployed from the", ' ', _jsx("strong", { children: AGENTSPEC_ID }), " spec."] }), displayError && (_jsx(Flash, { variant: "danger", sx: { maxWidth: 560, width: '100%' }, children: displayError })), _jsx(Button, { variant: "primary", size: "large", leadingVisual: PlayIcon, onClick: handleLaunch, children: "Launch Agent" })] })) : (isReady || runtimeStatus === 'resumed') &&
|
|
439
439
|
runtimeStatus !== 'paused' ? (_jsx(Chat, { protocol: "vercel-ai", baseUrl: agentBaseUrl, agentId: agentId, title: "Monitor Sales KPI Agent", brandIcon: _jsx(AgentIcon, { size: 16 }), placeholder: "Ask about sales KPIs\u2026", description: "Monitor Sales KPI agent with pause/resume checkpointing", showHeader: false, showTokenUsage: true, autoFocus: true, height: "100%", runtimeId: podName, historyEndpoint: `${agentBaseUrl}/api/v1/history`, suggestions: [
|
|
440
440
|
{
|
|
441
441
|
title: 'KPIs',
|
|
@@ -31,7 +31,7 @@ import { useAgentRuntimes } from '../hooks/useAgentRuntimes';
|
|
|
31
31
|
const queryClient = new QueryClient();
|
|
32
32
|
// ─── Constants ─────────────────────────────────────────────────────────────
|
|
33
33
|
const AGENT_NAME = 'eval-example-agent';
|
|
34
|
-
const
|
|
34
|
+
const AGENTSPEC_ID = 'example-evals';
|
|
35
35
|
const DEFAULT_EXECUTION_TARGET = (import.meta.env.VITE_AGENT_EVALS_TARGET || 'cloud').toLowerCase() === 'local'
|
|
36
36
|
? 'local'
|
|
37
37
|
: 'cloud';
|
|
@@ -93,7 +93,7 @@ const AgentEvalsInner = ({ onLogout, executionTarget, onExecutionTargetChange })
|
|
|
93
93
|
return 'https://r1.datalayer.run';
|
|
94
94
|
}, [configuration?.runtimesRunUrl]);
|
|
95
95
|
const { runtime, status: runtimeStatus, isReady, error: hookError, runtimeCreationBaseUrl, } = useAgentRuntimes({
|
|
96
|
-
agentSpecId:
|
|
96
|
+
agentSpecId: AGENTSPEC_ID,
|
|
97
97
|
autoStart: executionTarget === 'cloud',
|
|
98
98
|
runtimeCreationTarget: executionTarget === 'local' ? 'local-agent-runtimes' : 'backend-services',
|
|
99
99
|
runtimeCreationBaseUrl: executionTarget === 'local' ? localRuntimeBaseUrl : cloudRuntimeBaseUrl,
|
|
@@ -182,7 +182,7 @@ const AgentEvalsInner = ({ onLogout, executionTarget, onExecutionTargetChange })
|
|
|
182
182
|
description: 'Agent with evaluation and quality scoring',
|
|
183
183
|
agent_library: 'pydantic-ai',
|
|
184
184
|
transport: 'vercel-ai',
|
|
185
|
-
agent_spec_id:
|
|
185
|
+
agent_spec_id: AGENTSPEC_ID,
|
|
186
186
|
enable_skills: true,
|
|
187
187
|
tools: [],
|
|
188
188
|
}),
|
|
@@ -26,7 +26,7 @@ import { AuthRequiredView, ErrorView } from './components';
|
|
|
26
26
|
import { ThemedProvider } from './utils/themedProvider';
|
|
27
27
|
import { uniqueAgentId } from './utils/agentId';
|
|
28
28
|
import { parseAgentStreamMessage } from '../types/stream';
|
|
29
|
-
import {
|
|
29
|
+
import { getAgentspecs } from '../specs/agents';
|
|
30
30
|
import { subscribeOtelWs } from '../context/otelWsPool';
|
|
31
31
|
import { toMetricValue } from '../hooks/useMonitoring';
|
|
32
32
|
import { useAIAgentsWebSocket } from '../hooks';
|
|
@@ -35,7 +35,7 @@ import { useSimpleAuthStore } from '@datalayer/core/lib/views/otel';
|
|
|
35
35
|
import { Chat } from '../chat';
|
|
36
36
|
// ─── Constants ─────────────────────────────────────────────────────────────
|
|
37
37
|
const AGENT_NAME = 'guardrails-example-agent';
|
|
38
|
-
const
|
|
38
|
+
const AGENTSPEC_ID = 'example-guardrails';
|
|
39
39
|
const DEFAULT_LOCAL_BASE_URL = import.meta.env.VITE_BASE_URL || 'http://localhost:8765';
|
|
40
40
|
const OTEL_BASE_URL_ENV = import.meta.env.VITE_OTEL_BASE_URL;
|
|
41
41
|
const DATALAYER_RUN_URL_ENV = import.meta.env.DATALAYER_RUN_URL;
|
|
@@ -55,7 +55,7 @@ const toNumberOrNull = (value) => {
|
|
|
55
55
|
return null;
|
|
56
56
|
};
|
|
57
57
|
const resolvePerRunBudgetFromSpec = (agentSpecId) => {
|
|
58
|
-
const spec =
|
|
58
|
+
const spec = getAgentspecs(agentSpecId);
|
|
59
59
|
if (!spec?.guardrails?.length) {
|
|
60
60
|
return null;
|
|
61
61
|
}
|
|
@@ -74,7 +74,7 @@ const resolvePerRunBudgetFromSpec = (agentSpecId) => {
|
|
|
74
74
|
}
|
|
75
75
|
return null;
|
|
76
76
|
};
|
|
77
|
-
const DEFAULT_RUN_BUDGET_USD = resolvePerRunBudgetFromSpec(
|
|
77
|
+
const DEFAULT_RUN_BUDGET_USD = resolvePerRunBudgetFromSpec(AGENTSPEC_ID);
|
|
78
78
|
const toApprovalRequest = (payload) => ({
|
|
79
79
|
id: payload.id,
|
|
80
80
|
tool_name: payload.tool_name,
|
|
@@ -249,7 +249,7 @@ const AgentGuardrailsInner = ({ onLogout, }) => {
|
|
|
249
249
|
description: 'Agent with cost budget and tool approval guardrails',
|
|
250
250
|
agent_library: 'pydantic-ai',
|
|
251
251
|
transport: 'vercel-ai',
|
|
252
|
-
agent_spec_id:
|
|
252
|
+
agent_spec_id: AGENTSPEC_ID,
|
|
253
253
|
enable_skills: true,
|
|
254
254
|
tools: [],
|
|
255
255
|
}),
|
|
@@ -13,7 +13,7 @@ import { useExampleAgentRuntimesUrl } from './utils/useExampleAgentRuntimesUrl';
|
|
|
13
13
|
import { ErrorView } from './components';
|
|
14
14
|
import { Chat } from '../chat';
|
|
15
15
|
setupPrimerPortals();
|
|
16
|
-
const
|
|
16
|
+
const AGENTSPEC_ID = 'example-hooks';
|
|
17
17
|
const AGENT_NAME = 'hooks-example-agent';
|
|
18
18
|
const AgentHooksExample = () => {
|
|
19
19
|
const baseUrl = useExampleAgentRuntimesUrl();
|
|
@@ -30,7 +30,7 @@ const AgentHooksExample = () => {
|
|
|
30
30
|
headers: { 'Content-Type': 'application/json' },
|
|
31
31
|
body: JSON.stringify({
|
|
32
32
|
name,
|
|
33
|
-
agent_spec_id:
|
|
33
|
+
agent_spec_id: AGENTSPEC_ID,
|
|
34
34
|
transport: 'vercel-ai',
|
|
35
35
|
}),
|
|
36
36
|
});
|
|
@@ -79,7 +79,7 @@ const AgentHooksExample = () => {
|
|
|
79
79
|
height: '100vh',
|
|
80
80
|
gap: 3,
|
|
81
81
|
bg: 'canvas.default',
|
|
82
|
-
}, children: [_jsx(Spinner, { size: "large" }), _jsxs(Text, { sx: { color: 'fg.muted' }, children: ["Creating agent from ",
|
|
82
|
+
}, children: [_jsx(Spinner, { size: "large" }), _jsxs(Text, { sx: { color: 'fg.muted' }, children: ["Creating agent from ", AGENTSPEC_ID, "..."] })] }) }));
|
|
83
83
|
}
|
|
84
84
|
if (error || !agentId) {
|
|
85
85
|
return (_jsx(ThemedProvider, { children: _jsx(ErrorView, { error: "Failed to start hooks agent", detail: error || 'No agent ID returned' }) }));
|
|
@@ -12,7 +12,7 @@ import { uniqueAgentId } from './utils/agentId';
|
|
|
12
12
|
import { useSimpleAuthStore } from '@datalayer/core/lib/views/otel';
|
|
13
13
|
import { Chat } from '../chat';
|
|
14
14
|
import { useAIAgentsWebSocket } from '../hooks';
|
|
15
|
-
const
|
|
15
|
+
const AGENTSPEC_ID = 'example-inference';
|
|
16
16
|
const AGENT_NAME = 'inference-provider-example-agent';
|
|
17
17
|
const DEFAULT_LOCAL_BASE_URL = import.meta.env.VITE_BASE_URL || 'http://localhost:8765';
|
|
18
18
|
const queryClient = new QueryClient();
|
|
@@ -114,7 +114,7 @@ const AgentInferenceProviderExampleInner = () => {
|
|
|
114
114
|
body: JSON.stringify({
|
|
115
115
|
name,
|
|
116
116
|
transport: 'vercel-ai',
|
|
117
|
-
agent_spec_id:
|
|
117
|
+
agent_spec_id: AGENTSPEC_ID,
|
|
118
118
|
inferenceProvider: nextProvider,
|
|
119
119
|
}),
|
|
120
120
|
});
|
|
@@ -131,7 +131,7 @@ const AgentInferenceProviderExampleInner = () => {
|
|
|
131
131
|
setAgentId(nextAgentId);
|
|
132
132
|
appendProviderEvent('agent.created', 'Launched local agent runtime', {
|
|
133
133
|
agentId: nextAgentId,
|
|
134
|
-
agentSpecId:
|
|
134
|
+
agentSpecId: AGENTSPEC_ID,
|
|
135
135
|
inferenceProvider: nextProvider,
|
|
136
136
|
baseUrl,
|
|
137
137
|
});
|
|
@@ -225,7 +225,7 @@ const AgentInferenceProviderExampleInner = () => {
|
|
|
225
225
|
alignItems: 'center',
|
|
226
226
|
flexWrap: 'wrap',
|
|
227
227
|
gap: 2,
|
|
228
|
-
}, children: [_jsxs(Box, { children: [_jsx(Heading, { as: "h2", sx: { fontSize: 4, mb: 1 }, children: "Agent Inference Provider Example" }), _jsxs(Text, { sx: { color: 'fg.muted', fontSize: 1 }, children: ["Launches a local agent runtime from ",
|
|
228
|
+
}, children: [_jsxs(Box, { children: [_jsx(Heading, { as: "h2", sx: { fontSize: 4, mb: 1 }, children: "Agent Inference Provider Example" }), _jsxs(Text, { sx: { color: 'fg.muted', fontSize: 1 }, children: ["Launches a local agent runtime from ", AGENTSPEC_ID, " and lets you switch between local and datalayer inference."] })] }), _jsx(ProviderBadge, { provider: provider })] }), _jsxs(SegmentedControl, { "aria-label": "Inference provider", fullWidth: true, children: [_jsx(SegmentedControl.Button, { selected: provider === 'local', onClick: () => onProviderChange('local'), children: "local" }), _jsx(SegmentedControl.Button, { selected: provider === 'datalayer', onClick: () => onProviderChange('datalayer'), children: "datalayer" })] }), _jsxs(Box, { sx: {
|
|
229
229
|
display: 'flex',
|
|
230
230
|
gap: 2,
|
|
231
231
|
alignItems: 'center',
|
|
@@ -248,7 +248,7 @@ const AgentInferenceProviderExampleInner = () => {
|
|
|
248
248
|
borderRadius: 2,
|
|
249
249
|
overflow: 'hidden',
|
|
250
250
|
bg: 'canvas.default',
|
|
251
|
-
}, children: agentId && !isLaunching ? (_jsx(Chat, { protocol: "vercel-ai", baseUrl: baseUrl, agentId: agentId, authToken: token ?? undefined, title: "Agent Inference Provider Example", subtitle: `Spec: ${
|
|
251
|
+
}, children: agentId && !isLaunching ? (_jsx(Chat, { protocol: "vercel-ai", baseUrl: baseUrl, agentId: agentId, authToken: token ?? undefined, title: "Agent Inference Provider Example", subtitle: `Spec: ${AGENTSPEC_ID}`, placeholder: "Ask the inference provider something...", showHeader: true, showNewChatButton: true, showClearButton: false, showModelSelector: true, showToolsMenu: true, showSkillsMenu: true, showTokenUsage: true, autoFocus: true, height: "100%", runtimeId: agentId, historyEndpoint: `${baseUrl}/api/v1/history`, onMessageSent: content => {
|
|
252
252
|
appendProviderEvent('provider.request', `Sent message via ${provider}`, {
|
|
253
253
|
provider,
|
|
254
254
|
agentId,
|
|
@@ -21,7 +21,7 @@ import { MCP_SERVER_LIBRARY } from '../specs/mcpServers';
|
|
|
21
21
|
const queryClient = new QueryClient();
|
|
22
22
|
const AGENT_NAME = 'mcp-example-agent';
|
|
23
23
|
// Must match agentspecs/agentspecs/agents/example-mcp.yaml `id`.
|
|
24
|
-
const
|
|
24
|
+
const AGENTSPEC_ID = 'example-mcp';
|
|
25
25
|
const DEFAULT_LOCAL_BASE_URL = import.meta.env.VITE_BASE_URL || 'http://localhost:8765';
|
|
26
26
|
/* ── Aggregate MCP status helpers ─────────────────────── */
|
|
27
27
|
function deriveAggregate(servers) {
|
|
@@ -153,7 +153,7 @@ const AgentMCPInner = ({ onLogout }) => {
|
|
|
153
153
|
description: 'MCP example agent – web crawling and research via Tavily',
|
|
154
154
|
agent_library: 'pydantic-ai',
|
|
155
155
|
transport: 'vercel-ai',
|
|
156
|
-
agent_spec_id:
|
|
156
|
+
agent_spec_id: AGENTSPEC_ID,
|
|
157
157
|
enable_codemode: false,
|
|
158
158
|
enable_skills: true,
|
|
159
159
|
tools: [],
|
|
@@ -28,7 +28,7 @@ import { Chat } from '../chat';
|
|
|
28
28
|
import { useExampleAgentRuntimesUrl } from './utils/useExampleAgentRuntimesUrl';
|
|
29
29
|
// ─── Constants ─────────────────────────────────────────────────────────────
|
|
30
30
|
const AGENT_NAME = 'memory-example-agent';
|
|
31
|
-
const
|
|
31
|
+
const AGENTSPEC_ID = 'example-memory';
|
|
32
32
|
// ─── Inner component (rendered after auth) ─────────────────────────────────
|
|
33
33
|
const AgentMemoryInner = ({ onLogout }) => {
|
|
34
34
|
const { token } = useSimpleAuthStore();
|
|
@@ -66,7 +66,7 @@ const AgentMemoryInner = ({ onLogout }) => {
|
|
|
66
66
|
description: 'Agent with Mem0 persistent memory',
|
|
67
67
|
agent_library: 'pydantic-ai',
|
|
68
68
|
transport: 'vercel-ai',
|
|
69
|
-
agent_spec_id:
|
|
69
|
+
agent_spec_id: AGENTSPEC_ID,
|
|
70
70
|
enable_skills: true,
|
|
71
71
|
tools: [],
|
|
72
72
|
}),
|
|
@@ -35,7 +35,7 @@ const queryClient = new QueryClient();
|
|
|
35
35
|
import { useSimpleAuthStore } from '@datalayer/core/lib/views/otel';
|
|
36
36
|
import { Chat } from '../chat';
|
|
37
37
|
const AGENT_NAME = 'monitoring-example-agent';
|
|
38
|
-
const
|
|
38
|
+
const AGENTSPEC_ID = 'example-monitoring';
|
|
39
39
|
const DEFAULT_LOCAL_BASE_URL = import.meta.env.VITE_BASE_URL || 'http://localhost:8765';
|
|
40
40
|
const OTEL_BASE_URL_ENV = import.meta.env.VITE_OTEL_BASE_URL;
|
|
41
41
|
const DATALAYER_RUN_URL_ENV = import.meta.env.DATALAYER_RUN_URL;
|
|
@@ -90,7 +90,7 @@ const AgentMonitoringInner = ({ onLogout, }) => {
|
|
|
90
90
|
description: 'MCP monitoring example – web crawling via Tavily with live cost/token metrics',
|
|
91
91
|
agent_library: 'pydantic-ai',
|
|
92
92
|
transport: 'vercel-ai',
|
|
93
|
-
agent_spec_id:
|
|
93
|
+
agent_spec_id: AGENTSPEC_ID,
|
|
94
94
|
enable_skills: true,
|
|
95
95
|
tools: [],
|
|
96
96
|
}),
|
|
@@ -28,7 +28,7 @@ import { Chat } from '../chat';
|
|
|
28
28
|
const queryClient = new QueryClient();
|
|
29
29
|
// ─── Constants ─────────────────────────────────────────────────────────────
|
|
30
30
|
const AGENT_NAME = 'notification-example-agent';
|
|
31
|
-
const
|
|
31
|
+
const AGENTSPEC_ID = 'example-notifications';
|
|
32
32
|
const alertVariant = (severity) => {
|
|
33
33
|
if (severity === 'critical')
|
|
34
34
|
return 'danger';
|
|
@@ -78,7 +78,7 @@ const AgentNotificationsInner = ({ onLogout, }) => {
|
|
|
78
78
|
description: 'Agent with multi-channel notification support',
|
|
79
79
|
agent_library: 'pydantic-ai',
|
|
80
80
|
transport: 'vercel-ai',
|
|
81
|
-
agent_spec_id:
|
|
81
|
+
agent_spec_id: AGENTSPEC_ID,
|
|
82
82
|
enable_skills: true,
|
|
83
83
|
tools: [],
|
|
84
84
|
}),
|
|
@@ -43,7 +43,7 @@ const AGENT_BASE_URL_ENV = import.meta.env.VITE_BASE_URL || '';
|
|
|
43
43
|
const DEFAULT_AGENT_PROTOCOL = 'vercel-ai';
|
|
44
44
|
const DEFAULT_AGENT_LIBRARY = 'pydantic-ai';
|
|
45
45
|
/** Spec id this example always launches. */
|
|
46
|
-
const
|
|
46
|
+
const AGENTSPEC_ID = 'example-otel';
|
|
47
47
|
/**
|
|
48
48
|
* Small form for picking an agent spec and launching it.
|
|
49
49
|
* Renders as the `children` of the ChatSidebar so it appears above the chat.
|
|
@@ -61,11 +61,11 @@ const AgentLaunchPanel = ({ baseUrl, onConnected, onDisconnected, isConnected, c
|
|
|
61
61
|
method: 'POST',
|
|
62
62
|
headers: { 'Content-Type': 'application/json' },
|
|
63
63
|
body: JSON.stringify({
|
|
64
|
-
name:
|
|
64
|
+
name: AGENTSPEC_ID,
|
|
65
65
|
description: `Launched from AgentOtelExample`,
|
|
66
66
|
agent_library: DEFAULT_AGENT_LIBRARY,
|
|
67
67
|
transport,
|
|
68
|
-
agent_spec_id:
|
|
68
|
+
agent_spec_id: AGENTSPEC_ID,
|
|
69
69
|
}),
|
|
70
70
|
});
|
|
71
71
|
if (!res.ok) {
|
|
@@ -74,7 +74,7 @@ const AgentLaunchPanel = ({ baseUrl, onConnected, onDisconnected, isConnected, c
|
|
|
74
74
|
// Reuse existing agent when backend reports duplicate creation.
|
|
75
75
|
if (res.status === 409 || /already exists/i.test(detail)) {
|
|
76
76
|
const idMatch = detail.match(/Agent with ID '([^']+)' already exists/i);
|
|
77
|
-
const existingId = idMatch?.[1] ||
|
|
77
|
+
const existingId = idMatch?.[1] || AGENTSPEC_ID;
|
|
78
78
|
onConnected(existingId, transport);
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
@@ -121,7 +121,7 @@ const AgentLaunchPanel = ({ baseUrl, onConnected, onDisconnected, isConnected, c
|
|
|
121
121
|
gap: 2,
|
|
122
122
|
flexShrink: 0,
|
|
123
123
|
bg: 'canvas.subtle',
|
|
124
|
-
}, children: [_jsx(Text, { sx: { fontSize: 0, fontWeight: 'bold', color: 'fg.muted' }, children: "AGENT" }), loading ? (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Spinner, { size: "small" }), _jsxs(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: ["Launching ",
|
|
124
|
+
}, children: [_jsx(Text, { sx: { fontSize: 0, fontWeight: 'bold', color: 'fg.muted' }, children: "AGENT" }), loading ? (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Spinner, { size: "small" }), _jsxs(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: ["Launching ", AGENTSPEC_ID, "\u2026"] })] })) : error ? (_jsxs(_Fragment, { children: [_jsx(Text, { sx: { fontSize: 1, color: 'danger.fg' }, children: error }), _jsx(Button, { variant: "primary", size: "small", onClick: handleLaunch, leadingVisual: PlugIcon, sx: { width: '100%' }, children: "Retry" })] })) : (_jsxs(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: ["Launching ", AGENTSPEC_ID, "\u2026"] }))] }));
|
|
125
125
|
};
|
|
126
126
|
const TAB_SX = (active) => ({
|
|
127
127
|
px: 3,
|
|
@@ -34,7 +34,7 @@ import { useChatStore } from '../stores/chatStore';
|
|
|
34
34
|
const queryClient = new QueryClient();
|
|
35
35
|
// ─── Constants ─────────────────────────────────────────────────────────────
|
|
36
36
|
const AGENT_NAME = 'outputs-example-agent';
|
|
37
|
-
const
|
|
37
|
+
const AGENTSPEC_ID = 'demo-outputs';
|
|
38
38
|
const DEFAULT_LOCAL_BASE_URL = import.meta.env.VITE_BASE_URL || 'http://localhost:8765';
|
|
39
39
|
// ─── Output detection ──────────────────────────────────────────────────────
|
|
40
40
|
const FENCE_RE = /```([a-zA-Z0-9_+-]*)\n([\s\S]*?)```/g;
|
|
@@ -306,7 +306,7 @@ const AgentOutputsInner = ({ onLogout, }) => {
|
|
|
306
306
|
description: 'Agent with rich output rendering (table/JSON/chart/file)',
|
|
307
307
|
agent_library: 'pydantic-ai',
|
|
308
308
|
transport: 'vercel-ai',
|
|
309
|
-
agent_spec_id:
|
|
309
|
+
agent_spec_id: AGENTSPEC_ID,
|
|
310
310
|
enable_skills: true,
|
|
311
311
|
tools: [],
|
|
312
312
|
}),
|
|
@@ -15,7 +15,7 @@ import { useExampleAgentRuntimesUrl } from './utils/useExampleAgentRuntimesUrl';
|
|
|
15
15
|
import { ErrorView } from './components';
|
|
16
16
|
import { Chat } from '../chat';
|
|
17
17
|
setupPrimerPortals();
|
|
18
|
-
const
|
|
18
|
+
const AGENTSPEC_ID = 'example-parameters';
|
|
19
19
|
const AGENT_NAME = 'parameters-demo';
|
|
20
20
|
function isRecord(value) {
|
|
21
21
|
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
@@ -123,7 +123,7 @@ const AgentParametersExample = () => {
|
|
|
123
123
|
setIsSchemaLoading(true);
|
|
124
124
|
setError(null);
|
|
125
125
|
try {
|
|
126
|
-
const response = await fetch(`${baseUrl}/api/v1/agents/library/${
|
|
126
|
+
const response = await fetch(`${baseUrl}/api/v1/agents/library/${AGENTSPEC_ID}`);
|
|
127
127
|
if (!response.ok) {
|
|
128
128
|
throw new Error(`Failed to load schema: ${response.status}`);
|
|
129
129
|
}
|
|
@@ -154,7 +154,7 @@ const AgentParametersExample = () => {
|
|
|
154
154
|
headers: { 'Content-Type': 'application/json' },
|
|
155
155
|
body: JSON.stringify({
|
|
156
156
|
name,
|
|
157
|
-
agent_spec_id:
|
|
157
|
+
agent_spec_id: AGENTSPEC_ID,
|
|
158
158
|
transport: 'vercel-ai',
|
|
159
159
|
agent_parameters: formData,
|
|
160
160
|
}),
|
|
@@ -206,7 +206,7 @@ const AgentParametersExample = () => {
|
|
|
206
206
|
alignItems: 'center',
|
|
207
207
|
gap: 2,
|
|
208
208
|
flexWrap: 'wrap',
|
|
209
|
-
}, children: [_jsxs(Label, { variant: "accent", children: ["Spec: ",
|
|
209
|
+
}, children: [_jsxs(Label, { variant: "accent", children: ["Spec: ", AGENTSPEC_ID] }), _jsx(Label, { variant: "secondary", children: "Transport: vercel-ai" })] }), _jsxs(Box, { sx: { display: 'flex', gap: 2, flexWrap: 'wrap' }, children: [_jsx(Button, { variant: "primary", size: "small", type: "button", onClick: loadSchemaForm, disabled: isSchemaLoading, children: isSchemaLoading ? (_jsxs(_Fragment, { children: [_jsx(Spinner, { size: "small" }), " Loading Schema..."] })) : ('Show Parameter Form') }), schema && (_jsx(Button, { variant: "invisible", size: "small", type: "button", onClick: () => {
|
|
210
210
|
setShowSchemaForm(v => !v);
|
|
211
211
|
}, children: showSchemaForm ? 'Hide Form' : 'Show Form' }))] }), schema && (_jsxs(Box, { sx: {
|
|
212
212
|
display: 'flex',
|