My Python Script Timed Out — What Are the Execution Limits?

Last updated: March 24, 2026

The sandbox has fixed time limits for each type of operation. When a script or command exceeds its limit, the process is terminated and your agent sees a timeout error. These limits apply per tool call within a single agent turn — they are not cumulative across a conversation.


Timeout Limits by Tool

Tool

Default timeout

Can the agent change it?

Error message on timeout

Python scripts (sandbox_python)

300 seconds

No — hardcoded

Python execution timed out after 300 seconds

Shell commands (sandbox_shell)

60 seconds

Yes — the agent can set a custom timeout parameter per command

Command timed out after {N} seconds

File search (sandbox_match — glob and grep)

30 seconds

No — hardcoded

Search timed out

Integration tool calls (MCP/guMCP via connected tools)

300 seconds (5 min)

No

Varies by integration

What Happens When a Timeout Occurs

When any of these limits is reached:

  1. The running process is terminated immediately — it does not finish gracefully

  2. Any output the script produced before the timeout may still be partially returned

  3. The agent receives the timeout error and will typically try a different approach

  4. Python variable state from the timed-out script is not saved — the pickling step at the end of the script never runs


Common Causes and How to Fix Them

Python script processing too much data

If your agent is running a script that loops through a large dataset or does heavy computation, it may hit the 300-second limit.

What to do: Ask the agent to break the work into smaller chunks. For example, instead of processing 10,000 rows at once, process them in batches of 1,000 across multiple script calls. Each call gets its own 300-second window.

Shell command installing a large package

pip install for large packages (e.g., torch, tensorflow) can exceed 60 seconds. The agent can set a longer timeout for shell commands — for example, timeout: 120 — since shell is the one tool where the timeout is adjustable.

What to do: Tell the agent: "Install that package with a longer timeout." The agent can increase the shell timeout up to a reasonable limit for that specific command.

File search scanning too many files

Glob and grep searches have a 30-second limit. If you're searching a directory with thousands of files, this can be hit.

What to do: Ask the agent to narrow the search — use a more specific directory path, add a file type filter (e.g., only *.csv files), or use a more specific regex pattern.

Integration tool call taking too long

Some external API calls (e.g., querying a large Salesforce dataset, or scraping a slow website) can approach the 5-minute limit.

What to do: Ask the agent to request less data at once. For example, filter by date range or limit the number of records returned.

Important: Timeouts Are Per Tool Call, Not Per Conversation

Each individual tool call gets its own timeout window. If the agent runs three Python scripts in a row during one conversation, each one gets a fresh 300-second limit. The timeouts do not accumulate.

However, there is a separate stream idle timeout of 10 minutes: if no tool activity or output occurs for 10 minutes straight (e.g., the agent gets stuck in a loop), the entire session ends.

Related Docs

Still Need Help?

If this didn't resolve your issue, reach out to support at support@gumloop.com.