CLAUDE LABJP
SANDBOX — Claude Managed Agents can now run in your own sandbox and connect to private MCP servers (self-hosted beta, MCP tunnels in preview)PLATFORM — The Claude Developer Platform adds new code execution, web search, and web fetch tools, exposing a 90-second per-cell limitCONTEXT — response_inclusion trims consumed result blocks to save context in agentic workflowsMCP — Enterprise-managed MCP connectors (Okta) continue: zero-touch access across Claude, Claude Code, and Cowork (Team/Enterprise beta)CODE — Claude Code adds /cd, a post-session hook, and a safe mode while tightening MCP policy enforcementMODEL — Opus 4.8, Sonnet 4.6, and Haiku 4.5 lead the lineup; Fable 5 is available from Claude CodeSANDBOX — Claude Managed Agents can now run in your own sandbox and connect to private MCP servers (self-hosted beta, MCP tunnels in preview)PLATFORM — The Claude Developer Platform adds new code execution, web search, and web fetch tools, exposing a 90-second per-cell limitCONTEXT — response_inclusion trims consumed result blocks to save context in agentic workflowsMCP — Enterprise-managed MCP connectors (Okta) continue: zero-touch access across Claude, Claude Code, and Cowork (Team/Enterprise beta)CODE — Claude Code adds /cd, a post-session hook, and a safe mode while tightening MCP policy enforcementMODEL — Opus 4.8, Sonnet 4.6, and Haiku 4.5 lead the lineup; Fable 5 is available from Claude Code
Articles/API & SDK
API & SDK/2026-06-21Advanced

Surviving the 90-Second Code Execution Cell Limit with Checkpointed Chunking

Claude's code execution tool now enforces a 90-second per-cell limit. Here is how to keep a long batch from getting cut off there: persist progress to the container filesystem and resume across cells, with working code for timing, idempotent checkpoints, and knowing when to offload.

api-sdk11code-execution3automation71claude-api67

Premium Article

I had been handing a job that inspects every article MDX across my four sites to a single code execution cell. One day the response just stopped mid-way. No clear error, no stack trace — the output simply ended. It took a second look at my logs to understand why: the June tool update made the 90-second limit on each code execution cell explicit, and my inspection loop had been quietly creeping toward that wall as the file count grew.

At first glance the limit looks like an annoyance. Reframe it as a design starting point, though, and it becomes a clean contract. The key is an asymmetry: the 90 seconds apply per cell, but the container's filesystem lives on across cells in the same session. Use that, and you can split a long job into sub-90-second cells, carrying progress forward and resuming as many times as you need.

This article narrows the carry-forward craft to three things: measuring, idempotent checkpoints, and the offload decision. My example is a batch job from my own work as an indie developer at Dolice Labs, but the approach is the same whether you are post-processing search results or bulk-converting image metadata.

The 90 seconds are per cell; the container keeps living — that asymmetry is the starting point

The first thing to internalize is that the limit applies to a single cell's execution, not the whole conversation. If one cell gets cut at 90 seconds, the container for that session stays alive. A file you wrote to /tmp in the previous cell is still readable from the next one.

Get this backwards and your design falls apart. The container's lifetime is tied to the conversation (the session); it is not rebuilt for each cell. So the strategy is simple. Split the work into units that fit inside 90 seconds, and at the end of each cell, write "how far I got" to a file in the container. The next cell picks up from there. That's the whole idea.

The flip side: cross a session boundary and the assumption breaks. A new conversation means a fresh container, and the /tmp progress is gone. If you need to carry state beyond a session, push progress to external storage (your own MCP server or an object store). This article stays inside the "finish a long batch within one session" scope. For the basics of the code execution tool itself, I cover them in automating CSV reports with the code execution tool; start there if the foundation feels shaky.

Measure one unit's wall time first — don't split by guesswork

Pick a chunk size by intuition and you'll usually miss. My first attempt was a lazy "one site per cell should be fine," and of course one site had far more files and hit 90 seconds again. Measuring the per-unit wall time first looks like a detour but is the shortcut.

import time
 
def measure_unit(items, process, sample=5):
    """Run only the first `sample` items for real to estimate per-item wall time."""
    start = time.monotonic()
    n = min(sample, len(items))
    for item in items[:n]:
        process(item)
    elapsed = time.monotonic() - start
    per_item = elapsed / n if n else 0.0
    usable = 75.0  # the time budget discussed below
    safe_chunk = max(1, int(usable / per_item)) if per_item else len(items)
    print(f"{per_item*1000:.0f}ms/item -> safely ~{safe_chunk} items per cell")
    return safe_chunk
 
# Example output:
#   320ms/item -> safely ~234 items per cell

Use time.monotonic(), not time.time(). The latter can jump backward when the system clock is adjusted, which makes it unreliable for measuring elapsed time. The former is guaranteed to move forward, so it is safe for deadline checks like this.

When you actually measure, the numbers often surprise you. In my MDX inspection, parsing the MDX body dominated over the regex passes, and per-item time swung more with the number of code blocks than with file size. Measuring moves your split decision from "impression" to "number."

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
Take a long batch that kept dying at 90 seconds and run it to completion by checkpointing across cells
Walk away with a resumable loop that persists progress to the container filesystem, plus an in-cell time-budget guard that bails out on its own
Draw a measured line between work that belongs in the code execution tool and work you should push to your own infrastructure
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

API & SDK2026-06-13
Managed Agents Adds Scheduled Deploys, a Vault, and Session Webhooks — Deciding What Leaves My Cron Setup
Scheduled deploys, vault credentials, and session-thread webhooks just landed in Claude Managed Agents. How I triaged my self-hosted cron jobs: what moves, what stays, and why idempotency decides.
API & SDK2026-06-12
Handing Monthly Revenue CSVs to the Claude API Code Execution Tool — Files API Wiring, Container Reuse, and Billing Traps
How I moved monthly revenue-CSV reconciliation for four apps into the Claude API Code Execution tool — Files API integration, container reuse, the 5-minute billing minimum, and the file-preload charge that surprises almost everyone.
API & SDK2026-05-15
Cutting Claude API Costs in Half with Messages Batches API — Design Patterns from an Indie Developer
How to reduce Claude API costs by up to 50% using the Messages Batches API. Includes async design patterns, real cost calculations, and production-ready error handling from an indie developer who runs four AI blogs on autopilot.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →