Hisham Alhussain
← All posts

Building agents that actually finish the job

· 2 min read

Claude Sonnet 4.5 dropped a couple of days ago, along with the Claude Agent SDK, and the headline that caught my eye was the model working on its own for 30+ hours on a single task. A couple of weeks earlier, OpenAI shipped GPT-5-Codex, which is also built for long agentic coding sessions.

Whatever you think of the exact numbers, the direction is clear: models can now stay on task for a really long time. Which means the bottleneck has moved. It's not "can the model do this step?" anymore. It's "can my harness keep it on track for 200 steps?"

The loop is simple. The details aren't.

At its core, an agent is just a loop: look at the context, pick an action, call a tool, look at the result, repeat. You can write that in 50 lines. The hard part is everything around the loop.

Here's what I've learned matters most.

Give it a way to check its own work

The single biggest improvement in my agents came from adding verification. If it's writing code, it runs the tests. If it's filling in a report, it checks the totals add up. If it's booking something, it reads back what was actually saved.

Agents that can check their own work catch their own mistakes. Agents that can't will confidently tell you they're done when they aren't.

Write the plan down

For anything beyond a few steps, I have the agent write a short plan first and keep it in a file it can update. When it gets lost, and on long tasks it will, it can go back and re-read where it was. That works way better than hoping it remembers everything from 80 turns ago.

Know when to stop

Two failure modes I see constantly:

  • Stopping too early. The agent does 70% and declares victory. Clear success criteria and a verification step fix most of this.
  • Never stopping. The agent loops on the same failing approach forever. Put a cap on retries, and when it hits the cap, have it stop and explain what it tried.

Make failure recoverable

Long-running agents will hit errors: timeouts, rate limits, a tool that returns garbage. Design for it. Save progress as you go, make actions safe to retry where you can, and make sure a crash at step 150 doesn't mean starting over from step 1.

Humans at the right moments

Fully autonomous is great for low-risk stuff. For anything irreversible, like sending emails, spending money, or deleting data, I still want a human to approve it. The trick is putting those checkpoints in the right places so you're not approving every tiny action.

It's a genuinely exciting time to be building these things. The models finally have the stamina. Now it's on us to build harnesses that deserve it.