Soften the hardcoded workflow timeout or make it configurable

AI-generated summary

mcwumbly reports hitting a hardcoded 1-second sandbox execution timeout when optimizing workflows by replacing agent nodes with code nodes to improve speed, reliability, and token usage. The error occurs in workflows using loops to process batches from large external datasets, where the aggregate execution time exceeds the limit despite individual operations being efficient. mcwumbly notes the surprising discrepancy compared to longer-running agent nodes and suggests the timeout might be evaluated differently for code execution.

j.jaffeux acknowledges the request but emphasizes the necessity of timeouts to prevent infinite processing and excessive worker resource consumption. In response, mcwumbly agrees with maintaining a safe default but requests the ability to override the timeout for specific workflows. mcwumbly mentions implementing a temporary workaround by limiting loop iterations per run while awaiting a more flexible configuration option.

I have some workflows where I’ve been relying on agents to do a lot of heavy lifting. Recently, I’ve been porting the logic over from agent nodes that load large prompts into code.

The rationale for doing so is:

  • save a ton of tokens
  • workflow runs are much faster
  • behavior is more predictable

The agents were a great way to get things going quickly, but now I want speed and reliability.

After getting a couple of these moved over, during one test run, I hit this error for the first time:

Sandbox execution time exceeded 1000ms for this workflow

I found it surprising, because my previous workflows that relied on agent nodes took much longer.

But apparently, agent node execution time is counted differently or something. I think this is where this is being set and evaluated:

One thing worth noting is that I’m using a loop in this workflow.

It processes things in batches from an external data source with a data set that may be quite large. The loop handles this quite well, allowing for me to configure the per-loop batch size to keep things running smoothly.

But, that does mean a timeout that applies to the workflow as a whole is a bit troublesome in this case.

I am not sure what the right solution is here, but I’d like to have some “way out” here and let these workflows that feel much more efficient to me run without hitting this timeout.

Potentially you could optimize some code somewhere; but yes we want to avoid infinite processing and people holding our workers for too long.

1 Like

Yeah, 1 second feels like much less than “infinite” though. I am cool with it as a default, but maybe I could override it for a given workflow?

I’ve got a reasonable workaround in place in the mean time (limiting the number of times through the loop for a given workflow run).