Back to website
Mayank Aggarwal Learning Center

Phase 07 · AI-Assisted Engineering with Claude CodeLesson 4 of 4

Running Claude Code on the Cloud

Keep an agent working around the clock on a remote machine.

  • 1:10:53 video
  • 2 min read
  • Intermediate
  • Deep dive
01

The problem

Running a coding agent on your laptop works well for interactive sessions. But some jobs are long (migrating a large codebase, processing hundreds of files, running overnight tasks), and some should run on a schedule. Running the agent on a cloud machine lets that work continue even when your laptop is closed.

02

The concept

Deep dive: 1h 11m video. You don’t need it all in one sitting. Use the chapter list under the video to jump straight to the part you need.

Jump to a chapter 21 chapters
  1. 0:00:00Intro: Run Claude Code 24/7 Like a Hired Intern
  2. 0:01:12The Problem: Why Claude Code Keeps Dying
  3. 0:05:05Laptop vs Cloud: The Core Difference
  4. 0:06:20VPS Setup: Hostinger Walkthrough + 20% Discount
  5. 0:10:34Authorizing & Launching Claude Code on VPS
  6. 0:15:09Remote Control: Access Claude from Any Device
  7. 0:17:02Live Demo: Giving Claude Tasks from Your Phone
  8. 0:20:33Token Monitoring: Claude Monitor & Agent Flow Dashboard
  9. 0:29:50Web Access: Claude from Browser & Incognito
  10. 0:32:01Scenario Recap: Without VPS vs With VPS + Remote Control
  11. 0:35:16Live Build: Adding Features Remotely via Phone
  12. 0:37:00Cron Jobs: Scheduling Claude Commands Automatically
  13. 0:38:29The Memory Problem: Context Lost Between Sessions
  14. 0:39:32mem0: Persistent Memory Store for Claude Code
  15. 0:44:52Free mem0 Deal — $57 Off for 3 Months
  16. 0:49:12Full Mobile Control Demo: App Workflow from iPhone
  17. 0:54:48The Session Death Problem & Why You Need T-Mux
  18. 0:55:48T-Mux: Terminal Multiplexer for Bulletproof Sessions
  19. 1:00:00Live Build: Visitor Wall App with Socat Tunnel
  20. 1:05:25Running Multiple Parallel Claude Sessions
  21. 1:07:07Outro + Hostinger & mem0 Final Recommendations

Chapters from the video description on YouTube.

Why run agents in the cloud?#

  • Long tasks keep going without your computer needing to stay on.
  • Scheduled work: nightly reports, dependency updates, data clean-ups.
  • Consistent environment: the same machine setup every run.
  • Parallel work: several agents on separate tasks at once.

The basic setup#

  1. Create a cloud virtual machine (any major provider works) with a modest size to start.
  2. Install the tools: git, your language runtime and the agent CLI.
  3. Clone your repository onto the machine.
  4. Configure secrets as environment variables, never in files that get committed.
  5. Run the agent in a persistent session (for example with tmux) so it survives disconnects.

The basic setup

  1. Create a cloud virtual machinemodest size to start
  2. Install the toolsgit, runtime, agent CLI
  3. Clone your repository
  4. Configure secretsas environment variables
  5. Run in a persistent sessionfor example tmux
Terminal
# start a session that keeps running after you disconnect
tmux new -s agent
# … start your agent task inside it …
# detach with Ctrl+B then D; reattach later with:
tmux attach -t agent

Security first#

A cloud agent works without you watching, so its permissions matter even more.

PracticeWhy
Secrets in environment variables or a secrets managerKeeps keys out of code, logs and git history
A dedicated machine and account for the agentLimits what's exposed if something goes wrong
Least-privilege access tokensThe agent can push to a branch, but not deploy to production
Work on a branch, review via pull requestA human approves before anything reaches the main codebase

Supervise the output#

Autonomous does not mean unsupervised. Check logs regularly, review the pull requests the agent opens, and set clear limits: a maximum runtime, a maximum spend, and a rule to stop and report when it's stuck rather than guessing.

03

Try it

Your task · about 10 minutes

Write down which secrets your project uses and move every one of them into environment variables before you run an agent on a cloud machine.

04

Recap & next

Key takeaways

  1. Running agents on a cloud machine lets long tasks continue when your laptop is off.
  2. Keep secrets in environment variables, never in code or prompts.
  3. Limit what the agent can do on the server with scoped permissions.
  4. Check logs and results regularly; autonomous does not mean unsupervised.

Quick check

2 questions · instant feedback

1Where should API keys live on a server?
2Why scope an agent's permissions on a server?

Finished this lesson?

Mark it complete to track your progress and keep your streak going.

Next