Skip to main content
Back to Blog
Use Case6 min read

Running AI Agents Overnight: Remote Monitoring for Long Sessions

Some tasks are too large for a supervised session. Migrating a database schema, refactoring a legacy module, or generating a test suite for an untested codebase can take hours. Developers who run these tasks overnight need a way to monitor progress, approve permissions, and control costs without sitting at their terminal.

Setting Up an Overnight Session

The preparation matters more than the monitoring. Before stepping away from a long-running agent session:

  1. Set budget limits. A runaway session at 3 AM with no budget cap will keep spending until the API provider's own limits kick in. Set a hard stop at your maximum acceptable cost for the task.
  2. Configure auto-approvals carefully. Allow the operations the agent needs (read, write project files, run tests) and block everything else. This reduces the chance the agent blocks on a permission request at 4 AM.
  3. Enable push notifications. Errors, permission requests, and budget alerts should wake your phone if necessary.
# Example overnight setup
styrby budget set --period session --limit 40 \
  --notify-at 60 --slowdown-at 80 --stop-at 100

styrby config auto-approve "Read *"
styrby config auto-approve "Write src/*"
styrby config auto-approve "Bash(npm run test)"
styrby config auto-approve "Bash(npm run build)"
styrby config require-approval "Bash(npm install *)"
styrby config require-approval "Bash(rm *)"

styrby connect --agent claude --model sonnet-4 \
  --project db-migration

Monitoring from Your Phone

Once the session is running, the Styrby mobile app shows:

  • Live status. Is the agent running, waiting for approval, or idle?
  • Current cost. Running total with trend projection.
  • Recent activity. The last few exchanges, encrypted and decrypted on your phone.
  • Error count. How many errors have occurred and their classifications.

You do not need to watch the app continuously. Push notifications surface anything that needs your attention.

Handling Permission Requests Overnight

Even with careful auto-approval configuration, agents sometimes request unexpected permissions. When a permission request arrives as a push notification:

  • Tap the notification to see the full request, including the exact command and risk classification.
  • Approve if the operation is safe. Deny if it is not.
  • If you are unsure, deny it. The agent will either find an alternative approach or report that it could not complete the task. Better to have the agent stuck than to approve a destructive command while half asleep.

Budget Alerts as Safety Nets

Budget alerts are most valuable during unattended sessions. The graduated alert system works as follows:

  1. At 60% of the session budget, you get a notification. No action needed. The session is progressing within expectations.
  2. At 80%, the agent slows down. This gives you time to check whether the session is making progress or stuck in a loop.
  3. At 100%, the session pauses. You must explicitly approve additional spending. If you are asleep, the session simply waits until morning.

The cost of a paused session is zero. An agent that stops at $40 and waits for your approval in the morning is better than an agent that spends $120 on retries overnight.

Morning Review

When you return to your workstation, the Styrby dashboard gives you a session summary:

  • Total cost and token breakdown
  • Number of turns and average cost per turn
  • Errors encountered and their classifications
  • Permission requests and your responses
  • Whether the agent completed the task or stopped early

Session replay lets you review the full conversation. For a long session, you do not need to read every exchange. Focus on the errors and the final output. If the agent completed the migration successfully and all tests pass, the intermediate steps are less important.

Practical Tips for Overnight Sessions

  • Use Sonnet-class models for overnight work. They are cheaper, and overnight sessions tend to be repetitive tasks where the cheaper model performs comparably.
  • Set the budget at 2x your estimate, not 10x. If you think the task should cost $15, set the limit at $30. This gives the agent room for retries without allowing unlimited spend.
  • Keep the blocked tools list strict. Overnight is not the time to discover that the agent wants to run rm -rf.
  • Test the task during the day first. Run 10 minutes of the task supervised, verify the agent is on the right track, then let it continue overnight.

Ready to manage your AI agents from one place?

Styrby gives you cost tracking, remote permissions, and session replay across five agents.