{% extends "dashboard/base.html" %} {% from "partials/_macros.html" import status_pill, relative_time, pill, empty_state, info_toggle, stat_card %} {% block page %} {% call info_toggle(key='autopilots', title="What is an autopilot?") %}

An autopilot turns a recurring-task definition into self-driving work. It can fire on a cron schedule or from an authenticated webhook, and every fire is recorded as a run so you have an audit trail.

A definition can route its output to a @pod — the fired task lands pod-tagged and the leader delegates. Toggle a schedule off to pause without losing it.

{% endcall %}
{{ stat_card('Schedules', tasks|length, icon_name='refresh-cw') }} {{ stat_card('Webhooks', webhooks|length, icon_name='plug-zap') }} {{ stat_card('Recent runs', runs|length, icon_name='activity') }}
{# Schedules #}

{{ icon('refresh-cw') }} Schedules

{% if tasks %}
{% for t in tasks %}
{{ t.name }} {% if t.enabled %}{{ status_pill('active') }}{% else %}{{ status_pill('archived') }}{% endif %}
{{ t.title_template }}
{{ icon('refresh-cw') }} {{ t.cron_expr or 'manual' }} {% if t.pod %}{{ icon('users') }} @{{ t.pod }}{% endif %} {% if t.spawn_tool %}{{ icon('zap') }} {{ t.spawn_tool }}{% endif %} {% set rc = run_counts.get(t.name) %} {% if rc %}{{ icon('activity') }} {{ rc }} run{{ 's' if rc != 1 else '' }}{% endif %}
Last fired {{ relative_time(t.last_fired_at) }}
{% endfor %}
{% else %} {{ empty_state('No schedules yet', body='Register a cron task with the create_recurring_task MCP tool (or `brains-ai schedule_task`).', icon_name='refresh-cw') }} {% endif %}
{# Webhooks #}

{{ icon('plug-zap') }} Webhook triggers

{% if webhooks %}
{% for w in webhooks %} {% endfor %}
EndpointFiresEvent filterState
{{ icon('plug-zap') }} /hooks/{{ w.slug }} {{ w.definition_name }} {% if w.event_filter %}{{ w.event_filter }}{% else %}all events{% endif %} {% if w.enabled %}{{ status_pill('active') }}{% else %}{{ status_pill('archived') }}{% endif %}
{% else %} {{ empty_state('No webhook triggers', body='Create one with the create_webhook_trigger MCP tool. External systems then POST to /hooks/ with the returned bearer token to fire a task.', icon_name='plug-zap') }} {% endif %}
{# Run activity #}

{{ icon('activity') }} Recent runs

{% if runs %}
{% for r in runs %} {% endfor %}
WhenDefinitionSourceStatusTask
{{ relative_time(r.created_at) }} {{ r.definition_name }} {% if r.source == 'webhook' %}{{ pill('webhook', tone='info', icon_name='plug-zap') }} {% elif r.source == 'schedule' %}{{ pill('schedule', tone='accent', icon_name='refresh-cw') }} {% else %}{{ pill('manual', tone='neutral') }}{% endif %} {% if r.status == 'created' %}{{ pill('created', tone='success', dot=True) }} {% elif r.status == 'failed' %}{{ pill('failed', tone='danger', dot=True) }} {% else %}{{ pill(r.status, tone='neutral', dot=True) }}{% endif %} {% if r.task_code %}{{ r.task_code }}{% else %}{% endif %}
{% else %} {{ empty_state('No runs recorded yet', body='Runs appear here the first time a schedule or webhook fires.', icon_name='activity') }} {% endif %}
{% endblock %}