Skip to main content
TACAVAR
•Build in Public

Agent Tool Timeouts: Nohup + MCP Polling Pattern

Agent tool call timeouts kill 6-minute renders. How Tacavar uses nohup, output redirection, and the MCP polling pattern to run long-running AI agent tasks.

Sonnet solved the timeout on the first try: nohup, then poll for a done marker. No prompting, no documentation, no hint in the system message. Our agent hit a hard wall — an agent tool call timeout — and decomposed around it in a single render session. That session reshaped how Tacavar handles long-running tasks in AI agents, because it exposed the real shape of the problem: the timeout isn't a bug to lift, it's a lifecycle to design around.

The Mismatch: 60-Second Tool Caps, 6-Minute Renders

Tacavar's internal harness exposes a shell tool, mcp_infra_run_shell, with a hard cap of roughly 60 to 90 seconds per invocation. That ceiling exists for good reasons: runaway processes, hung network calls, and agents that block a session forever all get killed early. The cap protects the harness.

The problem is the workload on the other side. Our video generation pipeline runs Seedance renders that routinely take two to six minutes. Launch a render directly through the shell tool and you get a deterministic failure: the tool call dies at the cap, the render dies with it, and the agent burns turns retrying something that structurally cannot succeed. Every founder running long-running tasks through AI agents eventually hits this exact mismatch — the tool lifecycle is seconds-scale, the work is minutes-scale.

Fire-and-Forget With nohup and Output Redirection

On the first Seedance render, Sonnet did something we hadn't scripted: it stopped trying to run the render inside the tool call. Instead, it detached the process:

nohup python3 render.py --prompt "..." > /tmp/render_out.log 2>&1 &

Three things happen in that one line, and each maps to a real constraint. nohup detaches the render from the tool-call lifecycle, so when the shell invocation ends — milliseconds later — the process keeps running. The redirection to /tmp/render_out.log captures stdout and stderr so progress and errors survive after the call returns. The trailing & pushes the process into the background so the tool call returns immediately, comfortably under the 60-second cap.

The tool call is no longer the render. It's the launch of the render. That reframing is the whole trick: background jobs from agents work when you separate starting the work from awaiting the work.

Polling for the Done Marker Across Tool Calls

Launching is half the pattern. The other half is knowing when the render finishes, and Sonnet solved that with what we now call the MCP polling pattern: a sequence of cheap, short tool calls that check state rather than perform work.

Each poll is a single MCP call — well under the timeout — that tails /tmp/render_out.log and greps for a done marker the render script writes on completion. Between polls, the agent can sleep, update the user, or run unrelated steps. The render chugs along in the background the entire time; the agent's attention just periodically touches it.

This inverts the usual mental model. Instead of one long call holding the session hostage, you get many short calls that observe progress. Total wall-clock time is identical — the render still takes its six minutes — but no single tool call ever approaches the cap, and the agent stays responsive throughout. Failure handling improves too: a partial log tells you whether the render crashed at 30 seconds or hung at five, which a killed 60-second call never could.

Why Decomposition Beats Fighting the Timeout

The instinctive fix for agent tool call timeouts is to raise them. Set the cap to ten minutes and move on. We've watched teams do this, and it fails in predictable ways: a hung process now burns ten minutes per attempt, a crashed session loses everything at minute nine, and every downstream consumer inherits the new ceiling.

Sonnet's first-try solution points at the sturdier answer: decompose. Fire-and-forget start, poll-for-result lifecycle. This is the same shape as every mature job system — queue the work, return a job ID, check status — except the agent assembled it from primitive Unix parts in one shot, with no schema changes to the tool surface.

That's the part worth underlining for operators. The pattern required zero infrastructure changes. No new tool, no async API, no queue service. Just process detachment and a file marker. When your agent can compose primitives this way, your timeout ceiling stops being a hard limit and becomes a design parameter. At Tacavar, we now treat decomposition as the default answer to any tool cap, and we reserve managed orchestration for when polling gets expensive or the work needs durability across sessions.

Porting the Pattern to Other Agent Frameworks

Nothing here is specific to our harness. Any framework with tool-call time limits — MCP clients, CLI agents, custom eval loops — can run the same two moves. Launch long-running work with nohup (or your platform's detach primitive), redirect output to a known path, and have the agent poll that path across subsequent tool calls until the done marker appears. If your tools can't run shell commands, the same structure works over any async API that returns a job handle and exposes a status endpoint — the marker just lives in an API response instead of a file.

Two boundaries to watch. First, polling cadence: aggressive polling wastes turns, so have the agent sleep between checks. Second, durability: if the process dies with the machine, no marker ever appears, and you need supervisor-level orchestration, not a cleverer prompt.

That second boundary is where Tacavar's agent-orchestration work lives. The patterns in this post get you far; managed orchestration takes you the rest of the way when long-running work needs to survive restarts, fan out across workers, or report progress to humans. Tacavar builds agent infrastructure that handles long-running work without timeout hacks. Explore the orchestration patterns at tacavar.com/agent-orchestration.