AI Agent Runs Code in a Safe Cloud Sandbox

★
By Mahesh ● Technical Blog ● OpenCraft AI ● Practical Guide ● 12 min read ● 23 November 2026

Quick answer: Yes. A sandboxed AI agent runs code on your data inside an isolated cloud environment, not on your computer. You upload your files, the agent writes and executes Python there, and you get finished files back: a cleaned CSV, a spreadsheet, a chart, a report. Your laptop never runs the code, so a bad script cannot delete your files or change your system. The trade-off is that your data travels to the provider’s infrastructure to be processed. If that is not acceptable, you need a deployment on infrastructure you own (covered below).

The “safe sandbox” question, answered

You have a dataset: a CSV of sales transactions, a folder of financial exports, a JSON dump from your CRM, a set of survey responses. You want an AI to clean it, analyse it and hand back something usable.

You also do not want to install Python on your laptop, and you do not want an AI-written script running with access to your whole filesystem. You want the work done somewhere that, if something goes wrong, the worst outcome is a failed analysis.

That place is a sandbox: an isolated computing environment where the agent runs its code. The agent can use the files you gave it and the tools it needs (Python, data libraries, file input and output). It cannot reach your computer, your browser or your credentials. If the code breaks, the sandbox breaks. Your machine does not.

Why “without touching my machine” matters

The risk of running AI-written code locally

An agent that writes a Python script and runs it on your computer inherits your computer’s permissions. A wrong path can overwrite the wrong file. A recursive delete can remove a folder. A dependency install can change your system libraries. A network call can send data somewhere you did not intend.

An AI model is probabilistic and sometimes wrong. Asking it to execute code in your own environment means the blast radius of a mistake is your whole machine. Execution needs a boundary, and the sandbox is that boundary.

The limit of AI that only talks

The opposite extreme is an assistant that reads your file and replies in text. Nothing runs, so nothing can break. But you cannot ask it to clean a messy CSV, fit a model or produce a formatted workbook, because it hands you a description instead of a file. The useful middle is an agent that actually does the work, in a place where doing the work is safe.

What a safe AI sandbox actually does

“Sandbox” gets used loosely in AI marketing, so it helps to be specific about the properties that matter.

Isolation

The sandbox is a separate environment with its own filesystem and its own boundary. Code inside it cannot see your computer’s files, your browser or your passwords. This is the same principle behind containers and virtual machines: a defined scope, and everything outside it invisible.

No escape, no deleting your files

OpenCraft AI describes its sandbox plainly: the agent works inside it, it can’t escape, and it can’t delete your files. That is the property that makes it reasonable to hand over a real task and step away.

Recoverable by design

AI agents make mistakes: a filter that overwrites a column, a loop that processes the wrong rows. The point of the sandbox is that those mistakes stay contained. OpenCraft AI’s homepage states that nothing is unrecoverable, so you can ask for a different approach instead of starting from scratch. It still pays to keep your own copy of anything important before uploading it.

Three ways to get AI-powered data analysis

1. Local AI on your own hardware

Tools like Ollama and LM Studio run a model on your machine, so your data never leaves it. That is the strongest privacy position.

The catch is that a local model server gives you text generation, not a working agent. To have it clean and analyse files you must build the pipeline yourself, and the code that pipeline runs executes on your own machine, which brings back the risks above. We cover the engineering cost in our guide to self-hosted AI assistants and in running auditable models on your own hardware.

2. General chat assistants

Mainstream assistants such as ChatGPT, Claude and Gemini can read an uploaded file and answer questions about it. Several of them also offer some form of code execution or data-analysis mode, and what they offer changes often. Features, limits, file types and what is available on which plan differ by product and plan, so check each vendor’s current documentation for the specific job you have in mind. The questions to ask are the same for any tool: where does the code run, what can it read, what files can it produce, and what happens to your data afterwards.

3. A sandboxed agent built for the whole job

A sandboxed agent is designed around the full loop: you upload data, it plans the work, writes and runs code inside the isolated environment, fixes its own errors, and returns output files. OpenCraft AI works this way. Its homepage describes an agent that runs real tools, real code and real files inside an isolated sandbox, works across multiple steps, and remembers how you work across sessions.

How to run code and analyse data in a safe sandbox

Step 1: Upload your data

Start a task and upload your files: CSV, JSON, Excel, PDF or text. This is the one step where your data leaves your computer. Upload only what the task needs.

Step 2: Describe the analysis in plain language

For example:

  • “Clean this sales data. Remove duplicate rows, standardise the date format, and total revenue by region.”
  • “Build a quarterly forecast from these figures with a moving average, and plot it.”
  • “Pull the key metrics from these reports into one comparison table.”

The agent works out the steps, picks the libraries and decides the output format.

Step 3: The agent writes and runs the code

Inside the sandbox the agent typically uses standard Python tooling for data handling, numerical work, charts and spreadsheet output. If a script errors, the agent reads the error, adjusts and retries. You do not debug Python or manage dependencies.

Step 4: Collect finished files

You get downloadable results: a cleaned CSV, a multi-tab spreadsheet, a chart image, a written report. Open them in your usual tools and check the numbers. For a worked example of the spreadsheet case, see can an AI agent build a finished spreadsheet or financial model. For documents, see how an AI can read a folder of PDFs and write a research report.

Step 5: Iterate

