How to Run Claude Code Agents for 24+ Hours
Frontier coding agents are getting better and better at running for longer periods of time, being more eager to complete the goals that they receive from the human input. I especially notice this from the latest Claude Fable model and GPT-5.6.
However, the agents in themselves don’t solve everything. You also need to have a harness and structure around your coding that ensures the agents are able to run for longer periods of time. In this article, I’ll discuss:
- How to create an environment where agents can run for longer periods of time
- How to give them the permissions they need
- How to ensure agents verify their own work.
Why run long-running agents
First of all, I’d like to cover why you should follow the tips within this article. In this instance, it’s about why you should run agents for a longer period of time. You might think that you want agents to run fast and get work done as quickly as possible. Of course, to a certain extent, you want stuff done as quickly as possible, but there’s also a trade-off here with how much a human has to interact with the agent to get the work done.
After the release of coding agents, and especially after they became very powerful, after the release of Claude Opus 4.5, the bottleneck within coding has become the human review time; i.e., it’s not actually implementing the code that takes time; it’s more reviewing the results of the code, checking that it’s implemented correctly and according to the specs, that takes time. Thus, since this is the bottleneck, you want to minimize how much time you spend on review, which is why you want the agents to run for longer periods of time, implementing everything and reviewing it themselves before handing it off to the human.
This minimizes the time a human has to spend verifying a task, which is ideal because it is the bottleneck currently within programming.
Simply explained:
You want long-running agents because the human review is now the bottleneck, and you want to minimize how much time you spend on the human review to get as much work done as possible.
How to run agents for over 24 hours
Now I’ll move on to some more specific techniques and tips on how to actually run agents for longer periods of time. As a high-level overview, I’ll cover these techniques and tips.
- Give agents all permissions
- Give agents the ability to verify their own work
- Make agents review the code (Codex)
- Running agents remotely
Permissions
The first thing you can just start with right away is to make sure that the agents have all the permissions that they need. If an agent has to stop asking for permissions, you’re wasting a lot of time, and in almost all cases, it’s just something you accept anyway. There are numerous ways to do this, and you can have auto-mode or skip all permissions, which are settings available in both Codex and Claude Code. It could be worth noting that you should be running in sandbox mode so that you protect your computer and your data and make sure nothing gets deleted permanently.
I think it’s also worth being aware that OpenAI did actually recently admit that they had situations where the latest GPT model had deleted a bunch of files from people’s computers under very specific circumstances. This is, of course, very rare and will most likely never happen to you, but of course, the consequences, if it happens, can be pretty severe.
There are numerous ways to protect yourself from this. One is, of course, to run the agents in a sandbox so they can’t delete stuff outside of their own workspace where they are working or active. Another thing is to back up everything on your computer. You should, of course, have all your code and work in GitHub if possible. This is beneficial both for secure storage and for versioning, which can be very useful. And overall, run backups on your computer, for example using Time Machine on the Mac. This will protect you from such situations.
Verify work
Another very important point is to ensure the agents can verify their own work. This is a topic I’ve discussed before in several other articles, but it all comes down to how you describe a task to your agent and which tools you give the agents.
When you describe a task to the agent, you need to make sure you give as detailed instructions as possible, actually mentioning what you want to achieve, but most importantly, you have to tell the agent how to know when it’s completed its work. And the best way to do this is typically to tell the agent how to test the implementation.
To give one example, let’s say you want to implement a particular design that was handed over to you. In this case, you should tell the agent that the design needs to be implemented exactly as is, and that the agent should verify the work by taking screenshots of the design and screenshots of its own implementation, comparing them, and ensuring they’re equal. Furthermore, you should also tell it that if there are any discrepancies between the design and what it’s implemented, it should make you aware of it, so you can make decisions.
The reason you need this last part is that designs will often have parts of them that are technically infeasible given your code base. And it’s very hard for a designer to take all of this into account, so in some situations there will be discrepancies that you need to take into account and deal with. But you should make your coding agent make you aware of them if they appear, and otherwise, it should be exactly equal. You then give the agent browser access, for example to Chrome, so that it can open both the design and its implementation in Chrome, take screenshots, and verify its own work.
You can apply a similar philosophy to basically all other tasks within programming. Describe a task in detail, what to think about, and how the agent should verify its own work, for example, by taking screenshots or running a test suite and so on.
Agentic code review
The last section where I discuss how to verify work is super useful, but it also can be a bit hard to implement because it requires you to prompt agents in a specific way and give them access to all the tools that they need. This next section here with an agentic code review is far easier.
Basically, you should set up a way that the agents review their own code so you don’t have to perform the human review. In my opinion, if you do this correctly, you don’t need to do human code review almost at all, unless it’s very, very critical parts of your applications that you cannot afford to go wrong. The reason is that I believe the coding agents have become so good at reviewing code that they basically eliminate all bugs caused by new code being pushed into production.
In my opinion, the best review agent is Codex. You can run a review with it in 2 ways. One, you can use the GitHub review implementation that Codex has itself, where you enable it, and you just tag Codex in a PR, and it will automatically come and review the code. The second way is to run it through the CLI, where you can basically trigger Codex to run a review on one branch and compare it to another branch. So you just point it at 2 branches, and it performs a review for you. I usually use the second way because, in my experience, it’s faster, and there’s often a delay with the git review where Codex is tagged on GitHub.
This will save you enormous amounts of time, and you’ll be able to push far more code into production.
Remotely running agents
One last thing I would like to mention is that to have long-running agents, you need to have remotely running agents. This basically means that agents will not be interrupted when you close your computer. There are pros and cons to doing this setup. A pro to running agents locally on your computer is, of course, that you have full access to them. You can run, you can easily see any browser interactions that the agents are performing or easily review what the agents are doing. And also, it’s just a simpler setup. Running the agents locally is simpler than running them remotely. However, running agents remotely definitely also has some very strong benefits.
If you run them locally, you risk them being interrupted. For example, if you close your computer when heading home from work or you’re going somewhere to travel and you have to close your computer, the agents will be cut off. Now, on the Mac, for example, you can disable sleep if you close the lid on the computer, but in my experience, that makes the computer become really hot, and I don’t recommend doing that. Didn’t work very well when I tried it.
If you have remotely running agents, however, they will of course not be interrupted because they’re running either in the cloud or on another computer, which is always on and never closed. The downside to this is, of course, that you have less overview of exactly what the agents are doing, and it can be a bit clunky to set up, even though you can use Claude Code or coding agents to set it up pretty simply.
For my setup, I have a powerful computer that I use traveling around and that I run most of my agents on. However, I also have a secondary computer where I have my bots running, my OpenClaw bots, so they can do work at any time, and I can also spin up Claude Code or Codex sessions on that computer so that they run indefinitely if I want to have tasks that run without being interrupted. This can be very useful. A last alternative is to run it in the cloud somewhere, but there are downsides to that as well. First of all, you have to store documents or secrets in the cloud, which can be risky and something I personally want to avoid. And yeah, it’s also a bit clunky to set up, basically.
Conclusion
In this article, I discussed how you can run agents for longer periods of time. I discussed why this is important, highlighting how it allows you to perform more work as an engineer. Furthermore, I covered specific techniques to allow agents to run for long periods of time, including giving the agents the permissions they need, telling them how to verify their own work, how to do an agentic code review, and how you can remotely run agents to ensure they’re never interrupted. I believe all of these techniques are quite important, and you should start implementing all of them to ensure your agents are able to run autonomously for as long as possible until they complete their work. Furthermore, I also believe that remotely running agents will be more and more popular in the future, considering it doesn’t really make sense to run everything on your local computer, given that it will inevitably be shut down at points in time, which will interrupt your agents. So that’s definitely a direction to pay attention to.
👉 My free eBook and Webinar:
🚀 10x Your Engineering with LLMs (Free 3-Day Email Course)
📚 Get my free Vision Language Models ebook
💻 My webinar on Vision Language Models
👉 Find me on socials:
💌 Substack
How it works
Once you click Generate, Ollama reads this article and crafts 5 comprehension questions. Your answers are graded against the article content — general knowledge won't be enough. Score 70+ to count toward your certificate.
Questions are cached — you'll always get the same 5 for this article.