Smart Agent Teams

Recipes

Short, tested scripts for jobs people automate with the sat CLI.

Every recipe uses --json and jq, and relies on the stable exit codes.

Approve every pending hire with a note

sat approvals list --json \
  | jq -r '.[] | select(.type == "hire_agent") | .id' \
  | while read -r id; do sat approvals approve "$id" --note "Approved by script"; done

Morning report of what needs you

sat inbox --since 24
sat costs | head -5

sat inbox --json returns {approvals, blocked_tasks, failed_runs} if you want to send it to chat instead.

Create tasks from a file

tasks.txt
Write the onboarding email
Add CSV export to reports
while read -r title; do
  sat tasks create "$title" --assignee Toni --priority medium --project "Marketing site"
done < tasks.txt

Assigning a task to an available agent queues a run for it straight away.

Move everything an agent left in review to done

sat tasks list --assignee Grace --status in_review --json \
  | jq -r '.[].key' \
  | xargs -I{} sat tasks move {} done

React to live events

sat events --types 'run.updated' | while read -r line; do
  status=$(jq -r '.status' <<<"$line")
  [ "$status" = "failed" ] && echo "Run $(jq -r '.id' <<<"$line") failed"
done

Events are invalidations: fetch the object (sat runs show <id> --json) for the details.

Drain the queue from cron or CI

crontab
*/10 * * * * SAT_PROFILE=prod SAT_API_KEY=sat_live_... /usr/local/bin/sat runner start --once >> /var/log/sat-runner.log 2>&1

--once executes what is queued and exits; the exit code is 1 if any run failed. For continuous work, run sat runner start as a service instead; see sat runner.

Fail a CI job if spend is over 80% of budget

sat --json costs | jq -e '.budget_cents == 0 or (.total_cents / .budget_cents) < 0.8' > /dev/null \
  || { echo "Spend is over 80% of the monthly budget"; exit 1; }

On this page