Docs / integrations / useAutomations

useAutomations

hooknot for built apps

Schedule agent prompts on a cron schedule (via AWS EventBridge) with silent, email, webhook, or file delivery.

import { useAutomations } from 'flowstack-sdk'

Schedule agent prompts on a cron schedule via AWS EventBridge. Results can be delivered silently (stored only), by email, webhook, or as a downloadable file.

Schedule format: 5-field Unix cron "minute hour dom month dow".

Output config options:

| type | Delivers via | Extra fields | |---|---|---| | "silent" | Stored only (default) | — | | "email" | Email | to, subject_template, format | | "webhook" | HTTP POST | url, headers, format | | "file" | Downloadable URL in output_url | format ("csv" \| "json" \| "pdf") |

Signature

const { automations, isLoading, error, create, update, remove, pause, resume, runNow, getRuns, refresh } = useAutomations()

Returns

FieldTypeDescription
automationsAutomation[]Scheduled automations, e.g. [{automation_id, name, schedule, status, last_run_at, run_count, ...}].
isLoadingbooleanRequest in flight.
errorstring | nullLast error message.
create(input) => Promise<Automation | null>Create a scheduled automation (name, prompt, schedule, timezone, target_agents, output_config).
update(id, input) => Promise<boolean>Update an automation.
remove(id) => Promise<boolean>Delete an automation.
pause(id) => Promise<boolean>Pause a schedule.
resume(id) => Promise<boolean>Resume a paused schedule.
runNow(id) => Promise<{ invoked: boolean } | null>Run once immediately, ignoring the schedule.
getRuns(id, limit?) => Promise<AutomationRun[]>Fetch recent run results, e.g. [{run_id, status, started_at, duration_ms, credits_used, output_summary, output_url}].
refresh() => Promise<void>Re-fetch the automations list.

Examples

Schedule a daily digest and manage runs
import { useAutomations } from 'flowstack-sdk';

const { automations, create, pause, resume, runNow, getRuns } = useAutomations();

// Daily sales digest — weekdays at 9 AM Eastern
await create({
  name: 'Daily sales digest',
  prompt: "Pull yesterday's orders from Shopify, summarize revenue by product and region, flag any anomalies.",
  schedule: '0 9 * * 1-5',
  timezone: 'America/New_York',
  target_agents: ['shopify_analyst'],   // routes to a specific agent persona; omit for default
  output_config: {
    type: 'email',
    to: 'team@company.com',
    subject_template: 'Sales digest — {date}',
  },
});

// Run once right now (ignores schedule)
await runNow(automationId);

// Pause / resume
await pause(automationId);
await resume(automationId);

// Get last 10 run results
const runs = await getRuns(automationId, 10);
// [{run_id, status, started_at, duration_ms, credits_used, output_summary, output_url}]
NoteSchedule format is 5-field Unix cron "minute hour dom month dow". Set target_agents to route to a specific agent persona; omit it for the default agent.

See also

useIntegrations · useConnections · useAgent

Source: README.md#useautomations · Also available in llms-full.txt and registry.json.