If something is off, say so: “use ISO dates”, “add a confidence interval”, “export the chart as a PDF”. The agent updates its scripts and reruns them. Because the work happens in the isolated environment, you can refine as many times as you need without putting your own machine at risk.

What “safe” does and does not mean

What a sandbox gives you

  • The code runs in an isolated environment, not on your computer.
  • The agent works inside a boundary it can’t escape.
  • Your files are protected from deletion by the agent.
  • You need no local setup: no Python, no dependencies, no environment to configure.
  • A bad run is recoverable rather than catastrophic.

What it does not give you

  • Your data does leave your machine. You upload it for processing. If the rule is that data must never leave your hardware, a standard cloud sandbox does not meet it.
  • It is not a compliance certificate. Isolation from your machine and from other users is not the same as a regulatory certification. If your data falls under HIPAA, GDPR or similar rules, check the provider’s current security and data-handling terms before you upload.
  • It does not check the answer for you. A chart can be technically correct and still misleading, and a cleaning step can drop rows you needed. You are the domain expert. The agent is the tool.

For a checklist of what to ask any AI vendor about your data, see is your data safe with AI chatbots.

Where OpenCraft AI fits

OpenCraft AI (Ocai) is an agent that runs on open-weight models and executes multi-step work in an isolated sandbox. On the pricing page its models include Ocai Swift, Ocai Core and Ocai Ultra, plus DeepSeek v4 Pro and Kimi K3, all drawing on one credit balance. Pricing is pay-as-you-go with no subscription, and new accounts start with free credits.

What it is good for:

  • Handing over a multi-step data task and getting files back, not advice.
  • Working through errors without you debugging code.
  • Keeping your own computer out of the loop entirely.
  • Continuing the work across sessions, since it remembers how you work.

What it is not:

  • A guarantee that data never leaves your hands. In the standard product, your files are processed in OpenCraft’s cloud sandbox.
  • A substitute for your own review of the output.

If your data must stay on your infrastructure: OpenCraft AI’s enterprise page describes a deployment where the application and the AI run on infrastructure you own, in your country, so the data never leaves. That is a separate engagement from the standard product, so talk to the team about it. The idea of choosing open models you can audit and swap is explored in our post on law-firm document review without data leaving.

How to decide

Ask four questions.

  1. Does your data have to stay on hardware you control? If yes, look at a deployment on your own infrastructure rather than a shared cloud sandbox, and accept that you or your vendor carry the operational work.
  2. Do you need files or just text? If you need a cleaned CSV, a workbook or a chart, you need code execution, not just a chat reply.
  3. How complex is the analysis? A quick summary may not need an agent. Multi-step cleaning, modelling and charting does.
  4. How much setup can you tolerate? A sandboxed agent needs none locally. A do-it-yourself pipeline needs Python, dependencies and error handling on your own machine.

The right answer depends on your constraints, not on which tool sounds most impressive.

FAQ

Can an AI agent really run code without touching my machine?

Yes. A sandboxed agent runs code in an isolated cloud environment. You upload files there, the agent writes and executes Python inside it, and you download the results. Your own computer does not run the code.

What happens if the AI writes a bad script?

The error stays inside the sandbox. The agent reads the error message, changes the code and tries again. Because the agent can’t escape the sandbox or delete your files, a bad script does not reach your computer.

Does my data stay on the provider’s servers?

Your files are uploaded to the provider’s infrastructure so they can be processed. Retention and deletion rules are set by the provider’s own policy, so read it before uploading anything sensitive. If data must never leave your infrastructure, ask about an own-infrastructure deployment.

Can I use a sandboxed agent for confidential data?

Sometimes. A sandbox isolates the code from your machine and from other users, but your data still goes to the provider for processing. For regulated or client-confidential data, check the provider’s security and data-handling terms first, and remove anything the task does not need.

What file types can it work with?

Common formats such as CSV, JSON, Excel, PDF and plain text. Because the agent uses code to read each format, results on very messy or scanned files can vary, so check the output.

Do I need to know Python?

No. You describe the task in plain language and the agent writes and runs the code. If you want to see what it did, you can ask it to show you the steps.

How is a sandbox different from a virtual machine?

Both isolate code from the machine around them. They are built differently and the exact guarantees depend on the implementation, so for a security decision ask the provider how its isolation works instead of assuming it from the word “sandbox”.

Can I rerun the analysis with different settings?

Yes. Ask for a change (“use a 30-day window instead of 90”) and the agent reruns the code and returns updated files, so you can compare results without redoing the setup.

Is there an option to run it on my own infrastructure?

OpenCraft AI’s enterprise page describes a deployment where the application and the AI run on infrastructure you own, in your country. Contact the team through that page to scope it.

How much does it cost?

OpenCraft AI is pay-as-you-go. You spend credits as you use models, with per-million-token rates listed on its pricing page, and no subscription. New accounts get free credits to try it.

Bottom line

An AI agent can run code on your data in a safe sandbox without touching your machine. The sandbox is what makes it safe: it isolates the code, keeps it from escaping and protects your files. The cost is that your data goes to the provider’s infrastructure, which is fine for many jobs and wrong for some.

If you need working files, charts and models without installing anything, a sandboxed agent is the right shape of tool. If your data must stay on your own hardware, look at an own-infrastructure deployment instead. Either way, check the output before you rely on it.

You can try OpenCraft AI with free credits: upload a file, describe the analysis, and see what comes back.

Scroll to Top