[{"data":1,"prerenderedAt":192},["ShallowReactive",2],{"docs-/docs/sandbox/running-tools":3},{"id":4,"title":5,"body":6,"description":184,"extension":185,"meta":186,"navigation":187,"path":188,"seo":189,"stem":190,"__hash__":191},"docs/docs/sandbox/running-tools.md","Running tools",{"type":7,"value":8,"toc":174},"minimark",[9,13,22,27,30,66,69,73,84,102,105,109,116,119,123,126,129,133,154,161,165,171],[10,11,5],"h1",{"id":12},"running-tools",[14,15,16,17,21],"p",{},"Every tool execution follows the same path: ",[18,19,20],"strong",{},"deploy → execute → stream logs → return result",". You don't have to do any of this manually — the UI handles it — but it helps to know what's happening.",[23,24,26],"h2",{"id":25},"deploy","Deploy",[14,28,29],{},"The first time you run a tool (or the first time after you've edited it), the sandbox fetches a fresh copy:",[31,32,33,42,48,51],"ol",{},[34,35,36,37,41],"li",{},"The browser asks the sandbox to deploy tool ",[38,39,40],"code",{},"T",".",[34,43,44,45,41],{},"The sandbox calls the backend with its API token: ",[38,46,47],{},"GET /api/tools/T/archive.zip",[34,49,50],{},"The backend verifies you own the tool and streams back a zip archive.",[34,52,53,54,57,58,61,62,65],{},"The sandbox extracts it to ",[38,55,56],{},"/sandbox/tools/T/",", detects the language (Python or JavaScript), and installs dependencies (",[38,59,60],{},"pip install -r requirements.txt"," or ",[38,63,64],{},"npm install",").",[14,67,68],{},"Deployment typically takes a second or two; dependency‑heavy tools can take longer on first deploy.",[23,70,72],{"id":71},"execute","Execute",[14,74,75,76,79,80,83],{},"Once deployed, the sandbox keeps a ",[18,77,78],{},"worker"," for that tool — a pre‑warmed process ready to receive input. When you click ",[18,81,82],{},"Run",":",[31,85,86,89,92,99],{},[34,87,88],{},"The browser sends the input and any settings to the sandbox over a WebSocket.",[34,90,91],{},"The sandbox hands the request to the tool's worker.",[34,93,94,95,98],{},"The worker calls the tool's ",[38,96,97],{},"process(input, settings)"," function.",[34,100,101],{},"The result comes back over the same WebSocket.",[14,103,104],{},"Because the worker is already alive, repeated runs of the same tool are fast — there's no cold start cost after the first execution.",[23,106,108],{"id":107},"worker-pool","Worker pool",[14,110,111,112,115],{},"Each sandbox keeps ",[18,113,114],{},"up to 20 workers alive simultaneously",". Beyond that, the least‑recently‑used worker is evicted to make room. Workers also time out after ~15 minutes of idleness.",[14,117,118],{},"In practice you almost never need to think about this — the pool self‑manages. The main visible effect is that a tool you just ran will run again instantly, while a tool you haven't touched in a while may take a beat to warm up.",[23,120,122],{"id":121},"logs","Logs",[14,124,125],{},"Anything your tool writes to stdout / stderr or logs through the SDK is streamed back in real time and displayed in the execution console. Log messages include a timestamp and severity level.",[14,127,128],{},"Logs are also kept for the duration of the execution so you can review them after the tool finishes.",[23,130,132],{"id":131},"timeouts-and-limits","Timeouts and limits",[134,135,136,142,148],"ul",{},[34,137,138,141],{},[18,139,140],{},"Default timeout",": 30 seconds per execution. Long‑running tools can request a higher timeout.",[34,143,144,147],{},[18,145,146],{},"Concurrent workers",": 20 per sandbox.",[34,149,150,153],{},[18,151,152],{},"Tool worker idle timeout",": 15 minutes.",[14,155,156,157,160],{},"If a tool exceeds the timeout, the worker is killed and you'll see a ",[38,158,159],{},"TimeoutError",". A subsequent run starts a fresh worker automatically.",[23,162,164],{"id":163},"what-if-the-sandbox-is-offline","What if the sandbox is offline?",[14,166,167,168,170],{},"If your sandbox isn't running when you click ",[18,169,82],{},", the UI shows the red / orange status and the execution is blocked. Start the sandbox and try again.",[14,172,173],{},"For cloud sandboxes that auto‑stopped, the UI will offer to start it for you.",{"title":175,"searchDepth":176,"depth":176,"links":177},"",2,[178,179,180,181,182,183],{"id":25,"depth":176,"text":26},{"id":71,"depth":176,"text":72},{"id":107,"depth":176,"text":108},{"id":121,"depth":176,"text":122},{"id":131,"depth":176,"text":132},{"id":163,"depth":176,"text":164},"How tools are deployed and executed inside a sandbox.","md",{},true,"/docs/sandbox/running-tools",{"title":5,"description":184},"docs/sandbox/running-tools","slv98YPyRZUN42BX13Y1btGaRhyBjnOLotyJAaBemhk",1781004915399]