r/PiCodingAgent • • 3d ago

Discussion How to have Pi agent run while laptop is asleep

Sorry, I feel like I'm missing something obvious but can't for the life of me figure this out.

My setup is i have a laptop and a remote AI workstation. Pi agent on the laptop then runs the LLMs served through that workstation running from lemonade AI server.

I know there are multiple ways to do this with tmux or even using ( & with nohup) I'm just like there has to be a way to do this natively right?

I just need to get it to keep working even when the laptop is asleep or closed

12 Upvotes

29 comments sorted by

11

u/adamshand 3d ago

Herdr or Rex are the easy way. Basically you want to run Pi directly on the remote workstation and only use your laptop as a control point.

1

u/Ivan_Draga_ 3d ago

I'll checkout those 2 thx

1

u/Stock_University_121 3d ago

been enjoying rex so much lately. can't wait to get off the iOS wait-list

1

u/clivegermain 2d ago

what do u like rex for compared to herdr?

1

u/sergeant113 2d ago

Can the remote agents does its read and write on my local laptop folders?

1

u/adamshand 2d ago

No. Not unless you do something to make folders on your laptop available on the server. Usually people do this because they want things to work when their laptop is closed.

But if you want that, I'd do it the other way around. Move data agents need to the server, and then setup something (sshfs is probably easiest) so you can access that data on your laptop.

7

u/SuspiciousName666 3d ago

Why not run Pi directly on your remote workstation and access it via SSH + tmux? Your laptop would just be a client.
I went a bit further with my own project, using pi-durable and Buzz to interact with remote Pi agents without keeping my laptop awake.
https://github.com/forge-z/yewholt

3

u/Ivan_Draga_ 3d ago

That's the plan but I've never used TMUX so wanted to void having to memorize the commands / shortscuts for how to do things

1

u/Late_Film_1901 3d ago • Bravo

You don't have to use it to the fullest. You can just as well run tmux, run pi inside of it and detach when you want it to keep running.

And the LLM can explain the shortcuts or even change them for you.

-1

u/Ivan_Draga_ 3d ago

Hmmm lol I think you're smart.. You're resourceful... I appreciate you

1

u/runnystool 10h ago

Learn the bare minimum tmux. Create session, list sessions, attach session, detach session. That's really all you need. 

2

u/FastHotEmu 3d ago

stupid question: what exactly does pi-durable do?

3

u/SuspiciousName666 3d ago

This is the foundational library for a conversational agent that maintains state in a database: conversations, messages, tools, and results are stored durably, with every operation executed within a transaction, ensuring that an interruption mid-process doesn’t leave things in an incomplete state. It provides the building blocks for extensions, tools, and conversation inputs, handling persistence and session resumption so that developers building agents on top of it don’t have to reinvent these mechanisms for every project. https://youtu.be/SBEGweMW3BM

2

u/Corythebeast7 3d ago

How have you liked Buzz? I tried it right when it came out and had a bad time, couldn't get anything to work

1

u/SuspiciousName666 3d ago

But it was bad, really bad. Now that it’s out of beta, it’s much better.

2

u/omppulse 3d ago

Do not fight laptop sleep: run the agent directly on your always-on workstation inside `tmux` (not on the laptop), and treat the laptop as a thin client over SSH + Tailscale. Closing the laptop lid detaches SSH cleanly while the agent keeps running uninterrupted on the workstation, and `tmux attach` drops you straight back in when you reopen it.

Two small things that save headaches with that setup:

  • Keep the repo and `tmux` session on the workstation so Wi-Fi drops on the laptop never interrupt a turn.
  • Avoid writing to the exact same session file from two separate processes at once without a collab/bridge layer, since session writers rewrite history from memory.

(Full disclosure: if you ever run Oh My Pi (`omp`) on that workstation, I built an open-source mobile UI called [OMP Pulse](https://github.com/JulianCodespoti/omp-pulse) that adopts running `tmux` sessions over Tailscale and sends push notifications when a turn finishes or needs input, so you can check in from your phone while the laptop is shut too.)

1

u/rightful_vagabond 3d ago

I do something very similar to this using T3 code. It lets me start off threads in pi and have them go on the server that I start from my phone, my work laptop, or my home computer.

1

u/Slow-Secretary4262 3d ago

if the laptop is sleeping its not possible, closed is possible by disabling handle lid switch, but honestly the best solution is an headless dev LXC or VM in a server

1

u/BenchifyAppDNS 3d ago

I have Pi running 24/7 on a remote workstation with Pi durable and I control it through telegram. Works amazing

1

u/Intelligent-Week-931 3d ago

If you use herder it will be persistent just install on your server and run pi from there

1

u/mycolo_gist 2d ago

Get a VPS.

1

u/rogerfiftyfive 2d ago

I like pi-pocket that runs a pi durable session on the workstation - you connect from laptop phone or others via lan or wireguard. https://github.com/TannerMidd/pi-pocket

1

u/gbrennon 2d ago

u just have to keep agent running somewhere. if u want to switch the laptop into a sleepy state u have to run the agent in a vps

1

u/Limp_Classroom_2645 1d ago

You can run it remotely with Pi-Studio: https://github.com/avatsaev/pi-studio

1

u/Over-Question3395 13h ago

where do yall get remote workstation? do you guys just rent a vps or sumtng?

1

u/runnystool 11h ago

I run https://pi-web.dev on my remote AI workstation. It manages Pi as a daemon that I can connect to from anywhere, including my laptop or phone. Love love love. 

0

u/wuteverman 2d ago

You want caffeinate— it will prevent the computer from hibernating on display close. There are options to have it wait for a specific process. It’s a command line utility.

0

u/Enough_Experience_80 3d ago

For remote control I use Paseo For server, keep laptop enabled overnight But there is one more fun solution. Latest android phones have built in Linux, so Ive try to run Paseo and pi on it Works pretty good, just too lazy to move multiple project to it.