ask
Overnight agent that asks for approval
Problem
You kick off a long-running agent before bed — a migration, a large refactor, a batch job. The agent finishes at 2 AM and needs your go/no-go before pushing to production. You want to approve from your phone in the morning, not dig through a terminal transcript.
The MCP call
# After the migration finishes successfully
handle = ask_user(
question='Migration finished cleanly. Deploy to production?',
kind='bool',
context_md=(
f'Migration ran in {elapsed}. {rows} rows touched. 0 errors.'
f'\n\nStaging: {staging_url}'
),
notify='push',
ttl_minutes=480, # 8-hour window — expires before next work day
)
print(f'Decision URL: {handle["web_url"]}')
# Agent blocks here (or you can hang up and poll on next run)
decision = await_decision(handle['decision_id'], timeout_s=28800)
if decision['outcome'] == 'yes':
deploy_to_production()
else:
rollback(remark=decision.get('remark', ''))
What you get back
The agent gets back an AskHandle immediately. While it waits, you receive a push notification. You open the link on your phone, see the context Markdown, and tap Yes or No. The await_decision call unblocks with outcome='yes' or outcome='no' plus any remark you added.
Follow-up calls
If you include attachments=[{'share_id': migration_log_share_id}], the decision page will show a link to the full migration log inline.
Notes
Push notifications require web push permissions granted in your browser on first visit. On a phone you can add pail.thalos.ai to your home screen for a native-app feel.