From f458e19301ba50d6a7b68309869e95c3cd6d9ee4 Mon Sep 17 00:00:00 2001 From: Jon Saad-Falcon <41205309+jonsaadfalcon@users.noreply.github.com> Date: Sat, 14 Mar 2026 16:26:07 -0700 Subject: [PATCH] feat: instruction + model in agent wizard, error toasts, auto-run interval agents --- frontend/src/pages/AgentsPage.tsx | 99 ++++++++++++++++++++++++++++++- 1 file changed, 97 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/AgentsPage.tsx b/frontend/src/pages/AgentsPage.tsx index f8b941a2..5f0183be 100644 --- a/frontend/src/pages/AgentsPage.tsx +++ b/frontend/src/pages/AgentsPage.tsx @@ -17,6 +17,7 @@ import { fetchLearningLog, triggerLearning, fetchAgentTraces, + fetchManagedAgent, } from '../lib/api'; import type { AgentTask, ChannelBinding, AgentTemplate, AgentMessage, ManagedAgent, LearningLogEntry, AgentTrace } from '../lib/api'; import { @@ -132,9 +133,11 @@ const AVAILABLE_TOOLS = [ ]; interface WizardState { - step: 1 | 2 | 3; + step: number; templateId: string; name: string; + instruction: string; + model: string; scheduleType: string; scheduleValue: string; selectedTools: string[]; @@ -155,6 +158,8 @@ function LaunchWizard({ step: 1, templateId: '', name: '', + instruction: '', + model: '', scheduleType: 'manual', scheduleValue: '', selectedTools: [], @@ -183,6 +188,10 @@ function LaunchWizard({ } async function handleLaunch() { + if ((wizard.scheduleType === 'cron' || wizard.scheduleType === 'interval') && !wizard.instruction.trim()) { + toast.error('Instruction is required for scheduled agents'); + return; + } if (!wizard.name.trim()) { toast.error('Agent name is required'); return; @@ -196,12 +205,18 @@ function LaunchWizard({ learning_enabled: wizard.learningEnabled, }; if (wizard.budget) config.budget = parseFloat(wizard.budget); - await createManagedAgent({ + if (wizard.instruction.trim()) config.instruction = wizard.instruction.trim(); + if (wizard.model) config.model = wizard.model; + const created = await createManagedAgent({ name: wizard.name, template_id: wizard.templateId || undefined, config, }); toast.success(`Agent "${wizard.name}" launched`); + // Auto-run first tick for interval agents + if (wizard.scheduleType === 'interval' && created.id) { + runManagedAgent(created.id).catch(() => {}); + } onLaunched(); } catch (err) { toast.error('Could not create agent', { @@ -327,6 +342,51 @@ function LaunchWizard({ /> + {/* Instruction */} +
+
+ What should this agent do? + {(wizard.scheduleType === 'cron' || wizard.scheduleType === 'interval') && ( + * + )} +
+