{% extends "base.html" %} {% from "macros.html" import empty_state %} {% block title %}Tasks - Agent Wasp{% endblock %} {% block content %} {# ── Header ──────────────────────────────────────────────────────────────── #}

Scheduled Tasks

Periodic agent instructions that run automatically

{# Total #}
Tasks
{{ stats.total }}
{# Active #}
Active
{{ stats.active }}
{# Paused — hidden when 0 #}
Paused
{{ stats.paused }}
{# Failed — hidden when 0 #}
Failed
{{ stats.failed }}
{# ── Task List ────────────────────────────────────────────────────────────── #} {% if not tasks %} {{ empty_state("No scheduled tasks", "Create tasks to have the agent execute instructions periodically and send you results via Telegram.", "M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z") }} {% else %}
{% for task in tasks %}
{# Top row: dot + info + destinations #}
{% if not task.enabled %} {% elif task.last_success is false %} {% else %} {% endif %}

{{ task.name }}

{# Status pill #} {% if not task.enabled %} PAUSED {% elif task.last_success is none %} NEW {% elif task.last_success %} OK {% else %} ERROR {% endif %}

{{ task.instruction }}

{# Destination icons + interval chip — top-right #}
{# Interval chip #}
every {{ task.interval_fmt }}
{# Destinations #} {% if task.destinations %}
{% for dest in task.destinations %} {% if dest == 'telegram' %} {% elif dest == 'email' %} {% elif dest == 'slack' %} {% endif %} {% endfor %}
{% endif %}
{# Stats row #}
{{ task.run_count }} run{{ 's' if task.run_count != 1 }} {% if task.failure_count %} · {{ task.failure_count }} error{{ 's' if task.failure_count != 1 }} {% endif %} {% if task.last_run %} · last {% else %} · never run {% endif %} {% if task.next_run %} · next {% endif %}
{# Action buttons #}
{# Last result collapsible #} {% if task.last_result and task.last_result not in ('', 'Triggered') %}
Last result
{{ task.last_result[:600] }}{% if task.last_result|length > 600 %}…{% endif %}
{% else %} {# placeholder so JS can find it if result arrives after initial load #} {% endif %}
{% endfor %}
{# Embed task data for edit modal #} {% endif %} {# ── Delete Modal ─────────────────────────────────────────────────────────── #} {# ── Edit Modal ───────────────────────────────────────────────────────────── #} {# ── Create Modal ─────────────────────────────────────────────────────────── #} {% endblock %} {% block extra_scripts %} {% endblock %}