Tasks
Projects
Agentic Tasks
No tasks yet
Agent Management
Project Overview
async function listAgenticTasks() { try { const headers = await getAuthHeaders(); const res = await fetch('/api/agents/agentic-task', { headers }); if (!res.ok) throw new Error('Load failed'); const data = await res.json(); const tasks = data.tasks || []; const el = document.getElementById('agenticTasksList'); if (!el) return; if (tasks.length === 0) { el.textContent = 'No tasks yet'; return; } el.innerHTML = tasks.map(t => `
${(t.end_goal||'').replace(/
status: ${t.status}
`).join(''); } catch (e) { const el = document.getElementById('agenticTasksList'); if (el) el.textContent = 'Failed to load tasks'; } } async function newAgenticTask() { const endGoal = prompt('What do you want to achieve?'); if (!endGoal) return; const timeConstraint = prompt('Time (e.g., 4h). Leave blank for default.', '4h') || ''; const moneyConstraint = prompt('Budget (e.g., $100). Leave blank for default.', '$100') || ''; try { const headers = await getAuthHeaders(); const res = await fetch('/api/agents/agentic-task', { method: 'POST', headers, body: JSON.stringify({ endGoal, stepsIdentified: false, stepsDescription: '', timeConstraint, moneyConstraint, agentsRequested: 1, pmAgentRequested: true }) }); if (!res.ok) throw new Error('Create failed'); const data = await res.json(); await listAgenticTasks(); if (data?.task?.id) { if (confirm('Task created. Run it now?')) { await executeAgenticTask(data.task.id); } } } catch (e) { alert('Failed to create agentic task. Please sign in and try again.'); } } async function executeAgenticTask(taskId) { try { const headers = await getAuthHeaders(); const res = await fetch(`/api/agents/agentic-task/${taskId}/execute`, { method: 'POST', headers }); if (!res.ok) throw new Error('Execute failed'); alert('Execution started/completed. Refreshing list.'); await listAgenticTasks(); } catch (e) { alert('Failed to execute agentic task. Ensure you are signed in.'); } }