{"id":103702,"date":"2026-07-12T19:14:12","date_gmt":"2026-07-12T19:14:12","guid":{"rendered":"https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/"},"modified":"2026-07-12T19:14:12","modified_gmt":"2026-07-12T19:14:12","slug":"how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis","status":"publish","type":"post","link":"https:\/\/youzum.net\/zh\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/","title":{"rendered":"How to Build a T4-Friendly Autonomous Data Science Agent with DeepAnalyze-8B, Sandboxed Code Execution, and Iterative Analysis"},"content":{"rendered":"<p class=\"wp-block-paragraph\">In this tutorial, we build an autonomous data science agent around <a href=\"https:\/\/github.com\/ruc-datalab\/DeepAnalyze\"><strong>DeepAnalyze-8B<\/strong><\/a> and run it. We begin by preparing a stable runtime, installing the required machine-learning dependencies, and loading the DeepAnalyze tokenizer and model in 4-bit mode to keep the workflow practical on limited GPU memory. We then create a sandboxed execution environment that allows the model to generate Python code, execute it safely, observe the results, and continue its analysis in an agentic loop. By the end of the workflow, we give the agent a realistic multi-file e-commerce workspace and let it clean, join, analyze, visualize, and summarize the data as a structured analyst-grade report.<\/p>\n<h2 class=\"wp-block-heading\"><strong>Installing DeepAnalyze-8B Runtime Dependencies<\/strong><\/h2>\n<div class=\"dm-code-snippet dark dm-normal-version default no-background-mobile\">\n<div class=\"control-language\">\n<div class=\"dm-buttons\">\n<div class=\"dm-buttons-left\">\n<div class=\"dm-button-snippet red-button\"><\/div>\n<div class=\"dm-button-snippet orange-button\"><\/div>\n<div class=\"dm-button-snippet green-button\"><\/div>\n<\/div>\n<div class=\"dm-buttons-right\"><a><span class=\"dm-copy-text\">Copy Code<\/span><span class=\"dm-copy-confirmed\">Copied<\/span><span class=\"dm-error-message\">Use a different Browser<\/span><\/a><\/div>\n<\/div>\n<pre class=\"no-line-numbers\"><code class=\"no-wrap language-php\">import os, sys, subprocess\nos.environ[\"MPLBACKEND\"] = \"Agg\"\ndef _pip(*args):\n   subprocess.check_call([sys.executable, \"-m\", \"pip\", \"install\", \"-q\", *args])\n_SETUP_FLAG = \"\/content\/.da_ready\"\nif not os.path.exists(_SETUP_FLAG):\n   print(\"Installing dependencies (one-time). The runtime will RESTART; \"\n         \"just re-run this cell afterwards.n\")\n   _pip(\"-U\", \"transformers&gt;=4.44\", \"accelerate&gt;=0.30\", \"bitsandbytes&gt;=0.43\")\n   _pip(\"sentencepiece\")\n   _pip(\"openpyxl\")\n   _pip(\"--force-reinstall\", \"numpy==2.0.2\")\n   open(_SETUP_FLAG, \"w\").close()\n   print(\"nDependencies ready. Restarting runtime now...\")\n   os.kill(os.getpid(), 9)\n<\/code><\/pre>\n<\/div>\n<\/div>\n<p class=\"wp-block-paragraph\">We start by preparing the Colab runtime with the required machine-learning dependencies for DeepAnalyze-8B. We install the transformer, acceleration, quantization, tokenizer, and spreadsheet libraries without disturbing the broader notebook workflow. We also pin NumPy and restart the runtime once to keep the environment clean and stable for the next execution.<\/p>\n<h2 class=\"wp-block-heading\"><strong>Loading DeepAnalyze-8B in 4-Bit Mode<\/strong><\/h2>\n<div class=\"dm-code-snippet dark dm-normal-version default no-background-mobile\">\n<div class=\"control-language\">\n<div class=\"dm-buttons\">\n<div class=\"dm-buttons-left\">\n<div class=\"dm-button-snippet red-button\"><\/div>\n<div class=\"dm-button-snippet orange-button\"><\/div>\n<div class=\"dm-button-snippet green-button\"><\/div>\n<\/div>\n<div class=\"dm-buttons-right\"><a><span class=\"dm-copy-text\">Copy Code<\/span><span class=\"dm-copy-confirmed\">Copied<\/span><span class=\"dm-error-message\">Use a different Browser<\/span><\/a><\/div>\n<\/div>\n<pre class=\"no-line-numbers\"><code class=\"no-wrap language-php\">import re, io, glob, time, signal, contextlib, warnings, traceback\nfrom threading import Thread\nimport numpy as np, pandas as pd\nimport torch\nfrom transformers import (AutoModelForCausalLM, AutoTokenizer,\n                         BitsAndBytesConfig, TextIteratorStreamer)\nwarnings.filterwarnings(\"ignore\")\nMODEL_ID   = \"RUC-DataLab\/DeepAnalyze-8B\"\nUSE_4BIT   = True\nCOMPUTE_DT = torch.float16\nassert torch.cuda.is_available(), (\n   \"No GPU detected. In Colab: Runtime -&gt; Change runtime type -&gt; GPU.\")\nprint(\"GPU:\", torch.cuda.get_device_name(0), \"| NumPy:\", np.__version__)\nprint(\"nLoading tokenizer &amp; model (first run downloads ~16GB, be patient)...\")\ntok = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True)\nif tok.pad_token_id is None:\n   tok.pad_token = tok.eos_token\nbnb = BitsAndBytesConfig(\n   load_in_4bit=True, bnb_4bit_quant_type=\"nf4\",\n   bnb_4bit_compute_dtype=COMPUTE_DT, bnb_4bit_use_double_quant=True,\n) if USE_4BIT else None\nmodel = AutoModelForCausalLM.from_pretrained(\n   MODEL_ID, quantization_config=bnb, device_map=\"auto\",\n   torch_dtype=COMPUTE_DT, low_cpu_mem_usage=True, trust_remote_code=True,\n)\nmodel.eval()\nprint(\"Model loaded. VRAM used: %.1f GB\" % (torch.cuda.memory_allocated()\/1e9))\n<\/code><\/pre>\n<\/div>\n<\/div>\n<p class=\"wp-block-paragraph\">We import the main libraries, configure the DeepAnalyze-8B model, and verify that a GPU is available in Colab. We load the tokenizer and prepare 4-bit quantization so the model can fit more comfortably on a T4 GPU. We then load the model in evaluation mode and confirm GPU memory usage before moving on to the agent logic.<\/p>\n<h2 class=\"wp-block-heading\"><strong>Building the Sandboxed Code Executor<\/strong><\/h2>\n<div class=\"dm-code-snippet dark dm-normal-version default no-background-mobile\">\n<div class=\"control-language\">\n<div class=\"dm-buttons\">\n<div class=\"dm-buttons-left\">\n<div class=\"dm-button-snippet red-button\"><\/div>\n<div class=\"dm-button-snippet orange-button\"><\/div>\n<div class=\"dm-button-snippet green-button\"><\/div>\n<\/div>\n<div class=\"dm-buttons-right\"><a><span class=\"dm-copy-text\">Copy Code<\/span><span class=\"dm-copy-confirmed\">Copied<\/span><span class=\"dm-error-message\">Use a different Browser<\/span><\/a><\/div>\n<\/div>\n<pre class=\"no-line-numbers\"><code class=\"no-wrap language-php\">class CodeSandbox:\n   def __init__(self, timeout=120, max_chars=6000):\n       self.ns = {\"__name__\": \"__main__\"}\n       self.timeout, self.max_chars = timeout, max_chars\n   def _run(self, code):\n       with contextlib.redirect_stdout(io.StringIO()) as out, \n            contextlib.redirect_stderr(io.StringIO()) as err:\n           exec(compile(code, \"&lt;cell&gt;\", \"exec\"), self.ns)\n       return out.getvalue() + err.getvalue()\n   def execute(self, code):\n       def _handler(signum, frame):\n           raise TimeoutError(f\"Execution exceeded {self.timeout}s\")\n       prev = signal.signal(signal.SIGALRM, _handler)\n       signal.alarm(self.timeout)\n       try:\n           out = self._run(code)\n           result = out if out.strip() else \"[Executed successfully, no stdout]\"\n       except Exception as e:\n           tb = traceback.format_exc().splitlines()\n           loc = next((l.strip() for l in tb if '\"&lt;cell&gt;\"' in l), \"\")\n           result = f\"[Error]n{loc}n{type(e).__name__}: {e}\".strip()\n       finally:\n           signal.alarm(0)\n           signal.signal(signal.SIGALRM, prev)\n       if len(result) &gt; self.max_chars:\n           result = result[:self.max_chars] + \"n...[output truncated]...\"\n       return result\n<\/code><\/pre>\n<\/div>\n<\/div>\n<p class=\"wp-block-paragraph\">We define a sandboxed code executor that gives the agent a persistent Python namespace for running generated code. We capture standard output and error streams so that every execution result can be passed back into the reasoning loop. We also enforce a timeout and truncate long outputs to keep the autonomous workflow controlled and readable.<\/p>\n<h2 class=\"wp-block-heading\"><strong>Implementing the DeepAnalyze Agentic Loop<\/strong><\/h2>\n<div class=\"dm-code-snippet dark dm-normal-version default no-background-mobile\">\n<div class=\"control-language\">\n<div class=\"dm-buttons\">\n<div class=\"dm-buttons-left\">\n<div class=\"dm-button-snippet red-button\"><\/div>\n<div class=\"dm-button-snippet orange-button\"><\/div>\n<div class=\"dm-button-snippet green-button\"><\/div>\n<\/div>\n<div class=\"dm-buttons-right\"><a><span class=\"dm-copy-text\">Copy Code<\/span><span class=\"dm-copy-confirmed\">Copied<\/span><span class=\"dm-error-message\">Use a different Browser<\/span><\/a><\/div>\n<\/div>\n<pre class=\"no-line-numbers\"><code class=\"no-wrap language-php\">class DeepAnalyzeAgent:\n   def __init__(self, model, tok, temperature=0.5, top_p=0.95):\n       self.model, self.tok = model, tok\n       self.temperature, self.top_p = temperature, top_p\n   def _stream_generate(self, context, max_new_tokens):\n       inputs = self.tok(context, return_tensors=\"pt\",\n                         add_special_tokens=False).to(self.model.device)\n       streamer = TextIteratorStreamer(self.tok, skip_prompt=True,\n                                       skip_special_tokens=False)\n       kwargs = dict(\n           **inputs, max_new_tokens=max_new_tokens, do_sample=True,\n           temperature=self.temperature, top_p=self.top_p,\n           stop_strings=[\"&lt;\/Code&gt;\"], tokenizer=self.tok, streamer=streamer,\n           pad_token_id=self.tok.pad_token_id, eos_token_id=self.tok.eos_token_id,\n       )\n       Thread(target=self.model.generate, kwargs=kwargs).start()\n       pieces = []\n       for chunk in streamer:\n           pieces.append(chunk); print(chunk, end=\"\", flush=True)\n       return \"\".join(pieces)\n   @staticmethod\n   def _extract_code(delta):\n       if \"&lt;Code&gt;\" in delta and \"&lt;\/Code&gt;\" not in delta:\n           delta += \"&lt;\/Code&gt;\"\n       m = re.search(r\"&lt;Code&gt;(.*?)&lt;\/Code&gt;\", delta, re.DOTALL)\n       if not m:\n           return None\n       code = m.group(1).strip()\n       fenced = re.search(r\"```(?:python)?(.*?)```\", code, re.DOTALL)\n       return (fenced.group(1) if fenced else code).strip()\n   def run(self, instruction, workspace, max_rounds=12,\n           max_new_tokens=3072, exec_timeout=120):\n       prompt = build_prompt(instruction, workspace)\n       prefix = self.tok.apply_chat_template(\n           [{\"role\": \"user\", \"content\": prompt}],\n           tokenize=False, add_generation_prompt=True)\n       sandbox = CodeSandbox(timeout=exec_timeout)\n       full, trace = prefix, []\n       cwd0 = os.getcwd(); os.chdir(workspace)\n       try:\n           for r in range(max_rounds):\n               print(f\"nn{'='*70}n ROUND {r+1}n{'='*70}\")\n               delta = self._stream_generate(full, max_new_tokens)\n               full += delta\n               trace.append((\"model\", delta))\n               if \"&lt;Answer&gt;\" in delta:\n                   print(\"nn[Agent finished: &lt;Answer&gt; produced]\"); break\n               code = self._extract_code(delta)\n               if code is None:\n                   print(\"nn[Agent stopped: no further action]\"); break\n               output = sandbox.execute(code)\n               print(f\"nn--- &lt;Execute&gt; ---n{output}n--- &lt;\/Execute&gt; ---\")\n               full += f\"n&lt;Execute&gt;n{output}n&lt;\/Execute&gt;n\"\n               trace.append((\"execute\", output))\n           else:\n               print(f\"nn[Reached max_rounds={max_rounds}]\")\n       finally:\n           os.chdir(cwd0)\n       answer = \"\"\n       if \"&lt;Answer&gt;\" in full:\n           answer = full.split(\"&lt;Answer&gt;\")[-1]\n           answer = re.sub(r\"&lt;\/?Answer&gt;\", \"\", answer)\n           answer = re.sub(r\"&lt;[\uff5c|][^&gt;]*?[\uff5c|]&gt;\", \"\", answer).strip()\n       return {\"full\": full, \"trace\": trace, \"answer\": answer}\n<\/code><\/pre>\n<\/div>\n<\/div>\n<p class=\"wp-block-paragraph\">We implement the DeepAnalyze agent loop, which streams model outputs, extracts the generated code, and executes it step by step. We allow the model to alternate between reasoning, coding, execution feedback, and final answering through special action tags. We maintain the full conversation trace so the agent can refine its analysis based on previous outputs and execution results.<\/p>\n<h2 class=\"wp-block-heading\"><strong>Running the E-Commerce Analysis Workspace<\/strong><\/h2>\n<div class=\"dm-code-snippet dark dm-normal-version default no-background-mobile\">\n<div class=\"control-language\">\n<div class=\"dm-buttons\">\n<div class=\"dm-buttons-left\">\n<div class=\"dm-button-snippet red-button\"><\/div>\n<div class=\"dm-button-snippet orange-button\"><\/div>\n<div class=\"dm-button-snippet green-button\"><\/div>\n<\/div>\n<div class=\"dm-buttons-right\"><a><span class=\"dm-copy-text\">Copy Code<\/span><span class=\"dm-copy-confirmed\">Copied<\/span><span class=\"dm-error-message\">Use a different Browser<\/span><\/a><\/div>\n<\/div>\n<pre class=\"no-line-numbers\"><code class=\"no-wrap language-php\">def _hsize(nbytes):\n   for u in [\"B\", \"KB\", \"MB\", \"GB\"]:\n       if nbytes &lt; 1024: return f\"{nbytes:.1f}{u}\"\n       nbytes \/= 1024\n   return f\"{nbytes:.1f}TB\"\ndef build_prompt(instruction, workspace):\n   exts = (\".csv\", \".xlsx\", \".xls\", \".json\", \".xml\", \".yaml\", \".yml\",\n           \".txt\", \".md\", \".tsv\", \".db\", \".sqlite\")\n   files = sorted(f for f in os.listdir(workspace) if f.lower().endswith(exts))\n   lines = [f'File {i+1}: {{\"name\": \"{f}\", \"size\": \"'\n            f'{_hsize(os.path.getsize(os.path.join(workspace, f)))}\"}}'\n            for i, f in enumerate(files)]\n   return f\"# Instructionn{instruction}nn# Datan\" + \"n\".join(lines)\nWORKSPACE = \"\/content\/da_workspace\"\nos.makedirs(WORKSPACE, exist_ok=True)\nrng = np.random.default_rng(42); N = 2500\ncategories = [\"Electronics\", \"Home\", \"Fashion\", \"Books\", \"Toys\"]\ndates = pd.to_datetime(\"2024-01-01\") + pd.to_timedelta(rng.integers(0, 365, N), unit=\"D\")\ntx = pd.DataFrame({\n   \"order_id\": np.arange(100000, 100000 + N), \"date\": dates,\n   \"customer_id\": rng.integers(1, 601, N),\n   \"category\": rng.choice(categories, N, p=[.3, .2, .25, .15, .1]),\n   \"region\": rng.choice([\"North\", \"South\", \"East\", \"West\"], N),\n   \"quantity\": rng.integers(1, 6, N),\n   \"unit_price\": np.round(rng.gamma(3, 12, N) + 5, 2),\n   \"discount\": np.round(rng.choice([0, .05, .1, .15, .2], N), 2),\n})\ntx[\"revenue\"] = np.round(tx.quantity * tx.unit_price * (1 - tx.discount), 2)\ntx.loc[rng.choice(N, 60, replace=False), \"unit_price\"] = np.nan\ntx.to_csv(f\"{WORKSPACE}\/transactions.csv\", index=False)\npd.DataFrame({\n   \"customer_id\": np.arange(1, 601),\n   \"signup_year\": rng.choice([2021, 2022, 2023, 2024], 600),\n   \"segment\": rng.choice([\"Consumer\", \"Corporate\", \"Home Office\"], 600),\n   \"age\": rng.integers(18, 70, 600),\n}).to_excel(f\"{WORKSPACE}\/customers.xlsx\", index=False)\nprint(\"Workspace files:\", os.listdir(WORKSPACE))\nINSTRUCTION = (\n   \"Perform an end-to-end analysis of this e-commerce dataset. Explore and \"\n   \"join the files, clean any data-quality issues, analyze revenue trends over \"\n   \"time, by region, category, and customer segment, and identify the key \"\n   \"drivers of revenue. Create at least one clear visualization and SAVE it as \"\n   \"a PNG file in the current directory. Finish with a concise, well-structured \"\n   \"analyst-grade report of your findings and 2-3 actionable recommendations.\"\n)\nexisting_imgs = set(glob.glob(f\"{WORKSPACE}\/*.png\"))\nagent = DeepAnalyzeAgent(model, tok, temperature=0.5)\nt0 = time.time()\nresult = agent.run(INSTRUCTION, WORKSPACE, max_rounds=12,\n                  max_new_tokens=3072, exec_timeout=120)\nprint(f\"nnDone in {time.time()-t0:.0f}s | \"\n     f\"{sum(1 for k,_ in result['trace'] if k=='execute')} code executions\")\ntry:\n   from IPython.display import display, Markdown, Image\n   if result[\"answer\"]:\n       display(Markdown(\"## <img decoding=\"async\" src=\"https:\/\/s.w.org\/images\/core\/emoji\/17.0.2\/72x72\/1f4ca.png\" alt=\"\ud83d\udcca\" class=\"wp-smiley\" \/> Final Reportnn\" + result[\"answer\"]))\n   else:\n       print(\"No &lt;Answer&gt; block produced (try raising max_rounds).\")\n   for img in sorted(set(glob.glob(f\"{WORKSPACE}\/*.png\")) - existing_imgs):\n       print(\"Figure:\", img); display(Image(filename=img))\nexcept Exception:\n   print(\"n===== FINAL REPORT =====n\", result[\"answer\"])\n<\/code><\/pre>\n<\/div>\n<\/div>\n<p class=\"wp-block-paragraph\">We create the prompt builder, prepare a sample e-commerce workspace, and generate transaction and customer files for analysis. We give the agent a complete analytical instruction that asks it to clean, join, explore, visualize, and summarize the dataset. We finally run the agent, display its final report, and render any saved PNG figures produced during the autonomous analysis.<\/p>\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n<p class=\"wp-block-paragraph\">In conclusion, we saw how DeepAnalyze-8B can be used as more than a simple text-generation model: we turn it into an iterative data-analysis agent that reasons over files, writes executable code, inspects outputs, and produces final insights. We keep the workflow lightweight while still preserving the core agentic pattern of understanding the task, generating code, executing it, and refining the analysis based on real results. It provides us with a foundation for building autonomous data-science notebooks in which the model not only describes an analysis but also actively performs it and returns both visual outputs and a concise final report.<\/p>\n<p class=\"wp-block-paragraph\">\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n<\/p><p class=\"wp-block-paragraph\">\n<\/p><p class=\"wp-block-paragraph\">Check out the\u00a0<strong><a href=\"https:\/\/github.com\/MARKTECHPOST-AI-MEDIA-INC\/AI-Agents-Projects-Tutorials\/blob\/main\/AI%20Agents%20Codes\/deepanalyze_8b_autonomous_data_science_agent_Marktechpost.ipynb\" target=\"_blank\" rel=\"noreferrer noopener\">FULL CODES with NOTEBOOK<\/a><\/strong>.<strong>\u00a0<\/strong>Also,\u00a0feel free to follow us on\u00a0<strong><a href=\"https:\/\/x.com\/intent\/follow?screen_name=marktechpost\" target=\"_blank\" rel=\"noreferrer noopener\"><mark>Twitter<\/mark><\/a><\/strong>\u00a0and don\u2019t forget to join our\u00a0<strong><a href=\"https:\/\/www.reddit.com\/r\/machinelearningnews\/\" target=\"_blank\" rel=\"noreferrer noopener\">150k+ML SubReddit<\/a><\/strong>\u00a0and Subscribe to\u00a0<strong><a href=\"https:\/\/www.aidevsignals.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">our Newsletter<\/a><\/strong>. Wait! are you on telegram?\u00a0<strong><a href=\"https:\/\/t.me\/machinelearningresearchnews\" target=\"_blank\" rel=\"noreferrer noopener\">now you can join us on telegram as well.<\/a><\/strong><\/p>\n<p class=\"wp-block-paragraph\">Need to partner with us for promoting your GitHub Repo OR Hugging Face Page OR Product Release OR Webinar etc.?\u00a0<strong><a href=\"https:\/\/forms.gle\/wbash1wF6efRj8G58\" target=\"_blank\" rel=\"noreferrer noopener\"><mark>Connect with us<\/mark><\/a><\/strong><\/p>\n<p>The post <a href=\"https:\/\/www.marktechpost.com\/2026\/07\/10\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/\">How to Build a T4-Friendly Autonomous Data Science Agent with DeepAnalyze-8B, Sandboxed Code Execution, and Iterative Analysis<\/a> appeared first on <a href=\"https:\/\/www.marktechpost.com\/\">MarkTechPost<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>In this tutorial, we build an autonomous data science agent around DeepAnalyze-8B and run it. We begin by preparing a stable runtime, installing the required machine-learning dependencies, and loading the DeepAnalyze tokenizer and model in 4-bit mode to keep the workflow practical on limited GPU memory. We then create a sandboxed execution environment that allows the model to generate Python code, execute it safely, observe the results, and continue its analysis in an agentic loop. By the end of the workflow, we give the agent a realistic multi-file e-commerce workspace and let it clean, join, analyze, visualize, and summarize the data as a structured analyst-grade report. Installing DeepAnalyze-8B Runtime Dependencies Copy CodeCopiedUse a different Browser import os, sys, subprocess os.environ[&#8220;MPLBACKEND&#8221;] = &#8220;Agg&#8221; def _pip(*args): subprocess.check_call([sys.executable, &#8220;-m&#8221;, &#8220;pip&#8221;, &#8220;install&#8221;, &#8220;-q&#8221;, *args]) _SETUP_FLAG = &#8220;\/content\/.da_ready&#8221; if not os.path.exists(_SETUP_FLAG): print(&#8220;Installing dependencies (one-time). The runtime will RESTART; &#8221; &#8220;just re-run this cell afterwards.n&#8221;) _pip(&#8220;-U&#8221;, &#8220;transformers&gt;=4.44&#8221;, &#8220;accelerate&gt;=0.30&#8221;, &#8220;bitsandbytes&gt;=0.43&#8221;) _pip(&#8220;sentencepiece&#8221;) _pip(&#8220;openpyxl&#8221;) _pip(&#8220;&#8211;force-reinstall&#8221;, &#8220;numpy==2.0.2&#8221;) open(_SETUP_FLAG, &#8220;w&#8221;).close() print(&#8220;nDependencies ready. Restarting runtime now&#8230;&#8221;) os.kill(os.getpid(), 9) We start by preparing the Colab runtime with the required machine-learning dependencies for DeepAnalyze-8B. We install the transformer, acceleration, quantization, tokenizer, and spreadsheet libraries without disturbing the broader notebook workflow. We also pin NumPy and restart the runtime once to keep the environment clean and stable for the next execution. Loading DeepAnalyze-8B in 4-Bit Mode Copy CodeCopiedUse a different Browser import re, io, glob, time, signal, contextlib, warnings, traceback from threading import Thread import numpy as np, pandas as pd import torch from transformers import (AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, TextIteratorStreamer) warnings.filterwarnings(&#8220;ignore&#8221;) MODEL_ID = &#8220;RUC-DataLab\/DeepAnalyze-8B&#8221; USE_4BIT = True COMPUTE_DT = torch.float16 assert torch.cuda.is_available(), ( &#8220;No GPU detected. In Colab: Runtime -&gt; Change runtime type -&gt; GPU.&#8221;) print(&#8220;GPU:&#8221;, torch.cuda.get_device_name(0), &#8220;| NumPy:&#8221;, np.__version__) print(&#8220;nLoading tokenizer &amp; model (first run downloads ~16GB, be patient)&#8230;&#8221;) tok = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True) if tok.pad_token_id is None: tok.pad_token = tok.eos_token bnb = BitsAndBytesConfig( load_in_4bit=True, bnb_4bit_quant_type=&#8221;nf4&#8243;, bnb_4bit_compute_dtype=COMPUTE_DT, bnb_4bit_use_double_quant=True, ) if USE_4BIT else None model = AutoModelForCausalLM.from_pretrained( MODEL_ID, quantization_config=bnb, device_map=&#8221;auto&#8221;, torch_dtype=COMPUTE_DT, low_cpu_mem_usage=True, trust_remote_code=True, ) model.eval() print(&#8220;Model loaded. VRAM used: %.1f GB&#8221; % (torch.cuda.memory_allocated()\/1e9)) We import the main libraries, configure the DeepAnalyze-8B model, and verify that a GPU is available in Colab. We load the tokenizer and prepare 4-bit quantization so the model can fit more comfortably on a T4 GPU. We then load the model in evaluation mode and confirm GPU memory usage before moving on to the agent logic. Building the Sandboxed Code Executor Copy CodeCopiedUse a different Browser class CodeSandbox: def __init__(self, timeout=120, max_chars=6000): self.ns = {&#8220;__name__&#8221;: &#8220;__main__&#8221;} self.timeout, self.max_chars = timeout, max_chars def _run(self, code): with contextlib.redirect_stdout(io.StringIO()) as out, contextlib.redirect_stderr(io.StringIO()) as err: exec(compile(code, &#8220;&lt;cell&gt;&#8221;, &#8220;exec&#8221;), self.ns) return out.getvalue() + err.getvalue() def execute(self, code): def _handler(signum, frame): raise TimeoutError(f&#8221;Execution exceeded {self.timeout}s&#8221;) prev = signal.signal(signal.SIGALRM, _handler) signal.alarm(self.timeout) try: out = self._run(code) result = out if out.strip() else &#8220;[Executed successfully, no stdout]&#8221; except Exception as e: tb = traceback.format_exc().splitlines() loc = next((l.strip() for l in tb if &#8216;&#8221;&lt;cell&gt;&#8221;&#8216; in l), &#8220;&#8221;) result = f&#8221;[Error]n{loc}n{type(e).__name__}: {e}&#8221;.strip() finally: signal.alarm(0) signal.signal(signal.SIGALRM, prev) if len(result) &gt; self.max_chars: result = result[:self.max_chars] + &#8220;n&#8230;[output truncated]&#8230;&#8221; return result We define a sandboxed code executor that gives the agent a persistent Python namespace for running generated code. We capture standard output and error streams so that every execution result can be passed back into the reasoning loop. We also enforce a timeout and truncate long outputs to keep the autonomous workflow controlled and readable. Implementing the DeepAnalyze Agentic Loop Copy CodeCopiedUse a different Browser class DeepAnalyzeAgent: def __init__(self, model, tok, temperature=0.5, top_p=0.95): self.model, self.tok = model, tok self.temperature, self.top_p = temperature, top_p def _stream_generate(self, context, max_new_tokens): inputs = self.tok(context, return_tensors=&#8221;pt&#8221;, add_special_tokens=False).to(self.model.device) streamer = TextIteratorStreamer(self.tok, skip_prompt=True, skip_special_tokens=False) kwargs = dict( **inputs, max_new_tokens=max_new_tokens, do_sample=True, temperature=self.temperature, top_p=self.top_p, stop_strings=[&#8220;&lt;\/Code&gt;&#8221;], tokenizer=self.tok, streamer=streamer, pad_token_id=self.tok.pad_token_id, eos_token_id=self.tok.eos_token_id, ) Thread(target=self.model.generate, kwargs=kwargs).start() pieces = [] for chunk in streamer: pieces.append(chunk); print(chunk, end=&#8221;&#8221;, flush=True) return &#8220;&#8221;.join(pieces) @staticmethod def _extract_code(delta): if &#8220;&lt;Code&gt;&#8221; in delta and &#8220;&lt;\/Code&gt;&#8221; not in delta: delta += &#8220;&lt;\/Code&gt;&#8221; m = re.search(r&#8221;&lt;Code&gt;(.*?)&lt;\/Code&gt;&#8221;, delta, re.DOTALL) if not m: return None code = m.group(1).strip() fenced = re.search(r&#8221;&#8220;`(?:python)?(.*?)&#8220;`&#8221;, code, re.DOTALL) return (fenced.group(1) if fenced else code).strip() def run(self, instruction, workspace, max_rounds=12, max_new_tokens=3072, exec_timeout=120): prompt = build_prompt(instruction, workspace) prefix = self.tok.apply_chat_template( [{&#8220;role&#8221;: &#8220;user&#8221;, &#8220;content&#8221;: prompt}], tokenize=False, add_generation_prompt=True) sandbox = CodeSandbox(timeout=exec_timeout) full, trace = prefix, [] cwd0 = os.getcwd(); os.chdir(workspace) try: for r in range(max_rounds): print(f&#8221;nn{&#8216;=&#8217;*70}n ROUND {r+1}n{&#8216;=&#8217;*70}&#8221;) delta = self._stream_generate(full, max_new_tokens) full += delta trace.append((&#8220;model&#8221;, delta)) if &#8220;&lt;Answer&gt;&#8221; in delta: print(&#8220;nn[Agent finished: &lt;Answer&gt; produced]&#8221;); break code = self._extract_code(delta) if code is None: print(&#8220;nn[Agent stopped: no further action]&#8221;); break output = sandbox.execute(code) print(f&#8221;nn&#8212; &lt;Execute&gt; &#8212;n{output}n&#8212; &lt;\/Execute&gt; &#8212;&#8220;) full += f&#8221;n&lt;Execute&gt;n{output}n&lt;\/Execute&gt;n&#8221; trace.append((&#8220;execute&#8221;, output)) else: print(f&#8221;nn[Reached max_rounds={max_rounds}]&#8221;) finally: os.chdir(cwd0) answer = &#8220;&#8221; if &#8220;&lt;Answer&gt;&#8221; in full: answer = full.split(&#8220;&lt;Answer&gt;&#8221;)[-1] answer = re.sub(r&#8221;&lt;\/?Answer&gt;&#8221;, &#8220;&#8221;, answer) answer = re.sub(r&#8221;&lt;[\uff5c|][^&gt;]*?[\uff5c|]&gt;&#8221;, &#8220;&#8221;, answer).strip() return {&#8220;full&#8221;: full, &#8220;trace&#8221;: trace, &#8220;answer&#8221;: answer} We implement the DeepAnalyze agent loop, which streams model outputs, extracts the generated code, and executes it step by step. We allow the model to alternate between reasoning, coding, execution feedback, and final answering through special action tags. We maintain the full conversation trace so the agent can refine its analysis based on previous outputs and execution results. Running the E-Commerce Analysis Workspace Copy CodeCopiedUse a different Browser def _hsize(nbytes): for u in [&#8220;B&#8221;, &#8220;KB&#8221;, &#8220;MB&#8221;, &#8220;GB&#8221;]: if nbytes &lt; 1024: return f&#8221;{nbytes:.1f}{u}&#8221; nbytes \/= 1024 return f&#8221;{nbytes:.1f}TB&#8221; def build_prompt(instruction, workspace): exts = (&#8220;.csv&#8221;, &#8220;.xlsx&#8221;, &#8220;.xls&#8221;, &#8220;.json&#8221;, &#8220;.xml&#8221;, &#8220;.yaml&#8221;, &#8220;.yml&#8221;, &#8220;.txt&#8221;, &#8220;.md&#8221;, &#8220;.tsv&#8221;, &#8220;.db&#8221;, &#8220;.sqlite&#8221;) files = sorted(f for f in os.listdir(workspace) if f.lower().endswith(exts)) lines = [f&#8217;File {i+1}: {{&#8220;name&#8221;: &#8220;{f}&#8221;, &#8220;size&#8221;: &#8220;&#8216; f'{_hsize(os.path.getsize(os.path.join(workspace, f)))}&#8221;}}&#8217; for i, f in enumerate(files)] return f&#8221;# Instructionn{instruction}nn# Datan&#8221; + &#8220;n&#8221;.join(lines) WORKSPACE = &#8220;\/content\/da_workspace&#8221; os.makedirs(WORKSPACE, exist_ok=True) rng = np.random.default_rng(42); N = 2500 categories = [&#8220;Electronics&#8221;, &#8220;Home&#8221;, &#8220;Fashion&#8221;, &#8220;Books&#8221;, &#8220;Toys&#8221;] dates = pd.to_datetime(&#8220;2024-01-01&#8243;) + pd.to_timedelta(rng.integers(0, 365, N), unit=&#8221;D&#8221;) tx = pd.DataFrame({ &#8220;order_id&#8221;: np.arange(100000, 100000 + N), &#8220;date&#8221;: dates, &#8220;customer_id&#8221;: rng.integers(1, 601, N), &#8220;category&#8221;: rng.choice(categories, N, p=[.3, .2, .25, .15, .1]), &#8220;region&#8221;: rng.choice([&#8220;North&#8221;, &#8220;South&#8221;, &#8220;East&#8221;, &#8220;West&#8221;], N), &#8220;quantity&#8221;: rng.integers(1, 6, N), &#8220;unit_price&#8221;: np.round(rng.gamma(3, 12, N) + 5, 2), &#8220;discount&#8221;: np.round(rng.choice([0, .05, .1, .15, .2], N), 2), }) tx[&#8220;revenue&#8221;] = np.round(tx.quantity *<\/p>","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"pmpro_default_level":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_pvb_checkbox_block_on_post":false,"footnotes":""},"categories":[52,5,7,1],"tags":[],"class_list":["post-103702","post","type-post","status-publish","format-standard","hentry","category-ai-club","category-committee","category-news","category-uncategorized","pmpro-has-access"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Build a T4-Friendly Autonomous Data Science Agent with DeepAnalyze-8B, Sandboxed Code Execution, and Iterative Analysis - YouZum<\/title>\n<meta name=\"description\" content=\"\u0e01\u0e34\u0e08\u0e01\u0e23\u0e23\u0e21\u0e40\u0e01\u0e35\u0e48\u0e22\u0e27\u0e01\u0e31\u0e1a\u0e42\u0e14\u0e23\u0e19\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/youzum.net\/zh\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Build a T4-Friendly Autonomous Data Science Agent with DeepAnalyze-8B, Sandboxed Code Execution, and Iterative Analysis - YouZum\" \/>\n<meta property=\"og:description\" content=\"\u0e01\u0e34\u0e08\u0e01\u0e23\u0e23\u0e21\u0e40\u0e01\u0e35\u0e48\u0e22\u0e27\u0e01\u0e31\u0e1a\u0e42\u0e14\u0e23\u0e19\" \/>\n<meta property=\"og:url\" content=\"https:\/\/youzum.net\/zh\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/\" \/>\n<meta property=\"og:site_name\" content=\"YouZum\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DroneAssociationTH\/\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-12T19:14:12+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/s.w.org\/images\/core\/emoji\/17.0.2\/72x72\/1f4ca.png\" \/>\n<meta name=\"author\" content=\"admin NU\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin NU\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/\"},\"author\":{\"name\":\"admin NU\",\"@id\":\"https:\/\/yousum.gpucore.co\/#\/schema\/person\/97fa48242daf3908e4d9a5f26f4a059c\"},\"headline\":\"How to Build a T4-Friendly Autonomous Data Science Agent with DeepAnalyze-8B, Sandboxed Code Execution, and Iterative Analysis\",\"datePublished\":\"2026-07-12T19:14:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/\"},\"wordCount\":661,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/yousum.gpucore.co\/#organization\"},\"image\":{\"@id\":\"https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/s.w.org\/images\/core\/emoji\/17.0.2\/72x72\/1f4ca.png\",\"articleSection\":[\"AI\",\"Committee\",\"News\",\"Uncategorized\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/\",\"url\":\"https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/\",\"name\":\"How to Build a T4-Friendly Autonomous Data Science Agent with DeepAnalyze-8B, Sandboxed Code Execution, and Iterative Analysis - YouZum\",\"isPartOf\":{\"@id\":\"https:\/\/yousum.gpucore.co\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/s.w.org\/images\/core\/emoji\/17.0.2\/72x72\/1f4ca.png\",\"datePublished\":\"2026-07-12T19:14:12+00:00\",\"description\":\"\u0e01\u0e34\u0e08\u0e01\u0e23\u0e23\u0e21\u0e40\u0e01\u0e35\u0e48\u0e22\u0e27\u0e01\u0e31\u0e1a\u0e42\u0e14\u0e23\u0e19\",\"breadcrumb\":{\"@id\":\"https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/#primaryimage\",\"url\":\"https:\/\/s.w.org\/images\/core\/emoji\/17.0.2\/72x72\/1f4ca.png\",\"contentUrl\":\"https:\/\/s.w.org\/images\/core\/emoji\/17.0.2\/72x72\/1f4ca.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/youzum.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Build a T4-Friendly Autonomous Data Science Agent with DeepAnalyze-8B, Sandboxed Code Execution, and Iterative Analysis\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/yousum.gpucore.co\/#website\",\"url\":\"https:\/\/yousum.gpucore.co\/\",\"name\":\"YouSum\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/yousum.gpucore.co\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/yousum.gpucore.co\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/yousum.gpucore.co\/#organization\",\"name\":\"Drone Association Thailand\",\"url\":\"https:\/\/yousum.gpucore.co\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/yousum.gpucore.co\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/youzum.net\/wp-content\/uploads\/2024\/11\/tranparent-logo.png\",\"contentUrl\":\"https:\/\/youzum.net\/wp-content\/uploads\/2024\/11\/tranparent-logo.png\",\"width\":300,\"height\":300,\"caption\":\"Drone Association Thailand\"},\"image\":{\"@id\":\"https:\/\/yousum.gpucore.co\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/DroneAssociationTH\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/yousum.gpucore.co\/#\/schema\/person\/97fa48242daf3908e4d9a5f26f4a059c\",\"name\":\"admin NU\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/yousum.gpucore.co\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/youzum.net\/wp-content\/uploads\/avatars\/2\/1746849356-bpfull.png\",\"contentUrl\":\"https:\/\/youzum.net\/wp-content\/uploads\/avatars\/2\/1746849356-bpfull.png\",\"caption\":\"admin NU\"},\"url\":\"https:\/\/youzum.net\/zh\/members\/adminnu\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Build a T4-Friendly Autonomous Data Science Agent with DeepAnalyze-8B, Sandboxed Code Execution, and Iterative Analysis - YouZum","description":"\u0e01\u0e34\u0e08\u0e01\u0e23\u0e23\u0e21\u0e40\u0e01\u0e35\u0e48\u0e22\u0e27\u0e01\u0e31\u0e1a\u0e42\u0e14\u0e23\u0e19","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/youzum.net\/zh\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/","og_locale":"zh_CN","og_type":"article","og_title":"How to Build a T4-Friendly Autonomous Data Science Agent with DeepAnalyze-8B, Sandboxed Code Execution, and Iterative Analysis - YouZum","og_description":"\u0e01\u0e34\u0e08\u0e01\u0e23\u0e23\u0e21\u0e40\u0e01\u0e35\u0e48\u0e22\u0e27\u0e01\u0e31\u0e1a\u0e42\u0e14\u0e23\u0e19","og_url":"https:\/\/youzum.net\/zh\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/","og_site_name":"YouZum","article_publisher":"https:\/\/www.facebook.com\/DroneAssociationTH\/","article_published_time":"2026-07-12T19:14:12+00:00","og_image":[{"url":"https:\/\/s.w.org\/images\/core\/emoji\/17.0.2\/72x72\/1f4ca.png","type":"","width":"","height":""}],"author":"admin NU","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin NU","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"9 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/#article","isPartOf":{"@id":"https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/"},"author":{"name":"admin NU","@id":"https:\/\/yousum.gpucore.co\/#\/schema\/person\/97fa48242daf3908e4d9a5f26f4a059c"},"headline":"How to Build a T4-Friendly Autonomous Data Science Agent with DeepAnalyze-8B, Sandboxed Code Execution, and Iterative Analysis","datePublished":"2026-07-12T19:14:12+00:00","mainEntityOfPage":{"@id":"https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/"},"wordCount":661,"commentCount":0,"publisher":{"@id":"https:\/\/yousum.gpucore.co\/#organization"},"image":{"@id":"https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/#primaryimage"},"thumbnailUrl":"https:\/\/s.w.org\/images\/core\/emoji\/17.0.2\/72x72\/1f4ca.png","articleSection":["AI","Committee","News","Uncategorized"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/","url":"https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/","name":"How to Build a T4-Friendly Autonomous Data Science Agent with DeepAnalyze-8B, Sandboxed Code Execution, and Iterative Analysis - YouZum","isPartOf":{"@id":"https:\/\/yousum.gpucore.co\/#website"},"primaryImageOfPage":{"@id":"https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/#primaryimage"},"image":{"@id":"https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/#primaryimage"},"thumbnailUrl":"https:\/\/s.w.org\/images\/core\/emoji\/17.0.2\/72x72\/1f4ca.png","datePublished":"2026-07-12T19:14:12+00:00","description":"\u0e01\u0e34\u0e08\u0e01\u0e23\u0e23\u0e21\u0e40\u0e01\u0e35\u0e48\u0e22\u0e27\u0e01\u0e31\u0e1a\u0e42\u0e14\u0e23\u0e19","breadcrumb":{"@id":"https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/"]}]},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/#primaryimage","url":"https:\/\/s.w.org\/images\/core\/emoji\/17.0.2\/72x72\/1f4ca.png","contentUrl":"https:\/\/s.w.org\/images\/core\/emoji\/17.0.2\/72x72\/1f4ca.png"},{"@type":"BreadcrumbList","@id":"https:\/\/youzum.net\/how-to-build-a-t4-friendly-autonomous-data-science-agent-with-deepanalyze-8b-sandboxed-code-execution-and-iterative-analysis\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/youzum.net\/"},{"@type":"ListItem","position":2,"name":"How to Build a T4-Friendly Autonomous Data Science Agent with DeepAnalyze-8B, Sandboxed Code Execution, and Iterative Analysis"}]},{"@type":"WebSite","@id":"https:\/\/yousum.gpucore.co\/#website","url":"https:\/\/yousum.gpucore.co\/","name":"YouSum","description":"","publisher":{"@id":"https:\/\/yousum.gpucore.co\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/yousum.gpucore.co\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":"Organization","@id":"https:\/\/yousum.gpucore.co\/#organization","name":"Drone Association Thailand","url":"https:\/\/yousum.gpucore.co\/","logo":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/yousum.gpucore.co\/#\/schema\/logo\/image\/","url":"https:\/\/youzum.net\/wp-content\/uploads\/2024\/11\/tranparent-logo.png","contentUrl":"https:\/\/youzum.net\/wp-content\/uploads\/2024\/11\/tranparent-logo.png","width":300,"height":300,"caption":"Drone Association Thailand"},"image":{"@id":"https:\/\/yousum.gpucore.co\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DroneAssociationTH\/"]},{"@type":"Person","@id":"https:\/\/yousum.gpucore.co\/#\/schema\/person\/97fa48242daf3908e4d9a5f26f4a059c","name":"admin NU","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/yousum.gpucore.co\/#\/schema\/person\/image\/","url":"https:\/\/youzum.net\/wp-content\/uploads\/avatars\/2\/1746849356-bpfull.png","contentUrl":"https:\/\/youzum.net\/wp-content\/uploads\/avatars\/2\/1746849356-bpfull.png","caption":"admin NU"},"url":"https:\/\/youzum.net\/zh\/members\/adminnu\/"}]}},"rttpg_featured_image_url":null,"rttpg_author":{"display_name":"admin NU","author_link":"https:\/\/youzum.net\/zh\/members\/adminnu\/"},"rttpg_comment":0,"rttpg_category":"<a href=\"https:\/\/youzum.net\/zh\/category\/ai-club\/\" rel=\"category tag\">AI<\/a> <a href=\"https:\/\/youzum.net\/zh\/category\/committee\/\" rel=\"category tag\">Committee<\/a> <a href=\"https:\/\/youzum.net\/zh\/category\/news\/\" rel=\"category tag\">News<\/a> <a href=\"https:\/\/youzum.net\/zh\/category\/uncategorized\/\" rel=\"category tag\">Uncategorized<\/a>","rttpg_excerpt":"In this tutorial, we build an autonomous data science agent around DeepAnalyze-8B and run it. We begin by preparing a stable runtime, installing the required machine-learning dependencies, and loading the DeepAnalyze tokenizer and model in 4-bit mode to keep the workflow practical on limited GPU memory. We then create a sandboxed execution environment that allows&hellip;","_links":{"self":[{"href":"https:\/\/youzum.net\/zh\/wp-json\/wp\/v2\/posts\/103702","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/youzum.net\/zh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/youzum.net\/zh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/youzum.net\/zh\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/youzum.net\/zh\/wp-json\/wp\/v2\/comments?post=103702"}],"version-history":[{"count":0,"href":"https:\/\/youzum.net\/zh\/wp-json\/wp\/v2\/posts\/103702\/revisions"}],"wp:attachment":[{"href":"https:\/\/youzum.net\/zh\/wp-json\/wp\/v2\/media?parent=103702"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/youzum.net\/zh\/wp-json\/wp\/v2\/categories?post=103702"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/youzum.net\/zh\/wp-json\/wp\/v2\/tags?post=103702"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}