<?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: Yura Dubinin</title>
    <description>The latest articles on DEV Community by Yura Dubinin (@yura_build).</description>
    <link>https://dev.to/yura_build</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4073661%2F3acf3a81-d1c5-4a50-bfd0-70062f090746.png</url>
      <title>DEV Community: Yura Dubinin</title>
      <link>https://dev.to/yura_build</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yura_build"/>
    <language>en</language>
    <item>
      <title>Claude Code sandbox: built-in isolation, Docker and cloud</title>
      <dc:creator>Yura Dubinin</dc:creator>
      <pubDate>Sat, 17 Oct 2026 23:49:42 +0000</pubDate>
      <link>https://dev.to/yuraoak/claude-code-sandbox-built-in-isolation-docker-and-cloud-4539</link>
      <guid>https://dev.to/yuraoak/claude-code-sandbox-built-in-isolation-docker-and-cloud-4539</guid>
      <description>&lt;p&gt;A Claude Code sandbox limits what the agent can access while it works. You can enable the built-in shell sandbox with &lt;code&gt;/sandbox&lt;/code&gt;, run Claude Code inside a Docker container, or give it a separate cloud machine. The right choice depends on which files, processes and credentials the session needs.&lt;/p&gt;

&lt;p&gt;For local work, start with the built-in sandbox. For a repeatable development setup, use a dev container. For remote jobs or several agents working at once, a cloud sandbox gives each task its own workspace.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does the built-in Claude Code sandbox protect?
&lt;/h2&gt;

&lt;p&gt;Claude Code uses operating system controls to restrict its shell tool and the processes that tool starts. It uses Seatbelt on macOS and bubblewrap on Linux. The sandbox can limit writes to files and restrict network access through an allowed-domain proxy.&lt;/p&gt;

&lt;p&gt;That scope matters when you add tools. Claude Code's built-in file tools, hooks and local MCP servers sit outside the shell sandbox. To contain the whole agent process and its local tools, run them inside a container, a virtual machine or a separately configured sandbox runtime. A remote MCP service still has whatever permissions you gave that service. See the &lt;a href="https://code.claude.com/docs/en/sandboxing" rel="noopener noreferrer"&gt;Claude Code sandboxing documentation&lt;/a&gt;.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Setup&lt;/th&gt;
&lt;th&gt;What it contains&lt;/th&gt;
&lt;th&gt;What you still need to control&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Built-in Claude Code sandbox&lt;/td&gt;
&lt;td&gt;Shell commands and their child processes&lt;/td&gt;
&lt;td&gt;File tools, hooks, MCP services, readable paths and allowed domains&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Docker dev container&lt;/td&gt;
&lt;td&gt;Processes and files inside the container&lt;/td&gt;
&lt;td&gt;Host mounts, Docker socket access, privileges and network policy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cloud workspace&lt;/td&gt;
&lt;td&gt;Agent processes on a separate machine or runtime&lt;/td&gt;
&lt;td&gt;Uploaded data, credentials, network access and the workspace's actual isolation boundary&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Enable Claude Code sandbox mode
&lt;/h2&gt;

&lt;p&gt;On macOS, Claude Code uses the system's existing sandbox support. On Linux or WSL2, install the required packages first. For a Debian or Ubuntu system:&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;bubblewrap socat
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Start Claude Code in your project and enter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/sandbox
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Choose the mode that fits your review process. Auto-allow mode lets sandboxed shell commands run without an approval prompt. Regular permissions keep the usual approval flow while the shell sandbox stays active. Native Windows needs WSL2 for this sandbox. The &lt;a href="https://code.claude.com/docs/en/sandboxing" rel="noopener noreferrer"&gt;setup guide&lt;/a&gt; lists platform requirements and restrictions.&lt;/p&gt;

&lt;p&gt;For a session that must keep shell commands inside the sandbox, start Claude Code with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude &lt;span class="nt"&gt;--settings&lt;/span&gt; &lt;span class="s1"&gt;'{"sandbox":{"enabled":true,"allowUnsandboxedCommands":false,"failIfUnavailable":true}}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;allowUnsandboxedCommands: false&lt;/code&gt; disables the escape path for commands that would otherwise run outside the sandbox. &lt;code&gt;failIfUnavailable: true&lt;/code&gt; makes startup fail if sandbox support is missing. Review any excluded commands in your settings as well. File reads remain broad by default; add read restrictions if the session must not see files elsewhere on your machine.&lt;/p&gt;

&lt;h3&gt;
  
  
  Check the boundary before a long run
&lt;/h3&gt;

&lt;p&gt;Ask Claude to execute these commands through its shell tool:&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;touch&lt;/span&gt; ~/sandbox-probe
curl &lt;span class="nt"&gt;--noproxy&lt;/span&gt; &lt;span class="s1"&gt;'*'&lt;/span&gt; https://example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the test from a project folder below your home directory. With the intended restrictions, the first command should fail because it writes outside that project. The second tests whether a command can bypass the network proxy. It should fail when direct network access is blocked. A permitted request through the proxy can still succeed.&lt;/p&gt;

&lt;p&gt;Have Claude execute the checks. Typing a command manually in a separate terminal does not test the agent's shell sandbox.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sandbox mode, auto mode and skipping permissions
&lt;/h2&gt;

&lt;p&gt;Permission modes decide when Claude asks for approval. Sandboxing controls what the operating system lets a command do.&lt;/p&gt;

&lt;p&gt;Claude Code's &lt;strong&gt;auto mode&lt;/strong&gt; uses a classifier to decide which actions can proceed. That differs from the shell sandbox's auto-allow mode. Check &lt;a href="https://code.claude.com/docs/en/permission-modes" rel="noopener noreferrer"&gt;permission modes&lt;/a&gt; before changing either setting.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;--dangerously-skip-permissions&lt;/code&gt; bypasses routine permission prompts. It does not create a container, restrict file access or set a network policy. Explicit deny rules and some checks can still apply. If you use it for unattended work, configure and test the surrounding isolation first. Our &lt;a href="https://lizard.build/blog/dangerously-skip-permissions" rel="noopener noreferrer"&gt;guide to dangerously-skip-permissions&lt;/a&gt; covers that workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run Claude Code in Docker
&lt;/h2&gt;

&lt;p&gt;A dev container gives the team the same starting environment and keeps the agent's processes inside a container. Install Docker and use an editor with Dev Containers support. Add this file at &lt;code&gt;.devcontainer/devcontainer.json&lt;/code&gt; in your project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"image"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"mcr.microsoft.com/devcontainers/base:ubuntu"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"remoteUser"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"vscode"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"features"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"ghcr.io/devcontainers/features/node:1"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"22"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"ghcr.io/anthropics/devcontainer-features/claude-code:1.0"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open the project in the container, let it build, then run &lt;code&gt;claude&lt;/code&gt; in its terminal and sign in. This configuration installs Claude Code and Node.js 22. Add any other runtimes and dependencies your project needs. The feature version does not pin the Claude Code release it installs.&lt;/p&gt;

&lt;p&gt;We tested a clean build of this exact configuration. Claude then fixed an intentionally failing Node.js test, and a separate &lt;code&gt;node --test&lt;/code&gt; run passed. Explicitly including the Node.js feature matters: our first clean build with only the Claude Code feature failed while installing Node.js and npm.&lt;/p&gt;

&lt;p&gt;Check the mounts before handing the agent work. A writable project mount lets it change the files on your host. Avoid mounting your home directory, production credentials or the host's Docker socket. This minimal config does not add a network allowlist. See Anthropic's &lt;a href="https://code.claude.com/docs/en/devcontainer" rel="noopener noreferrer"&gt;dev container guide&lt;/a&gt; and Docker's &lt;a href="https://docs.docker.com/engine/security/" rel="noopener noreferrer"&gt;security documentation&lt;/a&gt; for the controls your setup needs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Docker containers and Docker Sandboxes differ
&lt;/h3&gt;

&lt;p&gt;Docker also offers a product called Docker Sandboxes. Its documented architecture uses microVMs and an isolated Docker daemon. An ordinary dev container does not gain those properties just because it uses Docker. Workspace synchronization also depends on the Docker Sandboxes mode you choose. Read its &lt;a href="https://docs.docker.com/ai/sandboxes/architecture/" rel="noopener noreferrer"&gt;architecture&lt;/a&gt; and &lt;a href="https://docs.docker.com/ai/sandboxes/security/" rel="noopener noreferrer"&gt;security model&lt;/a&gt; before treating the two setups as equivalent.&lt;/p&gt;

&lt;h2&gt;
  
  
  When a cloud sandbox helps
&lt;/h2&gt;

&lt;p&gt;A remote workspace helps when the task must keep running after your laptop disconnects, when agents need separate working trees, or when your application creates a workspace for each user. You can copy in a repository, run the agent, inspect its changes and retrieve the files you want to keep.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://lizard.build/sandboxes" rel="noopener noreferrer"&gt;Lizard Sandboxes&lt;/a&gt; supports Firecracker microVMs. Legacy resources, account or region settings, and some startup fallbacks can use containers. Check the &lt;code&gt;runtime&lt;/code&gt; returned by your sandbox instead of assuming every resource uses Firecracker. The Lizard SDK exposes it through &lt;code&gt;getInfo().runtime&lt;/code&gt;; our CLI creation response also reported &lt;code&gt;firecracker&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A separate machine keeps the job away from files you have not shared from your laptop. Credentials and files you do put inside that machine remain available to code running there. Set their scope to match the task.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run Claude Code in Lizard Sandboxes
&lt;/h2&gt;

&lt;p&gt;Install &lt;a href="https://lizard.build/docs/cli/" rel="noopener noreferrer"&gt;Lizard CLI&lt;/a&gt;, sign in and choose a project. You need an Anthropic API key or a supported Claude subscription token for the model calls.&lt;/p&gt;

&lt;p&gt;To register an Anthropic API key, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lizard agents add anthropic
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a Claude subscription, create a token and register it with Lizard CLI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude setup-token
lizard agents add claude
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Paste the credential at the prompt. Keep it out of your repository and command history. The commands below assume registration has succeeded; our live test used an existing Claude subscription token.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create the workspace
&lt;/h3&gt;

&lt;p&gt;Replace &lt;code&gt;YOUR_PROJECT_ID&lt;/code&gt; with your project ID:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lizard sandbox create &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--project&lt;/span&gt; YOUR_PROJECT_ID &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--template&lt;/span&gt; claude &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--size&lt;/span&gt; small &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--timeout&lt;/span&gt; 3600000 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--json&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Set &lt;code&gt;SB&lt;/code&gt; to the sandbox ID in that response:&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="nv"&gt;SB&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;YOUR_SANDBOX_ID
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The timeout here gives the workspace a one-hour lifetime. The default is five minutes, and running commands does not extend it. Set enough time for the job and save your work before it expires. See the &lt;a href="https://lizard.build/docs/cli/sandbox/" rel="noopener noreferrer"&gt;CLI reference&lt;/a&gt; for lifecycle commands.&lt;/p&gt;

&lt;h3&gt;
  
  
  Copy a committed repository without a GitHub token
&lt;/h3&gt;

&lt;p&gt;From the local repository, create a Git bundle and upload it:&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="nv"&gt;BUNDLE_DIR&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;mktemp&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
git bundle create &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$BUNDLE_DIR&lt;/span&gt;&lt;span class="s2"&gt;/app.bundle"&lt;/span&gt; HEAD
lizard sandbox files put &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$SB&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$BUNDLE_DIR&lt;/span&gt;&lt;span class="s2"&gt;/app.bundle"&lt;/span&gt; /workspace/app.bundle
lizard sandbox &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$SB&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  git clone /workspace/app.bundle /workspace/app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The bundle includes committed history reachable from &lt;code&gt;HEAD&lt;/code&gt;. It excludes uncommitted and untracked files, but any secrets committed in that history still travel with it. Review the repository before transferring it. Cloning this bundle can leave the checkout at a detached &lt;code&gt;HEAD&lt;/code&gt;; you can still inspect the agent's edits and export changed files.&lt;/p&gt;

&lt;h3&gt;
  
  
  Give Claude a small task
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lizard sandbox prompt &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$SB&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--agent&lt;/span&gt; claude &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--cwd&lt;/span&gt; /workspace/app &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="s2"&gt;"Run the tests. Fix one failing test with the smallest reasonable change. Report what changed and which tests passed."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Keep &lt;code&gt;--agent claude&lt;/code&gt;: omitting the agent option can select the default agent instead. The Lizard runner uses permission bypass inside the remote workspace so the task can run without interactive prompts. The workspace boundary and the credentials you provide therefore need to match the task. Code inside it can read the model credential available to the process.&lt;/p&gt;

&lt;p&gt;In our test, a Python function subtracted two numbers when its test expected their sum. Claude changed that function, and an independent test run passed afterward.&lt;/p&gt;

&lt;h3&gt;
  
  
  Review and retrieve the result
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lizard sandbox &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$SB&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  git &lt;span class="nt"&gt;-C&lt;/span&gt; /workspace/app status &lt;span class="nt"&gt;--short&lt;/span&gt;
lizard sandbox &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$SB&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  git &lt;span class="nt"&gt;-C&lt;/span&gt; /workspace/app diff
lizard sandbox files get &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$SB&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; /workspace/app/path/to/changed-file ./changed-file.review
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;path/to/changed-file&lt;/code&gt; with the file you want to download. Run the project's tests yourself before merging the changes. We checked the remote diff, reran the test and downloaded the corrected file; its contents matched the remote result.&lt;/p&gt;

&lt;p&gt;When you have saved the result, pause the workspace:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lizard sandbox pause &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$SB&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Wait until its status is &lt;code&gt;paused&lt;/code&gt;. Successful pause stops compute billing. Export work before removing a sandbox, and use &lt;a href="https://lizard.build/docs/sandboxes/" rel="noopener noreferrer"&gt;Persistent Volumes&lt;/a&gt; when data must survive the sandbox's deletion. Stored data can still incur charges.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does the cloud workspace cost?
&lt;/h2&gt;

&lt;p&gt;Lizard's published compute rates on 18 October 2026 were:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Size&lt;/th&gt;
&lt;th&gt;CPU and memory&lt;/th&gt;
&lt;th&gt;Compute per hour&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Small&lt;/td&gt;
&lt;td&gt;2 vCPU, 4 GB&lt;/td&gt;
&lt;td&gt;$0.0162&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;4 vCPU, 8 GB&lt;/td&gt;
&lt;td&gt;$0.0324&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Large&lt;/td&gt;
&lt;td&gt;8 vCPU, 16 GB&lt;/td&gt;
&lt;td&gt;$0.0648&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;At the Small rate, 100 sandbox-hours consume $1.62 of compute usage. Model calls, storage and any other billed resources are separate.&lt;/p&gt;

&lt;p&gt;Lizard Pro costs $19 a month, taxes included, and includes $19 of usage. Usage above that amount is pay as you go. New accounts get a seven-day trial with $5 of usage; a card is required. Claude subscription or Anthropic API charges are separate from Lizard charges. Check the current &lt;a href="https://lizard.build/pricing" rel="noopener noreferrer"&gt;pricing&lt;/a&gt; before sizing a job.&lt;/p&gt;

&lt;p&gt;A running sandbox still consumes compute while idle. Pause it successfully when you are done; Persistent Volumes storage can remain billable while compute is paused.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common setup problems
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Problem&lt;/th&gt;
&lt;th&gt;What to check&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Native sandbox cannot start on Linux&lt;/td&gt;
&lt;td&gt;Install bubblewrap and socat, then restart Claude Code. Check the host's namespace restrictions.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A needed domain is blocked&lt;/td&gt;
&lt;td&gt;Add only the required host to the allowlist and retry through the proxy.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;bubblewrap fails inside a container&lt;/td&gt;
&lt;td&gt;Nested sandboxing depends on the host and container configuration. Follow the supported setup rather than silently disabling isolation.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Host files change during a Docker run&lt;/td&gt;
&lt;td&gt;Check writable mounts. A mounted repository shares those edits with the host.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The wrong agent starts in Lizard&lt;/td&gt;
&lt;td&gt;Pass &lt;code&gt;--agent claude&lt;/code&gt; explicitly.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A cloud job ends before it finishes&lt;/td&gt;
&lt;td&gt;Set a suitable lifetime and save results before expiry. Commands do not reset the lifetime.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  What we tested
&lt;/h2&gt;

&lt;p&gt;On 18 October 2026, we ran Claude Code 2.1.286 on macOS and in a fresh Small Firecracker sandbox through Lizard CLI 4.0.58. The macOS check allowed a workspace write and blocked both a write outside the project and a direct network request that bypassed the proxy.&lt;/p&gt;

&lt;p&gt;The cloud test covered Git bundle upload, cloning, Claude fixing a failing Python test, an independent test rerun, diff review, file download and pause. We confirmed the sandbox reached &lt;code&gt;paused&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The Docker test used Docker Engine 28.1.1 on ARM64, Dev Containers CLI 0.89.0, Node.js 22.23.3 and Claude Code 2.1.302. The corrected config built from a clean container, and Claude fixed a failing Node.js test that passed on a separate rerun. We also verified the Linux package installation command.&lt;/p&gt;

&lt;p&gt;Authentication used an existing Claude subscription token. We did not repeat initial OAuth enrollment or test native Windows/WSL isolation. These checks cover the commands and outcomes described here; they are not a security audit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which setup should you choose?
&lt;/h2&gt;

&lt;p&gt;Start with the built-in Claude Code sandbox for local shell tasks where you can define the needed paths and domains. Use a dev container when your team needs a shared development setup. Choose a cloud workspace when tasks need remote compute or separate environments for concurrent agents.&lt;/p&gt;

&lt;p&gt;For a first Lizard run, copy a small repository, ask Claude to fix one failing test, review the diff and pause the workspace. The &lt;a href="https://lizard.build/docs/sandboxes/guides/claude-code/" rel="noopener noreferrer"&gt;Claude Code guide&lt;/a&gt; has the current setup steps.&lt;/p&gt;




&lt;p&gt;Originally published on the &lt;a href="https://lizard.build/blog/claude-code-sandbox" rel="noopener noreferrer"&gt;Lizard blog&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>claudecode</category>
    </item>
    <item>
      <title>Codex Cloud: setup, pricing, limits and deployment</title>
      <dc:creator>Yura Dubinin</dc:creator>
      <pubDate>Fri, 16 Oct 2026 20:48:58 +0000</pubDate>
      <link>https://dev.to/yuraoak/codex-cloud-setup-pricing-limits-and-deployment-3hhm</link>
      <guid>https://dev.to/yuraoak/codex-cloud-setup-pricing-limits-and-deployment-3hhm</guid>
      <description>&lt;p&gt;Originally published on &lt;a href="https://lizard.build/blog/codex-cloud" rel="noopener noreferrer"&gt;Lizard (lizard.build)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Codex Cloud runs coding tasks on computers managed by OpenAI. You connect your repositories, prepare a reusable environment, and give Codex a task. It can edit files and run tests while your laptop is asleep. You return to review the changes, ask for fixes, and open a pull request.&lt;/p&gt;

&lt;p&gt;For &lt;strong&gt;Codex Cloud login&lt;/strong&gt;, sign in to &lt;a href="https://chatgpt.com/" rel="noopener noreferrer"&gt;ChatGPT&lt;/a&gt;. On the web or desktop app, choose &lt;strong&gt;Work in &amp;gt; Cloud&lt;/strong&gt;. On mobile, open &lt;strong&gt;Codex&lt;/strong&gt; and select an environment you have already published.&lt;/p&gt;

&lt;p&gt;Start with a small change and test results you can check before giving Codex a larger job.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw3t97cvg6a8v80n86prx.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw3t97cvg6a8v80n86prx.webp" alt="Codex Cloud illustration showing a reusable environment and separate coding workspaces" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What we tested
&lt;/h2&gt;

&lt;p&gt;On October 17, 2026, we ran the setup and &lt;code&gt;/healthz&lt;/code&gt; prompts below with Codex CLI 0.159.2 in a Small Firecracker sandbox on Lizard. The fixture used Node.js 22.23.2 and npm 10.9.8. Codex installed from the lockfile, added the endpoint, and passed both tests: the new HTTP 200 response and the existing 404 response. The project's build command checked JavaScript syntax and passed.&lt;/p&gt;

&lt;p&gt;We also confirmed that &lt;code&gt;codex cloud list --limit 5&lt;/code&gt; authenticated and returned exit code 0. We checked the submission command's flags with &lt;code&gt;--help&lt;/code&gt;. We did not submit an OpenAI Cloud task or create an environment in its web interface; those steps follow OpenAI's documentation.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does Codex Cloud do?
&lt;/h2&gt;

&lt;p&gt;Codex can inspect a repository, investigate a bug, change code, and run the project's tools. A cloud environment holds the prepared repositories, dependencies, and access settings. Each new task starts in its own workspace.&lt;/p&gt;

&lt;p&gt;This suits work you can describe and verify: fix a failing test, add an API endpoint, or update a dependency and check the build. For a change that needs several rounds of review, continue in the same task so Codex keeps its working files.&lt;/p&gt;

&lt;p&gt;OpenAI distinguishes this workflow from remote access to an agent running on your own computer. Cloud tasks use OpenAI's computers and can continue while your machine sleeps. See the &lt;a href="https://help.openai.com/en/articles/20001545-using-codex-cloud" rel="noopener noreferrer"&gt;Codex Cloud overview&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to set up Codex Cloud
&lt;/h2&gt;

&lt;p&gt;Use the web or desktop app to create an environment. Have your GitHub repository, its build instructions, and any required development credentials ready.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Connect your repository
&lt;/h3&gt;

&lt;p&gt;Choose &lt;strong&gt;Work in &amp;gt; Cloud &amp;gt; Select environment &amp;gt; Create environment&lt;/strong&gt;. Connect GitHub if prompted, select the repositories the project needs, and choose &lt;strong&gt;Get started&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For the first setup, pick a repository whose tests you already know how to run. That gives you a result to compare with the cloud setup.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Prepare and check the tools
&lt;/h3&gt;

&lt;p&gt;Codex inspects the project, installs dependencies and tools, and checks the workflow. Supply missing details when it asks. Specify the runtime version if your project depends on one.&lt;/p&gt;

&lt;p&gt;For a Node.js project, you could ask:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Prepare this repository for development. Use the Node.js version and
package manager specified by the project. Install dependencies from the
lockfile, identify the test and build commands, and run both.

Report each command and its result. If a check fails, show the error and
explain what needs to change before I publish this environment.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The setup can record an &lt;strong&gt;Install script&lt;/strong&gt; for dependencies and a &lt;strong&gt;Start skill&lt;/strong&gt; for starting services and checking readiness. Review those commands, especially if the project needs a database or private package registry.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Publish the environment
&lt;/h3&gt;

&lt;p&gt;Review the setup report and resolve failed checks. Save the configuration, then select &lt;strong&gt;Publish&lt;/strong&gt;. Wait for &lt;strong&gt;Environment published&lt;/strong&gt; before starting a task.&lt;/p&gt;

&lt;p&gt;Saving stores configuration. Publishing captures the prepared filesystem for new tasks. Sharing controls who can use the environment. These are separate actions in the &lt;a href="https://learn.chatgpt.com/docs/environments/cloud-environments#create-and-publish-an-environment" rel="noopener noreferrer"&gt;current cloud environment workflow&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Give Codex one testable change
&lt;/h3&gt;

&lt;p&gt;Start a new task from the published environment. Describe the expected behavior and how to check it. For example, adapt this prompt to a web API repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Add a GET /healthz endpoint using this project's existing routing style.
It should return HTTP 200 and JSON {"status":"ok"}.
The endpoint must not expose configuration or credentials.

Add a test that checks the status code and response body. Run that test
and the existing test suite. Show the commands, results, and changed files.
Do not deploy or change database schemas.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This prompt defines a small task. An HTTP response alone does not establish that the rest of the application works, so keep the existing suite in the acceptance criteria.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Review the result
&lt;/h3&gt;

&lt;p&gt;Read the diff and test output before accepting the change. Check that Codex ran the commands it reports and that the tests cover the requested behavior. Look for skipped checks and unrelated file changes.&lt;/p&gt;

&lt;p&gt;Ask for corrections in the same task, then commit the work or open a pull request. Run your normal CI checks before merging. A successful task response is one input to that review.&lt;/p&gt;

&lt;h2&gt;
  
  
  How environments and saved task files work
&lt;/h2&gt;

&lt;p&gt;An environment supplies the starting setup. A task accumulates its own changes after it starts.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Action&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Start a new task&lt;/td&gt;
&lt;td&gt;Get a separate workspace from the published setup&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Resume the same task&lt;/td&gt;
&lt;td&gt;Continue with that task's saved files and uncommitted changes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Edit and republish the environment&lt;/td&gt;
&lt;td&gt;Update the starting setup for new tasks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Return to an existing task after republishing&lt;/td&gt;
&lt;td&gt;Keep that task's own state&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;OpenAI documents a default recovery window of &lt;strong&gt;up to seven days&lt;/strong&gt; for saved VM state after the last turn starts or you resume the task. This is a VM recovery window, not a promise of continuous execution or a conversation-history retention period. Commit important work to Git. &lt;a href="https://help.openai.com/en/articles/20001545-using-codex-cloud" rel="noopener noreferrer"&gt;Saved-state details&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For example, suppose you install a missing tool during a task. That fixes the task you are working on. To make the tool part of future tasks, edit the environment, verify the installation, and republish it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Codex Cloud pricing and usage limits
&lt;/h2&gt;

&lt;p&gt;Cloud chats are part of eligible ChatGPT plans. OpenAI's published US prices, checked October 17, 2026, are:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Plan&lt;/th&gt;
&lt;th&gt;Published price&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Plus&lt;/td&gt;
&lt;td&gt;$20 per month&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pro&lt;/td&gt;
&lt;td&gt;$100, $200, or $500 per month&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Business&lt;/td&gt;
&lt;td&gt;$20 per user per month billed annually, with two or more users; $25 when billed monthly&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Enterprise and Edu&lt;/td&gt;
&lt;td&gt;Contact sales&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Free and Go have limited desktop Codex access in the pricing guide. Check cloud eligibility before choosing a plan. An OpenAI API key pays for supported API-based Codex workflows separately; API-key access does not include Codex Cloud features. &lt;a href="https://learn.chatgpt.com/docs/pricing" rel="noopener noreferrer"&gt;OpenAI pricing and feature availability&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There is no reliable conversion from a subscription price to a fixed number of cloud tasks. Model choice, task length, context, and tool use affect consumption. Local messages and cloud chats share the plan allowance, and ChatGPT Work also shares usage with Codex.&lt;/p&gt;

&lt;p&gt;OpenAI's local-message estimates are not cloud-task quotas. Check the &lt;a href="https://chatgpt.com/codex/settings/usage" rel="noopener noreferrer"&gt;usage dashboard&lt;/a&gt; for your remaining allowance and reset times. Eligible plans can buy additional credits. &lt;a href="https://learn.chatgpt.com/docs/pricing#what-are-the-usage-limits-for-my-plan" rel="noopener noreferrer"&gt;Usage-limit details&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Give tasks access to services and secrets
&lt;/h2&gt;

&lt;p&gt;A private registry needs both network access and a valid credential. Allowing its hostname only solves the network part.&lt;/p&gt;

&lt;p&gt;The current environment settings distinguish two ways to supply values:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Setting&lt;/th&gt;
&lt;th&gt;Use it when&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Environment variable&lt;/td&gt;
&lt;td&gt;A program needs to read the actual value directly&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Network secret&lt;/td&gt;
&lt;td&gt;A credential should reach an allowed HTTPS service through the proxy&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;With a network secret, programs receive a placeholder. The proxy substitutes the credential for matching requests to allowed destinations over HTTPS on port 443. Configure the exact domains and test a request during setup. &lt;a href="https://learn.chatgpt.com/docs/environments/cloud-environments#configure-environment-variables-and-network-secrets" rel="noopener noreferrer"&gt;Network secrets&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For a download failure, inspect the failed URL. A package registry and its download host may need separate allowlist entries. For an authentication failure, check the credential, its scope, and the destination. Keep development credentials limited to the services the task needs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Codex Cloud limits to check before a task
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://learn.chatgpt.com/docs/environments/cloud-environments#vm-specifications" rel="noopener noreferrer"&gt;cloud environment guide&lt;/a&gt; lists these default resources:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Plan group&lt;/th&gt;
&lt;th&gt;vCPUs&lt;/th&gt;
&lt;th&gt;Memory&lt;/th&gt;
&lt;th&gt;Disk&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Plus and Edu Plus&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;8 GiB&lt;/td&gt;
&lt;td&gt;8 GiB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pro, Business, and Enterprise&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;16 GiB&lt;/td&gt;
&lt;td&gt;32 GiB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Edu and Edu Pro&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;16 GiB&lt;/td&gt;
&lt;td&gt;32 GiB&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Enterprise customers can ask about larger VMs. Check disk use before running builds that download large dependencies or produce large artifacts.&lt;/p&gt;

&lt;p&gt;The same guide currently lists computer and browser use, GitLab, and self-hosted GitHub Enterprise Server as unsupported in the new cloud environment experience. Repository skills are available to tasks; personal skills from your local computer do not sync automatically. Check the &lt;a href="https://learn.chatgpt.com/docs/environments/cloud-environments#current-limitations" rel="noopener noreferrer"&gt;current limitations&lt;/a&gt; when planning a workflow.&lt;/p&gt;

&lt;p&gt;If your acceptance test needs browser interaction, arrange a separate browser-capable test environment. A passing unit test cannot show whether a button works in the rendered app.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why do some guides describe different behavior?
&lt;/h3&gt;

&lt;p&gt;OpenAI still documents &lt;strong&gt;Codex Cloud (Legacy)&lt;/strong&gt; for existing review and integration workflows. Older instructions may describe setup-only secrets or container caching. Use the new cloud environment settings for the workflow above, and check which experience an integration uses before applying legacy instructions. &lt;a href="https://help.openai.com/en/articles/20001545-using-codex-cloud" rel="noopener noreferrer"&gt;Legacy transition&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Codex Cloud vs Codex CLI
&lt;/h2&gt;

&lt;p&gt;The CLI is an interface you can run on your own computer or a remote machine. Codex Cloud supplies an OpenAI-managed workspace. The CLI can also submit tasks to Cloud.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Workflow&lt;/th&gt;
&lt;th&gt;Where commands run&lt;/th&gt;
&lt;th&gt;Useful for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Codex Cloud task&lt;/td&gt;
&lt;td&gt;OpenAI-managed VM&lt;/td&gt;
&lt;td&gt;Background work from a reusable project setup&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Codex CLI in a local checkout&lt;/td&gt;
&lt;td&gt;Your computer&lt;/td&gt;
&lt;td&gt;Work that needs your local files and tools&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Codex CLI on your own remote machine&lt;/td&gt;
&lt;td&gt;The machine you provide&lt;/td&gt;
&lt;td&gt;A runtime you configure and operate&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;To work with cloud tasks from a terminal, the &lt;a href="https://learn.chatgpt.com/docs/developer-commands?surface=cli" rel="noopener noreferrer"&gt;CLI reference&lt;/a&gt; documents &lt;code&gt;codex cloud&lt;/code&gt;, &lt;code&gt;codex cloud exec&lt;/code&gt;, and &lt;code&gt;codex cloud list&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;codex cloud
codex cloud &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;--env&lt;/span&gt; YOUR_ENVIRONMENT_ID &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="s2"&gt;"Run the project's tests and report failures. Do not change files."&lt;/span&gt;
codex cloud list &lt;span class="nt"&gt;--limit&lt;/span&gt; 5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;YOUR_ENVIRONMENT_ID&lt;/code&gt; with an environment available to your signed-in account. The installed CLI's &lt;code&gt;--help&lt;/code&gt; lists supported flags. The submission command starts cloud work; check the task's results afterward.&lt;/p&gt;

&lt;p&gt;For scripts that run Codex in the machine where the CLI is installed, see our &lt;a href="https://lizard.build/blog/codex-exec" rel="noopener noreferrer"&gt;codex exec deployment-check example&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where Lizard fits after a cloud task
&lt;/h2&gt;

&lt;p&gt;Once you accept a change, your application needs a deployment target. You may also need a browser to test the rendered app before releasing it.&lt;/p&gt;

&lt;p&gt;A practical sequence is to review the Codex Cloud diff, merge it through your normal checks, then deploy that commit to Lizard with &lt;a href="https://lizard.build/cli" rel="noopener noreferrer"&gt;Lizard CLI&lt;/a&gt;. Apps and databases run as separate resources and can keep running after a development sandbox stops.&lt;/p&gt;

&lt;p&gt;For a custom agent workflow, &lt;a href="https://lizard.build/sandboxes" rel="noopener noreferrer"&gt;Lizard Sandboxes&lt;/a&gt; provide a shell, files, and HTTPS previews. The &lt;code&gt;desktop&lt;/code&gt; template adds a desktop with a browser. Sandboxes use Firecracker microVMs, with a container fallback for older volumes or snapshots and failed Firecracker starts. Check &lt;code&gt;getInfo().runtime&lt;/code&gt; when that distinction matters.&lt;/p&gt;

&lt;p&gt;Running Codex CLI there is a workflow on infrastructure you control. You manage its credentials, process lifetime, and saved work, and pay for model usage under the relevant OpenAI terms. Lizard does not add capacity to your Codex Cloud allowance.&lt;/p&gt;

&lt;p&gt;Lizard Pro costs &lt;strong&gt;$19 per month and includes $19 of usage&lt;/strong&gt;. Small Sandboxes cost &lt;strong&gt;$0.0162 per hour&lt;/strong&gt; for 2 vCPU, 4 GB RAM, and 5 GB local disk, billed per second while running, including idle time. Usage beyond the included amount is pay as you go. Persistent Volumes cost extra. These are infrastructure charges; OpenAI model usage is separate. &lt;a href="https://lizard.build/pricing" rel="noopener noreferrer"&gt;Lizard pricing&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are building a product that creates a workspace for each customer, our &lt;a href="https://lizard.build/blog/build-lovable-clone" rel="noopener noreferrer"&gt;Lovable clone tutorial&lt;/a&gt; shows a tested Lizard SDK flow for code execution, private previews, and saving project files.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common setup problems
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Problem&lt;/th&gt;
&lt;th&gt;What to check first&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Cloud controls are missing&lt;/td&gt;
&lt;td&gt;The signed-in account, plan, selected workspace, and admin access settings&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GitHub is connected but a repository is missing&lt;/td&gt;
&lt;td&gt;Your GitHub permissions and the repositories selected for the environment&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Setup fails&lt;/td&gt;
&lt;td&gt;The first failed command in the setup conversation; fix it and rerun the check&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A dependency download fails&lt;/td&gt;
&lt;td&gt;The exact registry and download hostnames, then authentication&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;New tasks still lack a tool you installed&lt;/td&gt;
&lt;td&gt;Whether you updated and republished the reusable environment&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Uncommitted files seem to be missing&lt;/td&gt;
&lt;td&gt;Whether you reopened the original task rather than starting a new one&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Follow the &lt;a href="https://learn.chatgpt.com/docs/environments/cloud-environments#troubleshoot-setup-and-runtime-access" rel="noopener noreferrer"&gt;setup troubleshooting guide&lt;/a&gt; for the failing step. After a setup change, verify it in a new task from the republished environment.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>devops</category>
      <category>tutorial</category>
      <category>programming</category>
    </item>
    <item>
      <title>AI sandbox: isolation, code execution, and costs</title>
      <dc:creator>Yura Dubinin</dc:creator>
      <pubDate>Fri, 16 Oct 2026 20:48:50 +0000</pubDate>
      <link>https://dev.to/yuraoak/ai-sandbox-isolation-code-execution-and-costs-5dam</link>
      <guid>https://dev.to/yuraoak/ai-sandbox-isolation-code-execution-and-costs-5dam</guid>
      <description>&lt;p&gt;An &lt;strong&gt;AI sandbox&lt;/strong&gt; is an isolated environment where an AI agent can run code, install packages, and work with files. Its job is to limit what that code can reach: the host machine, other users' work, credentials, and external services.&lt;/p&gt;

&lt;p&gt;Before choosing a runtime for your agent, check how it isolates code, whether it supports your workload, and what it charges while running. This guide explains those choices and shows a small execution flow with Lizard SDK.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is an AI sandbox?
&lt;/h2&gt;

&lt;p&gt;In an agent application, the model proposes an action and your application decides where and how to run it. A sandbox supplies the computer for actions that need code execution. The model might write a Python script, edit a repository, or start a web app there.&lt;/p&gt;

&lt;p&gt;The term also describes business programs for testing AI products. Here, it means the runtime that executes an agent's code.&lt;/p&gt;

&lt;p&gt;The runtime needs more than a folder for each user. A useful design separates processes and files, caps CPU and memory, and gives the application a way to stop work. Credentials, network access, and persistent storage need their own rules.&lt;/p&gt;

&lt;p&gt;For example, an agent that analyzes an uploaded CSV should receive that file and enough compute to process it. It should have no reason to read the web server's environment variables or another customer's uploads.&lt;/p&gt;

&lt;h2&gt;
  
  
  How an AI sandbox works
&lt;/h2&gt;

&lt;p&gt;A typical request follows this path:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Your backend receives a task and asks the model to produce code or tool calls.&lt;/li&gt;
&lt;li&gt;Your backend creates a sandbox and copies in the files that task needs.&lt;/li&gt;
&lt;li&gt;The sandbox runs the code. Your backend collects stdout, stderr, files, and the exit code.&lt;/li&gt;
&lt;li&gt;Your backend checks the result before showing it to the user or sending it to another service.&lt;/li&gt;
&lt;li&gt;Your backend saves the required output and stops the sandbox.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Keep the model provider key and the sandbox management key in your backend. Giving generated code a management key would let it request more resources using your account.&lt;/p&gt;

&lt;p&gt;A coding session may need the same sandbox for several turns. A one-off calculation can use a fresh sandbox per job. Decide how long to retain state and which user owns it before you add reuse.&lt;/p&gt;

&lt;h2&gt;
  
  
  Docker, gVisor, and Firecracker: what changes?
&lt;/h2&gt;

&lt;p&gt;These technologies provide different isolation boundaries. The rest of the system still determines which files, networks, and credentials the code can access.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Approach&lt;/th&gt;
&lt;th&gt;Where the boundary sits&lt;/th&gt;
&lt;th&gt;What to check&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Standard Docker container&lt;/td&gt;
&lt;td&gt;Linux namespaces and resource controls separate processes; containers share the host kernel.&lt;/td&gt;
&lt;td&gt;Capabilities, privileged mode, host mounts, daemon access, and host patching.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;gVisor&lt;/td&gt;
&lt;td&gt;A userspace application kernel handles application system calls, reducing direct exposure to the host kernel.&lt;/td&gt;
&lt;td&gt;System call compatibility and performance for your workload.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Firecracker microVM&lt;/td&gt;
&lt;td&gt;A virtual machine has its own guest kernel and uses KVM for hardware virtualization.&lt;/td&gt;
&lt;td&gt;Guest and host patching, network policy, mounted data, and lifecycle controls.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Docker can suit workloads with a known trust level and a carefully configured host. Its security depends on how you run it; exposing the Docker socket or broad host mounts changes what the workload can control. See &lt;a href="https://docs.docker.com/engine/security/" rel="noopener noreferrer"&gt;Docker's security documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://gvisor.dev/docs/" rel="noopener noreferrer"&gt;gVisor&lt;/a&gt; adds a userspace kernel boundary, with compatibility tradeoffs. &lt;a href="https://firecracker-microvm.github.io/" rel="noopener noreferrer"&gt;Firecracker&lt;/a&gt; uses a small virtual machine monitor and a limited device model. Neither removes the need to protect secrets or restrict access to sensitive services.&lt;/p&gt;

&lt;p&gt;Lizard Sandboxes use Firecracker. Older volumes or snapshots, and a fallback after a failed Firecracker start, can use the container runtime. Check &lt;code&gt;getInfo().runtime&lt;/code&gt; if your application requires a microVM. The example below rejects any other runtime. See the &lt;a href="https://lizard.build/docs/sandboxes/" rel="noopener noreferrer"&gt;Lizard Sandboxes documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What isolation does and does not protect
&lt;/h2&gt;

&lt;p&gt;A sandbox limits the effect of code execution. Your application still has to decide which actions a user or agent may take.&lt;/p&gt;

&lt;h3&gt;
  
  
  Credentials and network access
&lt;/h3&gt;

&lt;p&gt;Anything you copy into the sandbox becomes available to the workload under the permissions you give it. Avoid copying your whole &lt;code&gt;.env&lt;/code&gt;, SSH directory, or cloud credentials. If a task needs an external API, give it a short-lived credential with narrow permissions, or route the operation through a backend tool that checks each request.&lt;/p&gt;

&lt;p&gt;Isolation does not imply blocked internet access. If code can read a secret and make outbound requests, it may be able to send that secret elsewhere. Choose a provider and configuration that meet your outbound network requirements. Do not assume a network allowlist exists without checking the product's controls.&lt;/p&gt;

&lt;h3&gt;
  
  
  Users and stored files
&lt;/h3&gt;

&lt;p&gt;Assign each sandbox to an authenticated user or job. Check ownership on every request to execute code, download a file, or reopen a session. A guessed sandbox ID must not grant access.&lt;/p&gt;

&lt;p&gt;Keep persisted files separate by user too. Reusing a writable workspace across unrelated customers can expose data even when each execution gets a fresh virtual machine.&lt;/p&gt;

&lt;h3&gt;
  
  
  Time limits and returned output
&lt;/h3&gt;

&lt;p&gt;Set an execution timeout and a sandbox lifetime. A timeout in the client can stop waiting without stopping the remote process. Cleanup and a server-side expiry protect against different failures.&lt;/p&gt;

&lt;p&gt;Treat returned files and text as untrusted input. Validate JSON against the shape your application expects. Escape text when rendering it, and avoid serving generated HTML on the same origin as your account dashboard.&lt;/p&gt;

&lt;p&gt;For agents that skip interactive approvals, these controls matter before the first command runs. Our &lt;a href="https://lizard.build/blog/dangerously-skip-permissions" rel="noopener noreferrer"&gt;Claude Code permission guide&lt;/a&gt; covers that workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run a Python task in Lizard Sandboxes
&lt;/h2&gt;

&lt;p&gt;This example uses Node.js as the backend controller and Python inside the sandbox. It runs a fixed calculation so you can check the execution path before adding a model. It does not call an LLM.&lt;/p&gt;

&lt;p&gt;Use Node.js 22 or later, a Lizard project, and a Lizard API key. Set &lt;code&gt;LIZARD_API_KEY&lt;/code&gt; and &lt;code&gt;LIZARD_PROJECT_ID&lt;/code&gt; in your backend environment. Keep both out of browser code; the API key belongs in your secret store.&lt;/p&gt;

&lt;p&gt;Install the JavaScript client:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; @lizard-build/sdk@0.1.69
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save this as &lt;code&gt;run-task.mjs&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Lizard&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@lizard-build/sdk&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;project&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;LIZARD_PROJECT_ID&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;project&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;LIZARD_API_KEY&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Set LIZARD_PROJECT_ID and LIZARD_API_KEY&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;lizard&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Lizard&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;project&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sandbox&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;lizard&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;base&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;small&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;timeoutMs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;120&lt;/span&gt;&lt;span class="nx"&gt;_000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;info&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;sandbox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getInfo&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;info&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;runtime&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;firecracker&lt;/span&gt;&lt;span class="dl"&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;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;This task requires the Firecracker runtime&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;script&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;import json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;values = [12, 8, 5]&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;print(json.dumps({'total': sum(values)}))&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;sandbox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/tmp/task.py&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;script&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;sandbox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exec&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;python3&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/tmp/task.py&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;user&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;timeoutMs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="nx"&gt;_000&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exitCode&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;truncated&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Task failed or returned incomplete output&lt;/span&gt;&lt;span class="dl"&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;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Buffer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;byteLength&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stdout&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;utf8&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;4096&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Task output exceeds the application limit&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stdout&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nx"&gt;output&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;output&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;object&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;output&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;output&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="nx"&gt;output&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;total&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Unexpected task output&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;output&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;finally&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;sandbox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;kill&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run it from your backend machine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node run-task.mjs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On October 17, 2026, we ran this exact script from a Lizard sandbox using the &lt;code&gt;codex&lt;/code&gt; template and Node.js 22.23.2. It created a Small Firecracker sandbox from the &lt;code&gt;base&lt;/code&gt; template, ran Python as &lt;code&gt;user&lt;/code&gt;, printed &lt;code&gt;{ total: 25 }&lt;/code&gt;, and completed cleanup with exit code 0.&lt;/p&gt;

&lt;p&gt;The SDK reads &lt;code&gt;LIZARD_API_KEY&lt;/code&gt; from the controller's environment. This code does not pass it into the sandbox that executes Python.&lt;/p&gt;

&lt;p&gt;The argument array executes Python without shell interpolation. Python can still perform whatever operations the sandbox allows. The 30-second command timeout limits how long the client waits; the two-minute sandbox lifetime sets a separate expiry. The &lt;code&gt;finally&lt;/code&gt; block requests cleanup even if output validation fails. See the &lt;a href="https://lizard.build/docs/sandboxes/sdk-reference/" rel="noopener noreferrer"&gt;Lizard SDK reference&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To turn this into an agent tool, replace the fixed script with the code your model returns and define a result schema for that task. Keep authorization, resource limits, and output checks in the backend. A successful exit code alone does not prove that the answer is correct.&lt;/p&gt;

&lt;h2&gt;
  
  
  What can you build with an AI sandbox?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Data analysis:&lt;/strong&gt; process a user upload, run Python, and return a chart or a small JSON result. Limit file size and execution time, then retain only the output the user needs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Coding agents:&lt;/strong&gt; check out a task-specific copy of a repository, edit files, and run tests. Review the diff and test results before a separate workflow merges or deploys changes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;App builders:&lt;/strong&gt; install dependencies, start a development server, and provide a private preview. Keep the preview separate from your dashboard's origin and authentication. Our &lt;a href="https://lizard.build/blog/build-lovable-clone" rel="noopener noreferrer"&gt;Lovable-style app builder guide&lt;/a&gt; shows the wider application flow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Browser agents:&lt;/strong&gt; use a runtime with a browser and desktop when the task needs UI interaction. Treat any logged-in session as a credential with access to that account.&lt;/p&gt;

&lt;p&gt;Lizard Sandboxes offer shell commands, file access, and private HTTPS previews. Browser and desktop work uses the &lt;code&gt;desktop&lt;/code&gt; template. A development preview and a deployed application have different lifetimes; choose which one your user needs. See &lt;a href="https://lizard.build/sandboxes" rel="noopener noreferrer"&gt;Lizard Sandboxes&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How much does an AI sandbox cost?
&lt;/h2&gt;

&lt;p&gt;Start with total running time, including time between commands. Then add storage, model calls, and any other services your application uses.&lt;/p&gt;

&lt;p&gt;Lizard lists these compute rates as of October 17, 2026:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Size&lt;/th&gt;
&lt;th&gt;vCPU&lt;/th&gt;
&lt;th&gt;RAM&lt;/th&gt;
&lt;th&gt;Compute per hour&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Small&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;4 GB&lt;/td&gt;
&lt;td&gt;$0.0162&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;8 GB&lt;/td&gt;
&lt;td&gt;$0.0324&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Large&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;16 GB&lt;/td&gt;
&lt;td&gt;$0.0648&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Lizard meters compute per second while a sandbox runs, including idle time. Lizard Pro costs &lt;strong&gt;$19 per month and includes $19 of usage&lt;/strong&gt;; excess usage is pay as you go. Persistent Volumes cost $0.14 per GB per month. Check the &lt;a href="https://lizard.build/pricing" rel="noopener noreferrer"&gt;current pricing&lt;/a&gt; before budgeting.&lt;/p&gt;

&lt;p&gt;For 1,000 Small jobs that each keep a sandbox running for five minutes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1,000 × (5 / 60 hours) × $0.0162 = $1.35 in compute usage
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is the compute portion of the workload. Your total bill still includes the Pro subscription and any usage beyond its allowance. Model tokens are a separate cost.&lt;/p&gt;

&lt;p&gt;If those jobs each leave a sandbox running for an extra hour, they add &lt;strong&gt;$16.20&lt;/strong&gt; in compute usage. An explicit lifetime and reliable cleanup can matter more than a small difference in hourly rates.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to choose an AI sandbox
&lt;/h2&gt;

&lt;p&gt;Test with the job your users will run. A quick shell command tells you little about a repository build or a browser session.&lt;/p&gt;

&lt;p&gt;Record startup time, dependency installation time, total task time, failures, and total running seconds. Check the slowest requests as well as the median. Our &lt;a href="https://lizard.build/blog/e2b-vs-daytona-vs-modal" rel="noopener noreferrer"&gt;E2B, Daytona, and Modal comparison&lt;/a&gt; gives a starting point for comparing execution workflows.&lt;/p&gt;

&lt;p&gt;Before adopting a runtime, answer these questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What separates one customer's code and files from another's?&lt;/li&gt;
&lt;li&gt;Which secrets and external services can generated code reach?&lt;/li&gt;
&lt;li&gt;Can the runtime run the languages, packages, and browser tools the task needs?&lt;/li&gt;
&lt;li&gt;What happens when the controller crashes or loses its connection?&lt;/li&gt;
&lt;li&gt;Which files survive shutdown, and how do you back them up?&lt;/li&gt;
&lt;li&gt;What will the full workload cost with idle time, storage, and model calls?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a first implementation, start with one task, one temporary sandbox, and a small validated result. &lt;a href="https://lizard.build/sandboxes" rel="noopener noreferrer"&gt;Create Lizard Sandboxes&lt;/a&gt;, measure that flow, then add persistence or longer sessions when the application needs them.&lt;/p&gt;




&lt;p&gt;Originally published on the &lt;a href="https://lizard.build/blog/ai-sandbox" rel="noopener noreferrer"&gt;Lizard blog&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>devops</category>
      <category>tutorial</category>
      <category>programming</category>
    </item>
    <item>
      <title>Build a Lovable clone in one day with Lizard Sandboxes</title>
      <dc:creator>Yura Dubinin</dc:creator>
      <pubDate>Thu, 15 Oct 2026 11:54:44 +0000</pubDate>
      <link>https://dev.to/yuraoak/build-a-lovable-clone-in-one-day-with-lizard-sandboxes-ld4</link>
      <guid>https://dev.to/yuraoak/build-a-lovable-clone-in-one-day-with-lizard-sandboxes-ld4</guid>
      <description>&lt;p&gt;A Lovable clone needs somewhere to run the code it generates. The model writes files, installs dependencies, checks builds, and starts a preview server. Each customer project needs its own workspace.&lt;/p&gt;

&lt;p&gt;With &lt;a href="https://lizard.build/sandboxes" rel="noopener noreferrer"&gt;Lizard Sandboxes&lt;/a&gt;, your backend creates that workspace through Lizard SDK, sends it files, runs commands, and returns a private preview URL. You can start without buying servers or reserving a fleet of machines.&lt;/p&gt;

&lt;p&gt;For a developer who knows React and Node.js and starts with an app template, one day is a reasonable target for a small MVP: enter a prompt, generate a React app, open its preview, and ask for changes. Payments, team access, and a complete deployment product need more work.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we tested on Lizard
&lt;/h2&gt;

&lt;p&gt;On October 15, 2026, we ran the execution workflow in Small Firecracker Sandboxes in us-east-1 using Lizard SDK 0.1.69.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Check&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Install dependencies and build the React app&lt;/td&gt;
&lt;td&gt;Passed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Open the private HTTPS preview in a browser&lt;/td&gt;
&lt;td&gt;Passed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Filter sample members with a React button&lt;/td&gt;
&lt;td&gt;Passed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Request the preview without an access token&lt;/td&gt;
&lt;td&gt;HTTP 401&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Change source files, rebuild, and reload the preview&lt;/td&gt;
&lt;td&gt;Passed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Save the edited source and rebuild it in a new sandbox&lt;/td&gt;
&lt;td&gt;Passed&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The first successful run took about 22 seconds from creating the sandbox to receiving a working preview. That included installing Node.js and npm, uploading the starter, installing dependencies, and building the app. This is one smoke test, not a startup benchmark.&lt;/p&gt;

&lt;p&gt;The test also caught two errors in the first draft. The sandbox object exposes its ID as &lt;code&gt;sandbox.sandboxId&lt;/code&gt;. And the &lt;code&gt;interpreter&lt;/code&gt; sandbox we received did not contain Node.js or npm. The code below installs a fixed Node.js version before running the build.&lt;/p&gt;

&lt;p&gt;We tested the execution and preview workflow. The one-day schedule below is a build plan; we did not time the creation of a complete SaaS product or test an external model's output quality.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep the first version small
&lt;/h2&gt;

&lt;p&gt;Start with one React and Vite template. Let users create simple dashboards, landing pages, or internal tools with sample data.&lt;/p&gt;

&lt;p&gt;The first release needs sign-in, a project list, a chat box, build output, and a working preview. Save source files so users can return later.&lt;/p&gt;

&lt;p&gt;Keep the dependency list fixed. Give the model a known set of packages and let it edit a few source files. This makes failed builds easier to fix.&lt;/p&gt;

&lt;p&gt;A useful first request is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Build a dashboard for a small gym. Show monthly revenue,
active members, and upcoming classes. Use sample data.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After the preview works, send a follow-up request to add or change a membership filter. That gives you a concrete path to test.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep your backend in charge
&lt;/h2&gt;

&lt;p&gt;Your backend owns the model connection, the Lizard API key, and the mapping between users and projects.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User prompt
    |
Your backend: sign-in, project access, model calls
    |
Lizard SDK
    |
Sandbox: source files, dependencies, build, preview
    |
Private preview URL returned to the project owner
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Store the owner, sandbox ID, conversation, and saved file version in your database. Check ownership before every operation, including reading logs and opening a preview.&lt;/p&gt;

&lt;p&gt;Keep platform credentials on your backend. Generated code does not need your Lizard API key or model provider key.&lt;/p&gt;

&lt;p&gt;For the first version, ask the model to return structured output with &lt;code&gt;appTsx&lt;/code&gt; and &lt;code&gt;appCss&lt;/code&gt;. Validate both strings and set a response size limit. Your backend writes them to fixed paths, &lt;code&gt;src/App.tsx&lt;/code&gt; and &lt;code&gt;src/App.css&lt;/code&gt;. It controls package files, the lockfile, and build scripts.&lt;/p&gt;

&lt;p&gt;Tell the model which imports the starter supports. If a build fails, return the relevant error output and allow at most two repair attempts. Then show the error to the user.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create a sandbox and open its preview
&lt;/h2&gt;

&lt;p&gt;Install the tested SDK version in your Node.js backend:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; @lizard-build/sdk@0.1.69
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a key limited to the Lizard project your builder uses:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lizard keys create lovable-builder &lt;span class="nt"&gt;--project&lt;/span&gt; YOUR_PROJECT_ID &lt;span class="nt"&gt;--json&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Set &lt;code&gt;LIZARD_API_KEY&lt;/code&gt; and &lt;code&gt;LIZARD_PROJECT_ID&lt;/code&gt; in the backend environment. The SDK does not read your Lizard CLI login or load an &lt;code&gt;.env&lt;/code&gt; file by itself.&lt;/p&gt;

&lt;p&gt;Prepare a trusted React and Vite starter with a lockfile and a working &lt;code&gt;npm run build&lt;/code&gt; script. Our test used React 19.2.0, Vite 7.1.12, TypeScript 5.9.3, and Python 3.11.16. Keep dependencies current in your own starter and retest when you update them.&lt;/p&gt;

&lt;p&gt;The function below accepts that starter as a map of relative file paths to file contents. Load it from files you control. Do not accept &lt;code&gt;starterFiles&lt;/code&gt; from the model or an unauthenticated request.&lt;/p&gt;

&lt;p&gt;The setup step targets the Linux x64 sandbox used in this test. It downloads Node.js 22.23.3 from nodejs.org and checks the archive against the release checksum. Run setup before passing the workspace to generated code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Lizard&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@lizard-build/sdk&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;setTimeout&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;delay&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;node:timers/promises&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;project&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;LIZARD_PROJECT_ID&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;project&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;LIZARD_PROJECT_ID is required&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;lizard&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Lizard&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;project&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;createPreview&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;starterFiles&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Record&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;appTsx&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;appCss&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sandbox&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;lizard&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;interpreter&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;small&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;timeoutMs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;purpose&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;lovable-article-smoke-20261015&lt;/span&gt;&lt;span class="dl"&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;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;info&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;sandbox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getInfo&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;info&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;runtime&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;firecracker&lt;/span&gt;&lt;span class="dl"&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;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;This workflow requires Firecracker&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;setup&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;sandbox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exec&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/bin/bash&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;-lc&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;`
set -euo pipefail
version=v22.23.3
archive=node-$version-linux-x64.tar.xz
if [ "$(node --version 2&amp;gt;/dev/null || true)" != "$version" ] || ! command -v npm &amp;gt;/dev/null; then
  cd /tmp
  curl -fsSLO "https://nodejs.org/dist/$version/$archive"
  curl -fsSL "https://nodejs.org/dist/$version/SHASUMS256.txt" | grep "  $archive$" | sha256sum -c -
  tar -xJf "$archive" -C /usr/local --strip-components=1
fi
node --version
npm --version
python --version
`&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;timeoutMs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;120&lt;/span&gt;&lt;span class="nx"&gt;_000&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;setup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exitCode&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;setup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stderr&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;setup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stdout&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;entries&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;starterFiles&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;sandbox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`/workspace/app/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;sandbox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/workspace/app/src/App.tsx&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;appTsx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;sandbox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/workspace/app/src/App.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;appCss&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;command&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;npm&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ci&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;npm&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;run&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;build&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;sandbox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exec&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;command&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;workdir&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/workspace/app&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;timeoutMs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;120&lt;/span&gt;&lt;span class="nx"&gt;_000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;})&lt;/span&gt;
      &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exitCode&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stderr&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stdout&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;server&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;sandbox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exec&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/bin/bash&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;-lc&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;nohup python -m http.server 3000 --bind 0.0.0.0 &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
      &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;--directory dist &amp;gt; /tmp/preview.log 2&amp;gt;&amp;amp;1 &amp;lt; /dev/null &amp;amp;&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;workdir&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/workspace/app&lt;/span&gt;&lt;span class="dl"&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;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exitCode&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stderr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;route&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;sandbox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exposePort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;attempt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;attempt&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;attempt&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`https://&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;route&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;hostname&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;X-Lizard-Access-Token&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;route&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;accessToken&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="na"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;AbortSignal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;timeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="nx"&gt;_000&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ready&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;ok&lt;/span&gt;
      &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nf"&gt;cancel&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
      &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ready&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;sandboxId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;sandbox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sandboxId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;previewUrl&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;route&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;delay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Preview did not become ready&lt;/span&gt;&lt;span class="dl"&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;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;sandbox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;kill&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Call &lt;code&gt;createPreview(starterFiles, result.appTsx, result.appCss)&lt;/code&gt; after validating the model response. Save the returned &lt;code&gt;sandboxId&lt;/code&gt; against the user's project and return &lt;code&gt;previewUrl&lt;/code&gt; only after checking access.&lt;/p&gt;

&lt;p&gt;The URL includes an access token. Keep it out of public logs and analytics. It grants access to the sandbox's exposed ports, so treat it as a credential.&lt;/p&gt;

&lt;p&gt;This example serves the built frontend with Python's HTTP server. Use it for a private development preview. Keep the initial app on one route or use hash routing. Production hosting should be a separate deployment.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://github.com/lizard-build/lizard-sdk/blob/main/docs/sandboxes.md" rel="noopener noreferrer"&gt;Lizard SDK reference&lt;/a&gt; covers commands, files, private ports, and sandbox lifecycle operations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Handle follow-up changes and saved projects
&lt;/h2&gt;

&lt;p&gt;Reconnect to the project sandbox through &lt;code&gt;lizard.connect(sandboxId)&lt;/code&gt;. Read the approved source files, send them with the user's next request to the model, validate the response, write the changes, and run the build again.&lt;/p&gt;

&lt;p&gt;Our test changed the heading and added a sample member. After rebuilding and reloading the same preview URL, the browser showed the new version and its filter worked.&lt;/p&gt;

&lt;p&gt;Save source files after each successful build. Use a private bucket to store source bundles in &lt;a href="https://lizard.build/object-storage" rel="noopener noreferrer"&gt;Managed Object Storage&lt;/a&gt; and keep project records in &lt;a href="https://lizard.build/postgres" rel="noopener noreferrer"&gt;Managed Postgres&lt;/a&gt;. Those backend services run separately from the preview workspace.&lt;/p&gt;

&lt;p&gt;A user returning after the sandbox expires needs a new sandbox. Restore the saved source and starter, then rebuild. We verified this by loading the edited source into a second sandbox and opening the resulting app in a browser.&lt;/p&gt;

&lt;p&gt;Persistent Volumes are another option for retaining workspace files. Each volume attaches to one sandbox at a time. Keep an external copy of valuable files because the storage lives on one node. &lt;a href="https://lizard.build/sandboxes" rel="noopener noreferrer"&gt;Sandbox storage details&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Isolate generated code with Firecracker
&lt;/h2&gt;

&lt;p&gt;Lizard Sandboxes support Firecracker microVMs with their own kernel. The example checks the runtime before installing dependencies or running the app.&lt;/p&gt;

&lt;p&gt;Older volumes or snapshots can use the container runtime. If your product requires Firecracker, keep the runtime check when adding restore or volume support. &lt;a href="https://lizard.build/sandboxes" rel="noopener noreferrer"&gt;Runtime details&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a separate sandbox for each active customer project. Keep production database credentials and platform keys outside that workspace. A sandbox can make network requests, so generated code may send out any secret you put inside it.&lt;/p&gt;

&lt;p&gt;Serve previews on a separate browser origin from your main app. For an MVP, opening the private preview in a new tab keeps the integration simple. Review iframe permissions and validate messages if you embed previews later.&lt;/p&gt;

&lt;p&gt;Before inviting users, test with two accounts. Changing a project ID must not let one account read the other's files, logs, or preview URL. Firecracker handles the execution boundary; your application handles user access.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does a Lovable clone cost to run?
&lt;/h2&gt;

&lt;p&gt;Small costs $0.0162 per hour for 2 vCPU, 4 GB RAM, and 5 GB local disk. Lizard bills running time by the second.&lt;/p&gt;

&lt;p&gt;At ten minutes per session:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Sessions&lt;/th&gt;
&lt;th&gt;Sandbox compute&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;$0.0027&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;$0.27&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1,000&lt;/td&gt;
&lt;td&gt;$2.70&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10,000&lt;/td&gt;
&lt;td&gt;$27.00&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These are compute estimates. Lizard Pro costs $19 per month with $19 of usage included; usage above that is pay as you go. The seven-day trial includes $5 of usage and requires a card. Prices checked October 15, 2026. &lt;a href="https://lizard.build/pricing" rel="noopener noreferrer"&gt;Current pricing&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Model tokens, backend hosting, databases, and persistent storage also affect your total. Track model usage and sandbox time per project before setting your own prices.&lt;/p&gt;

&lt;p&gt;You avoid buying servers or reserving capacity before finding users. Running idle time still costs money. Pause or end unused sessions; retained storage can still incur charges.&lt;/p&gt;

&lt;p&gt;The example sets a ten-minute lifetime. Commands do not extend that deadline. Add an idle-session policy and a Stop button to your backend, and call &lt;code&gt;sandbox.kill()&lt;/code&gt; when a session ends after saving its source. &lt;a href="https://github.com/lizard-build/lizard-sdk/blob/main/docs/sandboxes.md" rel="noopener noreferrer"&gt;Lifecycle reference&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A one-day MVP plan
&lt;/h2&gt;

&lt;p&gt;This schedule assumes you already have a web app starter with authentication.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Time&lt;/th&gt;
&lt;th&gt;Deliverable&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Hour 1&lt;/td&gt;
&lt;td&gt;Project page, prompt input, and ownership checks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hours 2–3&lt;/td&gt;
&lt;td&gt;Model response validation, sandbox creation, file writes, and builds&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hour 4&lt;/td&gt;
&lt;td&gt;Private preview and visible build errors&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hour 5&lt;/td&gt;
&lt;td&gt;Follow-up edits and saved project versions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hour 6&lt;/td&gt;
&lt;td&gt;Session expiry, retry limits, and per-user quotas&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hour 7&lt;/td&gt;
&lt;td&gt;Tests with two accounts and several different prompts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hour 8&lt;/td&gt;
&lt;td&gt;Deploy the builder and invite a small test group&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Check the full user journey before inviting testers: create an app, request a change, close the session, and reopen the saved project. A failed build should produce a useful error and release its sandbox.&lt;/p&gt;

&lt;p&gt;Start with one template and a working preview. &lt;a href="https://lizard.build/sandboxes" rel="noopener noreferrer"&gt;Lizard Sandboxes&lt;/a&gt; and &lt;a href="https://github.com/lizard-build/lizard-sdk" rel="noopener noreferrer"&gt;Lizard SDK&lt;/a&gt; provide the execution, file, and lifecycle controls for that first release.&lt;/p&gt;




&lt;p&gt;Originally published on the &lt;a href="https://lizard.build/blog/build-lovable-clone" rel="noopener noreferrer"&gt;Lizard blog&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Claude Code --dangerously-skip-permissions: usage and limits</title>
      <dc:creator>Yura Dubinin</dc:creator>
      <pubDate>Wed, 07 Oct 2026 13:13:40 +0000</pubDate>
      <link>https://dev.to/yuraoak/claude-code-dangerously-skip-permissions-usage-and-limits-4hek</link>
      <guid>https://dev.to/yuraoak/claude-code-dangerously-skip-permissions-usage-and-limits-4hek</guid>
      <description>&lt;p&gt;&lt;code&gt;claude --dangerously-skip-permissions&lt;/code&gt; starts Claude Code in &lt;code&gt;bypassPermissions&lt;/code&gt; mode. It removes routine approval prompts for file changes, shell commands and tool calls. Use it for a bounded task inside a disposable environment whose files, credentials and network access you have already limited. The flag itself creates no sandbox.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude &lt;span class="nt"&gt;--dangerously-skip-permissions&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is the command. Before adding it to an unattended job, check what the process can reach. A missed approval on a throwaway checkout has a different cost from a missed approval on a laptop that holds production credentials.&lt;/p&gt;

&lt;p&gt;This guide covers the command, alternatives and a concrete run-and-review workflow. We checked Anthropic's documentation on October 6, 2026. The examples describe a setup; they are not results from a live Claude Code security test.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does dangerously-skip-permissions do?
&lt;/h2&gt;

&lt;p&gt;The flag selects the same permission mode as &lt;code&gt;claude --permission-mode bypassPermissions&lt;/code&gt;. Claude can continue working without the usual approval stops. It keeps the operating-system identity and access of the process you launched: it does not grant root privileges, invent credentials or create access to a network your environment blocks. &lt;a href="https://code.claude.com/docs/en/permission-modes" rel="noopener noreferrer"&gt;Claude Code permission modes&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;There are still exceptions. Current releases retain explicit deny rules and ask rules, checks for certain critical-path removals, and actions that require user interaction. Do not treat those exceptions as protection for arbitrary files or cloud resources. A command can harm a project without deleting a filesystem root.&lt;/p&gt;

&lt;p&gt;In particular, &lt;strong&gt;bypass mode can write to &lt;code&gt;.git&lt;/code&gt; and &lt;code&gt;.claude&lt;/code&gt; without the protected-path prompt&lt;/strong&gt;. Some search summaries suggest that these folders always stay protected. That is not what the current documentation says. &lt;a href="https://code.claude.com/docs/en/permissions" rel="noopener noreferrer"&gt;Permissions reference&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Consider a routine request: “Fix the failing tests.” Claude might edit a test, install a package or change configuration. If the same process can also read a cloud key and call its API, a disposable local folder alone does not restrict those remote actions. Your setup must limit that access before the run begins.&lt;/p&gt;

&lt;h2&gt;
  
  
  Commands for interactive and unattended use
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Start an interactive session
&lt;/h3&gt;

&lt;p&gt;Open a terminal inside your prepared environment and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude &lt;span class="nt"&gt;--dangerously-skip-permissions&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check the displayed permission mode before giving the task. On the first interactive launch, Claude Code can show a warning that you must accept. For a root or sudo error, use a non-root account inside the environment instead of changing the host's protections. &lt;a href="https://code.claude.com/docs/en/permission-modes" rel="noopener noreferrer"&gt;Mode setup and root restrictions&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Run one task and capture its result
&lt;/h3&gt;

&lt;p&gt;For a current Claude Code release with API-key authentication:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude &lt;span class="nt"&gt;--bare&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="s2"&gt;"Fix the failing unit test in this checkout. Run the relevant tests. Report changed files and failures. Do not commit or push."&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--dangerously-skip-permissions&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--max-turns&lt;/span&gt; 12 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--output-format&lt;/span&gt; json &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /tmp/claude-result.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;-p&lt;/code&gt; runs a non-interactive task, and &lt;code&gt;--output-format json&lt;/code&gt; makes its response easier for a runner to collect. &lt;code&gt;--max-turns&lt;/code&gt; limits the agent loop; it does not impose a wall-clock deadline on the whole job. Configure that deadline in your runner too. &lt;a href="https://code.claude.com/docs/en/cli-reference" rel="noopener noreferrer"&gt;CLI flag reference&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;--bare&lt;/code&gt; avoids loading the usual ambient hooks, plugins, memory and repository instructions. For Anthropic's API it needs &lt;code&gt;ANTHROPIC_API_KEY&lt;/code&gt;; it does not use your subscription's OAuth login. Supply that key through the runner's secret settings. On older releases, check support before copying this example. &lt;a href="https://code.claude.com/docs/en/headless" rel="noopener noreferrer"&gt;Programmatic runs and bare mode&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The prompt's “Do not commit or push” describes the task. Enforce the restriction by withholding write access to the remote repository. A sentence in a prompt cannot replace a credential scope or network policy.&lt;/p&gt;

&lt;p&gt;For more on collecting results and handling failed jobs, see our &lt;a href="https://lizard.build/blog/claude-code-headless" rel="noopener noreferrer"&gt;Claude Code headless guide&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Enable bypass for later in the session
&lt;/h3&gt;

&lt;p&gt;The similarly named flag has a different effect:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude &lt;span class="nt"&gt;--permission-mode&lt;/span&gt; default &lt;span class="nt"&gt;--allow-dangerously-skip-permissions&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;--allow-dangerously-skip-permissions&lt;/code&gt; makes bypass selectable later; it does not start in bypass. Use the terminal's &lt;code&gt;Shift+Tab&lt;/code&gt; mode cycle to switch. If the session did not enable bypass at launch, restart with the enabling flag. &lt;a href="https://code.claude.com/docs/en/cli-reference" rel="noopener noreferrer"&gt;CLI reference&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Auto mode vs dangerously-skip-permissions
&lt;/h2&gt;

&lt;p&gt;Choose the least permissive mode that lets the task finish:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Mode&lt;/th&gt;
&lt;th&gt;Approval behavior&lt;/th&gt;
&lt;th&gt;A practical use&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;default&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Manual approval for actions that need permission&lt;/td&gt;
&lt;td&gt;Work involving sensitive files or shared systems&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;acceptEdits&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Approves file edits and common filesystem operations&lt;/td&gt;
&lt;td&gt;Local coding with review of other actions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;auto&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A classifier reviews actions beyond routine approvals&lt;/td&gt;
&lt;td&gt;Longer coding tasks with fewer interruptions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;dontAsk&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Denies actions that would need a prompt&lt;/td&gt;
&lt;td&gt;A job with a narrow set of allowed tools&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;bypassPermissions&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Skips routine checks, with documented exceptions&lt;/td&gt;
&lt;td&gt;A bounded job in an isolated environment&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The mode names and behavior come from the &lt;a href="https://code.claude.com/docs/en/permissions" rel="noopener noreferrer"&gt;permissions reference&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Auto mode uses a separate classifier to review actions such as shell commands and external tool calls. It can block an action and let Claude try another approach. It can also make mistakes. Anthropic describes it as a way to reduce approval overhead, with tradeoffs that manual review and bypass do not share. &lt;a href="https://www.anthropic.com/engineering/claude-code-auto-mode" rel="noopener noreferrer"&gt;How Anthropic built auto mode&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If repetitive prompts are your main problem, start by trying auto mode where your account supports it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude &lt;span class="nt"&gt;--permission-mode&lt;/span&gt; auto
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If your job only needs known tools, consider &lt;code&gt;dontAsk&lt;/code&gt; with narrow allow rules. It has a useful property for automation: missing permission fails the action instead of leaving the job waiting for a person. Inspect denied actions before widening the rules.&lt;/p&gt;

&lt;h2&gt;
  
  
  Does Claude Code's sandbox make bypass safe?
&lt;/h2&gt;

&lt;p&gt;Claude Code's built-in Bash sandbox restricts shell access to files and the network. Its auto-allow option can approve sandboxed commands without a prompt. That option is separate from auto mode's classifier. &lt;a href="https://code.claude.com/docs/en/sandboxing" rel="noopener noreferrer"&gt;Bash sandbox configuration&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The built-in Bash sandbox does not contain the whole application. File tools, MCP servers and hooks need their own boundary, or an outer environment that contains the entire Claude Code process. A VM and a container also provide different isolation. Choose based on what code you intend to run and what failure you can tolerate. &lt;a href="https://code.claude.com/docs/en/sandbox-environments" rel="noopener noreferrer"&gt;Sandbox environment comparison&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Check the retry behavior too. With bypass enabled, an unsandboxed retry can run without asking. For supported setups, the following sandbox settings prevent that retry and require the sandbox to start:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"sandbox"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"enabled"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"failIfUnavailable"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"allowUnsandboxedCommands"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Review any &lt;code&gt;excludedCommands&lt;/code&gt; entries as well; they can still run outside the Bash sandbox. For centrally enforced settings, use managed policy that the agent cannot edit. &lt;a href="https://code.claude.com/docs/en/sandboxing" rel="noopener noreferrer"&gt;Strict sandbox settings&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  A practical workflow for an unattended run
&lt;/h2&gt;

&lt;p&gt;Take a small failing-test task as an example. The output you want is a patch and a test report. There is no reason for this job to hold deployment access.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Prepare a separate checkout
&lt;/h3&gt;

&lt;p&gt;Create a fresh container or VM and copy in the repository at a known commit. Prefer a copy to a writable mount of your main working directory. A worktree helps separate changes, but does not isolate the operating system or credentials.&lt;/p&gt;

&lt;p&gt;Install the required runtime and packages during setup. Record the starting commit and tool versions. Use a non-root account for the agent. If you start with a dev container, inspect its mounts: a writable host directory exposes those host files to edits inside the container. Anthropic's &lt;a href="https://code.claude.com/docs/en/devcontainer" rel="noopener noreferrer"&gt;dev container guide&lt;/a&gt; explains the setup and its limits.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Give the job only the access it needs
&lt;/h3&gt;

&lt;p&gt;Pass the model credential separately. If the repository is private, use read-only repository access for checkout. Keep deployment keys, your SSH agent, the Docker socket and unrelated home-directory files outside the environment.&lt;/p&gt;

&lt;p&gt;Allow the model endpoint and the package or source hosts the task needs. Restrict other outbound access in the environment's network controls. If a dependency download fails, identify the required host before opening more destinations.&lt;/p&gt;

&lt;p&gt;This is also where you decide which MCP servers, if any, the task needs. A database or cloud MCP connection adds remote capabilities even when the local filesystem is disposable.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Run a task with a clear end condition
&lt;/h3&gt;

&lt;p&gt;Use the headless command above once authentication and dependencies are ready. Put the job under a runner timeout and capture its exit status, stdout and stderr. Keep the test command under your control so that the result does not depend only on the agent's summary.&lt;/p&gt;

&lt;p&gt;Start with a small change: one failing test or one documented bug. “Clean up the entire repository” leaves too much room for edits you did not intend to review.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Review the actual files
&lt;/h3&gt;

&lt;p&gt;After the job ends, inspect the checkout:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git status &lt;span class="nt"&gt;--short&lt;/span&gt;
git diff &lt;span class="nt"&gt;--stat&lt;/span&gt;
git diff &lt;span class="nt"&gt;--check&lt;/span&gt;
git diff
git ls-files &lt;span class="nt"&gt;--others&lt;/span&gt; &lt;span class="nt"&gt;--exclude-standard&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The last command lists untracked files, which a plain diff misses. Inspect them too. Compare the final commit with the starting commit so an unexpected commit does not hide changes from the working-tree diff. Re-run the relevant tests from your trusted runner, then review the patch before merging it.&lt;/p&gt;

&lt;p&gt;Export the files you need before stopping the environment. Keep credentials out of logs and artifacts. Expire the task's credentials and destroy the disposable workspace after the review material is safe.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where Lizard Sandboxes fit
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://lizard.build/sandboxes" rel="noopener noreferrer"&gt;Sandboxes&lt;/a&gt; on Lizard can provide the remote workspace for this pattern: create an environment, execute a task, collect its files and stop it. Set an explicit lifetime so a failed runner does not leave the environment running indefinitely. Start with the &lt;a href="https://lizard.build/docs/sandboxes/quickstart/" rel="noopener noreferrer"&gt;Sandboxes quickstart&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Check the runtime before choosing it for your threat model. Sandboxes run as Firecracker microVMs, each with its own kernel. A sandbox that attaches an existing pod-backed Persistent Volume, or restores an older pod snapshot, runs as a Kubernetes pod (runc) and shares the host kernel. In the Lizard SDK, &lt;code&gt;getInfo().runtime&lt;/code&gt; tells you which one you got. Keep credentials scoped either way. See the &lt;a href="https://lizard.build/docs/sandboxes/" rel="noopener noreferrer"&gt;runtime documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Remote execution helps when you need a fresh workspace for each job or many jobs at once. It still needs a network policy and a review step. A sandbox with a production database token can reach that database regardless of where the sandbox runs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Can I use dangerously-skip-permissions by default?
&lt;/h3&gt;

&lt;p&gt;Yes. For a dedicated container or VM worker, merge this into that worker user's &lt;code&gt;~/.claude/settings.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"permissions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"defaultMode"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"bypassPermissions"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;New terminal sessions then start in bypass mode. Keep this default confined to the disposable worker; for individual jobs, use the explicit launch flag. In current releases, this value does not enable bypass from a repository's &lt;code&gt;.claude/settings.json&lt;/code&gt; or &lt;code&gt;.claude/settings.local.json&lt;/code&gt;. Managed policy may also disable the mode. &lt;a href="https://code.claude.com/docs/en/settings" rel="noopener noreferrer"&gt;Settings scope and precedence&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do subagents inherit bypass permissions?
&lt;/h3&gt;

&lt;p&gt;Yes. In the current documented behavior, a main conversation in bypass mode makes its subagents use the same mode, overriding their own permission-mode setting. A subagent is not a separate security boundary. &lt;a href="https://code.claude.com/docs/en/sub-agents" rel="noopener noreferrer"&gt;Subagent permissions&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why does Claude still ask a question?
&lt;/h3&gt;

&lt;p&gt;An approval prompt and a question about the task are different. Some actions require interaction even in bypass mode, and configured ask rules can still apply. Read the actual prompt before assuming the flag failed. For unattended jobs, specify the expected output and failure behavior up front.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does the flag make Claude Code free or remove rate limits?
&lt;/h3&gt;

&lt;p&gt;No. It changes permission handling. Your model provider still controls authentication, usage charges and rate limits. Repeated retries can use more tokens even when no approval prompt appears.&lt;/p&gt;

&lt;p&gt;For daily work, try auto mode or the Bash sandbox's auto-allow option first. For unattended bypass runs, make the environment disposable, restrict what it can reach, and review the resulting files before they affect your main project.&lt;/p&gt;




&lt;p&gt;Originally published on the &lt;a href="https://lizard.build/blog/dangerously-skip-permissions" rel="noopener noreferrer"&gt;Lizard blog&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claude</category>
      <category>devops</category>
      <category>security</category>
    </item>
    <item>
      <title>Vercel Sandbox pricing: costs, limits, and alternatives</title>
      <dc:creator>Yura Dubinin</dc:creator>
      <pubDate>Tue, 06 Oct 2026 08:17:45 +0000</pubDate>
      <link>https://dev.to/yuraoak/vercel-sandbox-pricing-costs-limits-and-alternatives-58je</link>
      <guid>https://dev.to/yuraoak/vercel-sandbox-pricing-costs-limits-and-alternatives-58je</guid>
      <description>&lt;p&gt;Vercel Sandbox pricing depends on how much CPU your code uses and how long you keep memory allocated. In the default US region, Vercel charges $0.128 per active vCPU-hour and $0.0212 per GB-hour of memory. While your agent waits for an AI model, it can stop using CPU, but you still pay for its memory. See &lt;a href="https://vercel.com/docs/sandbox/pricing" rel="noopener noreferrer"&gt;Vercel's pricing&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Lizard has the lowest paid compute price of the four providers we compare here. For 10,000 five-minute runs with 2 vCPUs and 4 GB of memory, we calculate &lt;strong&gt;$13.50 on Lizard versus $92.01 on Vercel&lt;/strong&gt;, assuming 10% CPU utilization. That's 85.3% less before credits, subscriptions and any extra storage or transfer charges. On Lizard Pro, $19 a month with $19 of usage included, that workload bills $19.&lt;/p&gt;

&lt;p&gt;We checked prices on October 5, 2026. This is a Lizard guide, so we're comparing our own product with other providers. We used their official prices and checked Lizard's rate against its billing data. The calculations assume the same stated CPU and memory sizes; actual throughput and reliability need separate tests.&lt;/p&gt;

&lt;h2&gt;
  
  
  Vercel Sandbox pricing by resource
&lt;/h2&gt;

&lt;p&gt;The Pro rates below apply to &lt;code&gt;iad1&lt;/code&gt;. If you plan to run elsewhere, check the &lt;a href="https://vercel.com/docs/sandbox/concepts/regions" rel="noopener noreferrer"&gt;regional prices&lt;/a&gt;: CPU, memory and some other charges change with location.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Charge&lt;/th&gt;
&lt;th&gt;Published rate&lt;/th&gt;
&lt;th&gt;What it means for your estimate&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Active CPU&lt;/td&gt;
&lt;td&gt;$0.128 per vCPU-hour&lt;/td&gt;
&lt;td&gt;Count CPU execution across all allocated vCPUs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Provisioned memory&lt;/td&gt;
&lt;td&gt;$0.0212 per GB-hour&lt;/td&gt;
&lt;td&gt;Count allocated memory throughout the running session&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sandbox creation&lt;/td&gt;
&lt;td&gt;$0.60 per million&lt;/td&gt;
&lt;td&gt;Add the number of creation calls&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Snapshot storage&lt;/td&gt;
&lt;td&gt;$0.08 per GB-month&lt;/td&gt;
&lt;td&gt;Add retained filesystem snapshots&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Drive storage&lt;/td&gt;
&lt;td&gt;$0.05 per GB-month&lt;/td&gt;
&lt;td&gt;Add persistent drive data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Drive reads / writes&lt;/td&gt;
&lt;td&gt;$0.0015 / $0.004 per GB&lt;/td&gt;
&lt;td&gt;Add data read from or written to drives&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Source: &lt;a href="https://vercel.com/docs/sandbox/pricing" rel="noopener noreferrer"&gt;Vercel Sandbox rates and quotas&lt;/a&gt;. Vercel bills memory in minimum increments of one minute. That doesn't affect our five-minute jobs. If your job finishes in a few seconds, include the minimum in your estimate.&lt;/p&gt;

&lt;p&gt;An agent waiting for an LLM may use little CPU. A compiler could use most of the available CPU during the same five-minute session. &lt;a href="https://vercel.com/kb/guide/vercel-sandbox-vs-e2b" rel="noopener noreferrer"&gt;Vercel's explanation of Active CPU billing&lt;/a&gt; covers the difference between running code and waiting on I/O.&lt;/p&gt;

&lt;p&gt;Record elapsed time and CPU time separately. A job that takes five minutes to finish won't necessarily use five minutes of CPU.&lt;/p&gt;

&lt;h2&gt;
  
  
  Is Vercel Sandbox free?
&lt;/h2&gt;

&lt;p&gt;Hobby includes 5 active CPU hours, 420 GB-hours of memory and 5,000 creations each month. See the &lt;a href="https://vercel.com/docs/sandbox/pricing" rel="noopener noreferrer"&gt;Hobby quotas&lt;/a&gt;. You also get 20 GB of data transfer. If you use up an allowance, Vercel pauses new sandbox creation until it resets. You can upgrade to Pro to keep running tasks.&lt;/p&gt;

&lt;p&gt;A small project that qualifies for Hobby and stays within those allowances can cost nothing. Keep that in mind when comparing paid rates. The estimates below help you budget for usage beyond free allowances and trial credits.&lt;/p&gt;

&lt;h3&gt;
  
  
  How the Pro credit changes your bill
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://vercel.com/docs/plans/pro-plan" rel="noopener noreferrer"&gt;Vercel Pro&lt;/a&gt; costs $20 a month and includes one deploying seat and $20 in usage credit. You can spend that credit on eligible infrastructure across the account. Extra paid seats add to the bill.&lt;/p&gt;

&lt;p&gt;If you use the account only for Sandbox, with one seat and no extras, the bill is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Monthly Pro bill = $20 + max(0, eligible usage charges - $20)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With $9.20 of eligible usage, you pay $20. With $92.01 of usage, you pay $92.01. Simply adding $20 to your usage estimate would count the portion covered by the credit twice.&lt;/p&gt;

&lt;p&gt;If you already pay for Pro, check how much credit your other services use. You may have enough left to cover a small sandbox workload. In that case, adding those tasks won't increase your bill.&lt;/p&gt;

&lt;h2&gt;
  
  
  Worked example: 10,000 agent tasks per month
&lt;/h2&gt;

&lt;p&gt;Each task in this example creates a sandbox, runs for five minutes and stops. We use 2 vCPUs and 4 GB of memory per instance. Vercel runs in &lt;code&gt;iad1&lt;/code&gt;, with CPU utilization averaging 10% across the allocation. Each job fits within 5 GB of local workspace storage.&lt;/p&gt;

&lt;p&gt;We leave out model tokens, taxes, retained snapshots, persistent drives and billable network traffic. The example assumes a disposable workspace. If you need to keep the result, export it before stopping the sandbox and add any transfer charge to your estimate.&lt;/p&gt;

&lt;p&gt;Using the &lt;a href="https://vercel.com/docs/sandbox/pricing" rel="noopener noreferrer"&gt;published Vercel rates&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Elapsed sandbox hours = 10,000 × 5 / 60 = 833.333...
Active vCPU-hours     = 833.333... × 2 × 0.10 = 166.666...
Memory GB-hours      = 833.333... × 4 = 3,333.333...

CPU cost             = 166.666... × $0.128 = $21.333...
Memory cost          = 3,333.333... × $0.0212 = $70.666...
Creation cost        = 10,000 × $0.60 / 1,000,000 = $0.006
Vercel usage total   = $92.006, rounded to $92.01

Lizard Small         = 833.333... × $0.0162 = $13.50
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Most of the Vercel cost here comes from memory. Even if the agent used less CPU, that memory charge would remain. Lizard Small charges a fixed rate for the running sandbox, with CPU, memory and idle time included.&lt;/p&gt;

&lt;h3&gt;
  
  
  What changes as task volume grows?
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Five-minute runs per month&lt;/th&gt;
&lt;th&gt;Total sandbox hours&lt;/th&gt;
&lt;th&gt;Vercel usage estimate&lt;/th&gt;
&lt;th&gt;Vercel Pro bill, one seat*&lt;/th&gt;
&lt;th&gt;Lizard running cost&lt;/th&gt;
&lt;th&gt;Lizard Pro bill*&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1,000&lt;/td&gt;
&lt;td&gt;83.33&lt;/td&gt;
&lt;td&gt;$9.20&lt;/td&gt;
&lt;td&gt;$20.00&lt;/td&gt;
&lt;td&gt;$1.35&lt;/td&gt;
&lt;td&gt;$19.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10,000&lt;/td&gt;
&lt;td&gt;833.33&lt;/td&gt;
&lt;td&gt;$92.01&lt;/td&gt;
&lt;td&gt;$92.01&lt;/td&gt;
&lt;td&gt;$13.50&lt;/td&gt;
&lt;td&gt;$19.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;100,000&lt;/td&gt;
&lt;td&gt;8,333.33&lt;/td&gt;
&lt;td&gt;$920.06&lt;/td&gt;
&lt;td&gt;$920.06&lt;/td&gt;
&lt;td&gt;$135.00&lt;/td&gt;
&lt;td&gt;$135.00&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Vercel's Pro bill assumes the full $20 credit is available for these tasks and you incur no other charges. Lizard's Pro bill is $19 or your usage, whichever is higher, assuming no other usage; it excludes trial credits. We use the same task duration for both providers; test your application to find out how long it takes on each.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You don't need a worker for every task. A small pool can process 100,000 tasks over time. If those tasks arrive at once and need an immediate response, check concurrency limits as well as monthly cost.&lt;/p&gt;

&lt;h3&gt;
  
  
  What if CPU usage is higher?
&lt;/h3&gt;

&lt;p&gt;Keeping 2 vCPUs and 4 GB allocated for one hour gives these compute costs:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Average CPU utilization&lt;/th&gt;
&lt;th&gt;Vercel CPU + memory&lt;/th&gt;
&lt;th&gt;Lizard Small&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0%&lt;/td&gt;
&lt;td&gt;$0.0848&lt;/td&gt;
&lt;td&gt;$0.0162&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10%&lt;/td&gt;
&lt;td&gt;$0.1104&lt;/td&gt;
&lt;td&gt;$0.0162&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;50%&lt;/td&gt;
&lt;td&gt;$0.2128&lt;/td&gt;
&lt;td&gt;$0.0162&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;100%&lt;/td&gt;
&lt;td&gt;$0.3408&lt;/td&gt;
&lt;td&gt;$0.0162&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Creation fees and extras sit outside this table. Lizard costs less at every CPU level shown, including when Vercel charges nothing for CPU. In that case, Vercel's memory charge alone exceeds Lizard Small's running rate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Vercel Sandbox alternatives: compare the paid rates
&lt;/h2&gt;

&lt;p&gt;The table compares the advertised 2 vCPU / 4 GB memory class on each service. E2B and Daytona price memory in GiB, so keep their units when working out your own bill.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Provider&lt;/th&gt;
&lt;th&gt;Running rate for this allocation&lt;/th&gt;
&lt;th&gt;Usage for 10,000 five-minute runs&lt;/th&gt;
&lt;th&gt;Plan or allowance to consider&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;a href="https://lizard.build/sandboxes" rel="noopener noreferrer"&gt;Lizard Sandboxes&lt;/a&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$0.0162/hour&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$13.50&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Pro: $19/month with $19 of usage included; trial credits excluded&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://vercel.com/docs/sandbox/pricing" rel="noopener noreferrer"&gt;Vercel Sandbox&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;$0.1104/hour at 10% CPU&lt;/td&gt;
&lt;td&gt;$92.01 including creation calls&lt;/td&gt;
&lt;td&gt;Pro fee and credit as explained above&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://e2b.dev/pricing" rel="noopener noreferrer"&gt;E2B&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;$0.1656/hour&lt;/td&gt;
&lt;td&gt;$138.00&lt;/td&gt;
&lt;td&gt;Hobby supports the default size; Pro adds $150/month for higher limits&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.daytona.io/pricing" rel="noopener noreferrer"&gt;Daytona&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;$0.1656/hour&lt;/td&gt;
&lt;td&gt;$138.00&lt;/td&gt;
&lt;td&gt;Temporary credits excluded; extra storage adds cost&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The E2B and Daytona calculations use $0.0504 per vCPU-hour and $0.0162 per GiB-hour: &lt;code&gt;2 × $0.0504 + 4 × $0.0162 = $0.1656/hour&lt;/code&gt;. E2B publishes its rates per second; we converted them to hours. Their totals exclude storage or network charges beyond any included allocation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz62y1fts61tqxazldi9w.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz62y1fts61tqxazldi9w.webp" alt="Vercel Sandbox pricing compared with Lizard, E2B and Daytona for 10,000 five-minute runs" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For this paid workload, Lizard has the lowest price of the four providers. Your bill may differ if you have unused credits, qualify for free usage or negotiate a contract. Check the disk space and regions you need, along with the provider's security and lifecycle features, before choosing on price.&lt;/p&gt;

&lt;h3&gt;
  
  
  Lizard: a fixed rate for each sandbox size
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://lizard.build/sandboxes" rel="noopener noreferrer"&gt;Lizard Sandboxes&lt;/a&gt; has three size tiers:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Size&lt;/th&gt;
&lt;th&gt;vCPUs&lt;/th&gt;
&lt;th&gt;Memory&lt;/th&gt;
&lt;th&gt;Local workspace storage&lt;/th&gt;
&lt;th&gt;Running price&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Small&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;4 GB&lt;/td&gt;
&lt;td&gt;5 GB&lt;/td&gt;
&lt;td&gt;$0.0162/hour&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;8 GB&lt;/td&gt;
&lt;td&gt;20 GB&lt;/td&gt;
&lt;td&gt;$0.0324/hour&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Large&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;16 GB&lt;/td&gt;
&lt;td&gt;50 GB&lt;/td&gt;
&lt;td&gt;$0.0648/hour&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;You pay by the second while the sandbox runs, including when it's idle. Each account gets up to 2 TB of sandbox egress over a rolling 30 days. Persistent Volumes cost extra. Pro costs $19 a month and includes $19 of usage; after that you pay as you go. The &lt;a href="https://lizard.build/pricing" rel="noopener noreferrer"&gt;pricing page&lt;/a&gt; lists the trial terms.&lt;/p&gt;

&lt;p&gt;Lizard Sandboxes run as Firecracker microVMs, each with its own kernel. A sandbox that attaches an existing pod-backed Persistent Volume, or restores an older pod snapshot, runs as a Kubernetes pod instead (runc, sharing the host kernel); &lt;code&gt;getInfo().runtime&lt;/code&gt; tells you which. If your application requires a separate kernel, avoid those two cases.&lt;/p&gt;

&lt;p&gt;Once you've checked the runtime and size, you can budget from the time your tasks take to run. Use &lt;a href="https://lizard.build/cli" rel="noopener noreferrer"&gt;Lizard CLI&lt;/a&gt; from your terminal, or call the API described in the &lt;a href="https://lizard.build/docs/sandboxes/" rel="noopener noreferrer"&gt;Sandboxes documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  E2B: longer sessions can mean a Pro subscription
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://e2b.dev/pricing" rel="noopener noreferrer"&gt;E2B's pricing page&lt;/a&gt; lists default-size sandboxes on Hobby, with sessions up to one hour and 20 concurrent instances. Pro adds custom CPU and RAM, sessions up to 24 hours, and higher concurrency for a $150 monthly fee plus usage.&lt;/p&gt;

&lt;p&gt;Our short tasks fit Hobby's default size and session limit, provided you schedule them within its concurrency limit. If you need Pro, the same usage plus the base fee totals $288 before extras or credits. Our &lt;a href="https://lizard.build/blog/e2b-sandbox" rel="noopener noreferrer"&gt;E2B sandbox guide&lt;/a&gt; covers the lifecycle details to check before choosing a plan.&lt;/p&gt;

&lt;h3&gt;
  
  
  Daytona: budget for the files you keep
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.daytona.io/pricing" rel="noopener noreferrer"&gt;Daytona&lt;/a&gt; lists CPU, memory and storage separately and bills by the second. Its first 5 GiB of storage are free; additional storage costs $0.000108 per GiB-hour. It also publishes GPU options.&lt;/p&gt;

&lt;p&gt;Our example fits within the included storage. For a job with a large working directory, add the cost of the space it uses and the time you keep it. If the job needs a GPU, add that rate too.&lt;/p&gt;

&lt;h2&gt;
  
  
  When Vercel Sandbox is worth the higher paid rate
&lt;/h2&gt;

&lt;p&gt;If your app already runs on Vercel, you may prefer to keep its sandbox tasks in the same account and tools, especially when unused credit covers them. Moving providers means spending time on authentication, retries and file handling. Include that work in the decision.&lt;/p&gt;

&lt;p&gt;Vercel has &lt;a href="https://vercel.com/docs/sandbox/concepts/regions" rel="noopener noreferrer"&gt;19 regions and region failover on paid plans&lt;/a&gt;. If your agent needs to run near your users or data, check those locations before comparing hourly rates.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://vercel.com/docs/sandbox/concepts" rel="noopener noreferrer"&gt;Vercel runs sandboxes in Firecracker microVMs&lt;/a&gt;. Its persistent sandboxes save the filesystem when they stop and restore it for the next session. Check whether your application needs those files or also needs to preserve running processes.&lt;/p&gt;

&lt;p&gt;The current quotas permit 45-minute sessions on Hobby and 24-hour sessions on Pro, with up to 10 and 10,000 concurrent sandboxes respectively. The Pro limit is 8 vCPUs and 16 GB memory per instance. Current SDK configurations include 64 GB of ephemeral disk, more than Lizard Small's 5 GB workspace. See &lt;a href="https://vercel.com/docs/sandbox/pricing" rel="noopener noreferrer"&gt;Vercel's resource limits&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to measure before switching
&lt;/h2&gt;

&lt;p&gt;Run a task you expect to use often and record:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;How long it takes to get a usable result, including setup, package installation and retries.&lt;/li&gt;
&lt;li&gt;How much CPU time and allocated memory it uses, so you can calculate Active CPU charges.&lt;/li&gt;
&lt;li&gt;Which files you keep afterward and what retention and recovery will cost.&lt;/li&gt;
&lt;li&gt;How much network traffic it generates, including result downloads, preview ports and calls to other services.&lt;/li&gt;
&lt;li&gt;How many tasks need to run at once and how long each session lasts. Check both against the account's limits.&lt;/li&gt;
&lt;li&gt;Which runtime runs the task and what it can access. Give it only the credentials it needs.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Stop workers when they finish and remove stored data you no longer need. Vercel can still charge for &lt;a href="https://vercel.com/docs/sandbox/concepts/snapshots" rel="noopener noreferrer"&gt;snapshots&lt;/a&gt; after a sandbox stops. Lizard charges the size's running rate for as long as you leave it running, even when it's idle.&lt;/p&gt;

&lt;p&gt;Try a small batch first. Divide its cost by the number of tasks that succeeded, then compare that figure with what you pay now before moving more traffic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with a Small sandbox
&lt;/h2&gt;

&lt;p&gt;For our paid task example, Lizard's usage is $13.50 against Vercel's $92.01, and on Lizard Pro that bills $19. You can estimate its running cost from the size and duration alone. Each sandbox runs as a Firecracker microVM with its own kernel.&lt;/p&gt;

&lt;p&gt;If the runtime, disk space and account limits fit your project, &lt;a href="https://lizard.build/sandboxes" rel="noopener noreferrer"&gt;try Lizard Sandboxes&lt;/a&gt; with one of your own tasks. Check the result and the charges. The &lt;a href="https://lizard.build/pricing" rel="noopener noreferrer"&gt;pricing page&lt;/a&gt; covers the costs to include when you increase usage.&lt;/p&gt;




&lt;p&gt;Originally published on the &lt;a href="https://lizard.build/blog/vercel-sandbox-pricing" rel="noopener noreferrer"&gt;Lizard blog&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>cloud</category>
      <category>devops</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Codex Exec: Automate Deployment Checks from the Terminal</title>
      <dc:creator>Yura Dubinin</dc:creator>
      <pubDate>Mon, 28 Sep 2026 10:57:09 +0000</pubDate>
      <link>https://dev.to/yuraoak/codex-exec-automate-deployment-checks-from-the-terminal-4bg2</link>
      <guid>https://dev.to/yuraoak/codex-exec-automate-deployment-checks-from-the-terminal-4bg2</guid>
      <description>&lt;p&gt;&lt;code&gt;codex exec&lt;/code&gt; runs Codex without the interactive terminal interface. Give it a prompt or pipe in data, then save the answer for your next script step. This guide builds a deployment report with JSONL events, a schema-constrained result and an exit code based on real HTTP checks.&lt;/p&gt;

&lt;p&gt;You will test two versions of a small quote API: one works, and one returns HTTP 200 from its health endpoint while the quote route fails. The complete example includes the collector, report schema and validation script.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run Codex without the interactive interface
&lt;/h2&gt;

&lt;p&gt;From a trusted Git repository, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;codex &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;--sandbox&lt;/span&gt; read-only &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="s2"&gt;"Summarize this repository in three sentences. Do not change files."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Codex writes progress to stderr and its final answer to stdout. You can redirect that answer to a file. The &lt;a href="https://learn.chatgpt.com/docs/non-interactive-mode" rel="noopener noreferrer"&gt;official non-interactive guide&lt;/a&gt; covers this behavior and the supported automation patterns.&lt;/p&gt;

&lt;p&gt;For a deployment report, we will supply the observations on stdin. A small Python collector makes the network requests. Codex explains the evidence, and a separate function checks the report against those observations.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flizard.build%2Fblog-images%2Fcodex-exec%2Fworkflow.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flizard.build%2Fblog-images%2Fcodex-exec%2Fworkflow.svg" alt="Codex exec: HTTP evidence, JSONL events and a validated final report" width="1200" height="630"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Understand the three output files
&lt;/h2&gt;

&lt;p&gt;These files have different roles:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;File&lt;/th&gt;
&lt;th&gt;Contains&lt;/th&gt;
&lt;th&gt;How to read it&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;events.jsonl&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Run events from &lt;code&gt;--json&lt;/code&gt;, one JSON object per line&lt;/td&gt;
&lt;td&gt;Parse each nonempty line separately&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;report.json&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Final answer written by &lt;code&gt;-o&lt;/code&gt;, shaped by &lt;code&gt;--output-schema&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Parse one JSON object&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;stderr.log&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Diagnostics from the CLI process&lt;/td&gt;
&lt;td&gt;Keep it for troubleshooting&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;--json&lt;/code&gt; changes stdout into an event stream. It does not make the whole stream a single report object. &lt;code&gt;--output-schema&lt;/code&gt; describes the final answer, and &lt;code&gt;-o&lt;/code&gt; saves that answer separately. This distinction prevents a common automation bug: trying to parse the entire event log with one JSON read.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prepare the example
&lt;/h2&gt;

&lt;p&gt;Use Python 3.10 or later and an authenticated Codex CLI. The Python files need no third-party packages. The shell commands below target Bash or Zsh on macOS or Linux.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;codex &lt;span class="nt"&gt;--version&lt;/span&gt;
codex login status
&lt;span class="nb"&gt;mkdir &lt;/span&gt;codex-deployment-check
&lt;span class="nb"&gt;cd &lt;/span&gt;codex-deployment-check
&lt;span class="k"&gt;for &lt;/span&gt;file &lt;span class="k"&gt;in &lt;/span&gt;demo.py collect.py gate.py run.py report.schema.json verify.py&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do
  &lt;/span&gt;curl &lt;span class="nt"&gt;--fail&lt;/span&gt; &lt;span class="nt"&gt;--silent&lt;/span&gt; &lt;span class="nt"&gt;--show-error&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="s2"&gt;"https://lizard.build/blog-examples/agent-deployment-checks/&lt;/span&gt;&lt;span class="nv"&gt;$file&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--output&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$file&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Read the downloaded files before executing them. Start the demo and keep it running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 demo.py &lt;span class="nt"&gt;--port&lt;/span&gt; 8787
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The application has two GET routes. &lt;code&gt;/healthz&lt;/code&gt; returns &lt;code&gt;status: ok&lt;/code&gt;. &lt;code&gt;/api/quote?quantity=3&lt;/code&gt; calculates a quote for three items at 1,200 cents each. The expected result is $36.00 (3,600 cents). The example uses integer cents to avoid rounding in the assertion.&lt;/p&gt;

&lt;p&gt;Open another terminal in the same folder for the remaining commands.&lt;/p&gt;

&lt;h2&gt;
  
  
  Collect and inspect the HTTP evidence
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 collect.py http://127.0.0.1:8787 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; evidence.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The collector records the URL, check time, HTTP status and whether each response matches its expected fields. It makes two bounded requests, rejects redirects and caps each response at 64 KiB. It sends expected values and booleans to the model, without copying arbitrary response text.&lt;/p&gt;

&lt;p&gt;For your application, replace the demo paths and expected values in both &lt;code&gt;collect.py&lt;/code&gt; and &lt;code&gt;gate.py&lt;/code&gt;. Choose a route that exercises useful behavior: calculate a price, read a seeded database record or fetch an existing document. Match the response content as well as the status code.&lt;/p&gt;

&lt;p&gt;The collector's exit code says whether it collected evidence. A failed application check still produces an evidence file, so Codex can explain the failure. The final gate determines the job's result.&lt;/p&gt;

&lt;h2&gt;
  
  
  Request a structured report
&lt;/h2&gt;

&lt;p&gt;From a trusted Git repository containing the files, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;codex &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;--ignore-user-config&lt;/span&gt; &lt;span class="nt"&gt;--ephemeral&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--sandbox&lt;/span&gt; read-only &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--json&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--output-schema&lt;/span&gt; report.schema.json &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-o&lt;/span&gt; report.json &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="s2"&gt;"Explain the evidence on stdin. Use no tools. Copy its verdict, list failed check names in failed_checks, and give a summary and next_step. Do not infer a root cause from HTTP status alone."&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &amp;lt; evidence.json &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; events.jsonl 2&amp;gt; stderr.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you use only the new download folder, add &lt;code&gt;--skip-git-repo-check&lt;/code&gt;. The complete wrapper does so in a temporary directory made for the report. Use that flag deliberately when no repository is needed.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;--ignore-user-config&lt;/code&gt; skips the user's main Codex configuration file while retaining normal authentication. &lt;code&gt;--ephemeral&lt;/code&gt; prevents saving the session rollout. The shell still saves the three explicit output files above. &lt;code&gt;--sandbox read-only&lt;/code&gt; limits model-generated commands; the shell's redirects write the artifacts.&lt;/p&gt;

&lt;p&gt;The schema requires &lt;code&gt;verdict&lt;/code&gt;, &lt;code&gt;failed_checks&lt;/code&gt;, &lt;code&gt;summary&lt;/code&gt; and &lt;code&gt;next_step&lt;/code&gt;, and disallows extra fields. The report should explain what the supplied checks establish. A response can suggest inspecting application logs after a 503, but the status code alone does not prove a database failure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Parse the stream and the final answer separately
&lt;/h2&gt;

&lt;p&gt;In our live test, Codex emitted these event types in order:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;thread.started
turn.started
item.completed
turn.completed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The completed item was an agent message. These particular runs made no tool calls. Other tasks can produce more events, including command executions, tool calls and errors; do not require every successful run to have exactly four lines.&lt;/p&gt;

&lt;p&gt;The wrapper reads each event and rejects &lt;code&gt;turn.failed&lt;/code&gt; or &lt;code&gt;error&lt;/code&gt;. It also requires &lt;code&gt;turn.completed&lt;/code&gt;, a successful process exit and a final report that parses. Then it compares the report's verdict and failed-check names with the HTTP evidence.&lt;/p&gt;

&lt;p&gt;A stream that ends early is an incomplete job. A report file left over from a previous run is also unsafe to reuse. The wrapper creates a new output directory and refuses to overwrite an existing run.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flizard.build%2Fblog-images%2Fcodex-exec%2Foutputs.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flizard.build%2Fblog-images%2Fcodex-exec%2Foutputs.svg" alt="Codex events, final report and diagnostics saved to three separate files" width="1200" height="630"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Run the complete workflow
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 run.py codex http://127.0.0.1:8787 runs/healthy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command collects fresh evidence, launches Codex with a 180-second process timeout, saves its output and validates the report. The wrapper exits 0 only when both application checks pass and the report agrees.&lt;/p&gt;

&lt;p&gt;To reproduce the failure, start a second demo in another terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 demo.py &lt;span class="nt"&gt;--port&lt;/span&gt; 8788 &lt;span class="nt"&gt;--broken&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run the same workflow against that instance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 run.py codex http://127.0.0.1:8788 runs/broken
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The health route returns 200 and the quote route returns 503. Codex receives those observations and returns a failure report. The wrapper exits 1. The reporting process can complete successfully while the application check fails; your automation must use the wrapper's exit code for the application decision.&lt;/p&gt;

&lt;h2&gt;
  
  
  Results from the working example
&lt;/h2&gt;

&lt;p&gt;We ran both scenarios with Codex CLI 0.156.1 and Python 3.12.10 on September 28, 2026. We also checked the Lizard CLI commands against version 4.0.8.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Scenario&lt;/th&gt;
&lt;th&gt;Health route&lt;/th&gt;
&lt;th&gt;Quote route&lt;/th&gt;
&lt;th&gt;Codex report&lt;/th&gt;
&lt;th&gt;Wrapper exit&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Working demo&lt;/td&gt;
&lt;td&gt;200, expected body&lt;/td&gt;
&lt;td&gt;200, $36.00 (3,600 cents)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;pass&lt;/code&gt;, no failed checks&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Broken quote&lt;/td&gt;
&lt;td&gt;200, expected body&lt;/td&gt;
&lt;td&gt;503&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;fail&lt;/code&gt;, &lt;code&gt;quote&lt;/code&gt; failed&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Both model calls completed and produced a report that matched the collected evidence. The broken-run report suggested reviewing logs at the recorded time. It did not claim that the health endpoint established full application health.&lt;/p&gt;

&lt;p&gt;The local validation tests also reject a false success report and incomplete evidence. Run them without a model call:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 verify.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a synthetic HTTP test on a local machine. It does not cover production traffic, public DNS, TLS, database migrations or every route. Add checks for the parts of your own deployment that matter.&lt;/p&gt;

&lt;h2&gt;
  
  
  Add Lizard service state and logs
&lt;/h2&gt;

&lt;p&gt;For an application on Lizard, confirm the target before interpreting failures:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lizard skills get core &lt;span class="nt"&gt;--json&lt;/span&gt;
lizard status &lt;span class="nt"&gt;--json&lt;/span&gt;
lizard ps &lt;span class="nt"&gt;--project&lt;/span&gt; YOUR_PROJECT &lt;span class="nt"&gt;--json&lt;/span&gt;
lizard logs &lt;span class="nt"&gt;--project&lt;/span&gt; YOUR_PROJECT &lt;span class="nt"&gt;--service&lt;/span&gt; YOUR_SERVICE &lt;span class="nt"&gt;--tail&lt;/span&gt; 100 &lt;span class="nt"&gt;--json&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lizard CLI gives you machine-readable service information and a bounded log snapshot. The core guide matches the installed CLI version. Use it when you need more commands or flags, and use explicit project and service selectors in automation.&lt;/p&gt;

&lt;p&gt;Run the adapted HTTP collector against the service's public URL. A container marked as running does not prove that a price lookup or database read works. Compare the HTTP failure time with the service logs to narrow the next investigation. Review and redact log content before sending it to a model.&lt;/p&gt;

&lt;p&gt;If you need to deploy first, start with the &lt;a href="https://lizard.build/docs/guides/deploy-from-coding-agent/" rel="noopener noreferrer"&gt;coding-agent deployment guide&lt;/a&gt;. For apps with data dependencies, the &lt;a href="https://lizard.build/blog/postgres-mcp" rel="noopener noreferrer"&gt;Postgres MCP tutorial&lt;/a&gt; and &lt;a href="https://lizard.build/blog/redis-mcp" rel="noopener noreferrer"&gt;Redis MCP tutorial&lt;/a&gt; explain scoped access for inspecting test data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use the result in automation
&lt;/h2&gt;

&lt;p&gt;Keep three outcomes explicit: application passed, application failed, and report job failed. This wrapper uses 0, 1 and 2 respectively. A timeout, CLI authentication problem, invalid report or contradiction in the output produces code 2.&lt;/p&gt;

&lt;p&gt;Store the evidence alongside the report. That lets a teammate verify the result without trusting a prose summary. Give scheduled runs distinct output paths, set a retention period and avoid storing credentials in artifacts.&lt;/p&gt;

&lt;p&gt;On your own trusted machine, &lt;code&gt;codex exec&lt;/code&gt; can reuse the saved CLI login. For GitHub Actions, follow the &lt;a href="https://learn.chatgpt.com/docs/github-action" rel="noopener noreferrer"&gt;official Codex action guide&lt;/a&gt; for authentication and permission setup. Keep API credentials out of repository files and avoid exposing them to untrusted build steps. Review those runner-specific requirements before transferring a local command into CI.&lt;/p&gt;

&lt;p&gt;Use fresh evidence for each independent check. &lt;code&gt;codex exec resume&lt;/code&gt; can continue a conversation, but it is not needed for this one-shot report. The example's ephemeral mode makes each run independent.&lt;/p&gt;

&lt;h2&gt;
  
  
  Troubleshooting
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;What to inspect&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Not inside a Git repository&lt;/td&gt;
&lt;td&gt;Run from the intended repository, or deliberately use &lt;code&gt;--skip-git-repo-check&lt;/code&gt; for the isolated report folder&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;JSON parser reports extra data&lt;/td&gt;
&lt;td&gt;Parse &lt;code&gt;events.jsonl&lt;/code&gt; one line at a time; parse &lt;code&gt;report.json&lt;/code&gt; as one object&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No final report&lt;/td&gt;
&lt;td&gt;Check the process exit, stderr and failure events&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Wrapper exits 1 although Codex exited 0&lt;/td&gt;
&lt;td&gt;The application check failed; inspect &lt;code&gt;failed_checks&lt;/code&gt; and evidence&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Wrapper exits 2&lt;/td&gt;
&lt;td&gt;Check authentication, timeout, schema, contradictory output or an existing output directory&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A hosted endpoint redirects&lt;/td&gt;
&lt;td&gt;Verify the route and required authentication; this collector rejects redirects&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Where to go next
&lt;/h2&gt;

&lt;p&gt;Use this pattern for a focused deployment check, then add assertions for your application's real dependencies. Keep the checks small enough that a failed result points to a useful next step.&lt;/p&gt;

&lt;p&gt;If your team uses Claude Code, the &lt;a href="https://lizard.build/blog/claude-code-headless" rel="noopener noreferrer"&gt;Claude Code headless guide&lt;/a&gt; shows the same HTTP checks with its result envelope. To run the application itself, use &lt;a href="https://lizard.build/docs/cli/" rel="noopener noreferrer"&gt;Lizard CLI&lt;/a&gt; and add the report after your deployment step.&lt;/p&gt;




&lt;p&gt;Originally published on the &lt;a href="https://lizard.build/blog/codex-exec" rel="noopener noreferrer"&gt;Lizard blog&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>tutorial</category>
      <category>cli</category>
    </item>
    <item>
      <title>Claude Code Headless: Check Your Deployment from the Terminal</title>
      <dc:creator>Yura Dubinin</dc:creator>
      <pubDate>Mon, 28 Sep 2026 10:49:05 +0000</pubDate>
      <link>https://dev.to/yuraoak/claude-code-headless-check-your-deployment-from-the-terminal-2pmf</link>
      <guid>https://dev.to/yuraoak/claude-code-headless-check-your-deployment-from-the-terminal-2pmf</guid>
      <description>&lt;p&gt;Claude Code headless mode runs a prompt from your terminal with &lt;code&gt;claude -p&lt;/code&gt; and exits when the task finishes. You can pipe in data, save the answer and call it from a script. This guide uses it to explain deployment checks: a health endpoint, a price quote and a report that your script can verify.&lt;/p&gt;

&lt;p&gt;The example catches a common failure: &lt;code&gt;/healthz&lt;/code&gt; returns HTTP 200 while a real application route returns 503. You will get a reproducible demo, a JSON report and a nonzero exit code when the application check fails.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with one non-interactive command
&lt;/h2&gt;

&lt;p&gt;With Claude Code installed and signed in, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude &lt;span class="nt"&gt;-p&lt;/span&gt; &lt;span class="s2"&gt;"Explain what an HTTP 503 response tells me in two sentences."&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--tools&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;-p&lt;/code&gt; means print the result and exit. &lt;code&gt;--tools ""&lt;/code&gt; disables the built-in tools for this question. Claude can answer from the prompt without reading your repository or running a shell command. The &lt;a href="https://code.claude.com/docs/en/cli-reference" rel="noopener noreferrer"&gt;Claude Code CLI reference&lt;/a&gt; lists the available flags.&lt;/p&gt;

&lt;p&gt;For a deployment check, give the model observations that your script has already collected. This makes each HTTP request and pass condition easy to inspect. It also keeps deployment credentials out of the model's input.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flizard.build%2Fblog-images%2Fclaude-code-headless%2Fworkflow.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flizard.build%2Fblog-images%2Fclaude-code-headless%2Fworkflow.svg" alt="Claude Code headless: HTTP checks, structured report and result validation" width="1200" height="630"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What you need
&lt;/h2&gt;

&lt;p&gt;Use Python 3.10 or later, a current Claude Code installation and an authenticated account. The demo uses Python's standard library, so it has no Python packages to install. Run the shell examples in Bash or Zsh on macOS or Linux.&lt;/p&gt;

&lt;p&gt;Check the installed CLI and its authentication state:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude &lt;span class="nt"&gt;--version&lt;/span&gt;
claude auth status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If a request fails because the saved session has expired, run &lt;code&gt;claude auth login&lt;/code&gt; and retry. A saved login can exist even when the next API request cannot refresh it.&lt;/p&gt;

&lt;p&gt;For the optional hosted checks, install &lt;a href="https://lizard.build/docs/cli/" rel="noopener noreferrer"&gt;Lizard CLI&lt;/a&gt; and sign in to your own project. If you still need to deploy your application, follow &lt;a href="https://lizard.build/blog/deploy-from-claude-code" rel="noopener noreferrer"&gt;Deploy from Claude Code&lt;/a&gt; first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Download the example and start the demo
&lt;/h2&gt;

&lt;p&gt;Create a new folder and download the six files. Read them before running them. The demo accepts GET requests and keeps no customer data.&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;mkdir &lt;/span&gt;claude-deployment-check
&lt;span class="nb"&gt;cd &lt;/span&gt;claude-deployment-check
&lt;span class="k"&gt;for &lt;/span&gt;file &lt;span class="k"&gt;in &lt;/span&gt;demo.py collect.py gate.py run.py report.schema.json verify.py&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do
  &lt;/span&gt;curl &lt;span class="nt"&gt;--fail&lt;/span&gt; &lt;span class="nt"&gt;--silent&lt;/span&gt; &lt;span class="nt"&gt;--show-error&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="s2"&gt;"https://lizard.build/blog-examples/agent-deployment-checks/&lt;/span&gt;&lt;span class="nv"&gt;$file&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--output&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$file&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="k"&gt;done
&lt;/span&gt;python3 demo.py &lt;span class="nt"&gt;--port&lt;/span&gt; 8787
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Leave that terminal running. In another terminal, change to the same folder. The demo exposes &lt;code&gt;/healthz&lt;/code&gt; and &lt;code&gt;/api/quote?quantity=3&lt;/code&gt;. Each item costs 1,200 cents; a quote for three items must return &lt;code&gt;currency: USD&lt;/code&gt; and &lt;code&gt;total_cents: 3600&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;These are demo routes. For your own application, edit the paths and expected fields in &lt;code&gt;collect.py&lt;/code&gt; and &lt;code&gt;gate.py&lt;/code&gt;. Choose a small operation a user actually needs: reading a seeded record, calculating a price or fetching a saved document. A route that only returns “OK” cannot verify those operations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Collect evidence before asking Claude
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 collect.py http://127.0.0.1:8787 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; evidence.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The collector makes two requests with a five-second timeout for each. It rejects redirects, invalid JSON and responses larger than 64 KiB. It checks both the HTTP status and the expected JSON fields. It records the time, expected values and check results; it does not copy arbitrary response text into the prompt.&lt;/p&gt;

&lt;p&gt;That last choice matters when an endpoint contains user text. A support message or database row can contain instructions aimed at an agent. This example gives Claude a small set of measured fields to explain.&lt;/p&gt;

&lt;p&gt;The collector exits successfully when it writes evidence, including evidence of a failed check. The final check script determines whether the job passes. Keep those two meanings separate in your automation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ask for a structured report
&lt;/h2&gt;

&lt;p&gt;Run this from the folder containing the downloaded files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude &lt;span class="nt"&gt;--safe-mode&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="s2"&gt;"Explain the evidence on stdin. Use no tools. Copy its verdict. List the names of failed checks in failed_checks. Give a short summary and one next_step. Do not infer a root cause from HTTP status alone."&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--tools&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--no-session-persistence&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--output-format&lt;/span&gt; json &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--json-schema&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;report.schema.json&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &amp;lt; evidence.json &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; claude-result.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The example uses &lt;code&gt;--safe-mode&lt;/code&gt; to disable customizations such as hooks, plugins and MCP servers during this report task. It uses the existing account login. Check your installed version's help if it does not recognize the flag.&lt;/p&gt;

&lt;p&gt;Claude's response has an outer result object. When you supply the schema, the report sits inside &lt;code&gt;structured_output&lt;/code&gt;. The outer object also carries run metadata and an &lt;code&gt;is_error&lt;/code&gt; field. A plain JSON response and a schema-constrained response serve different purposes; parse the field your command requested.&lt;/p&gt;

&lt;p&gt;The schema asks for four fields:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Field&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;verdict&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;pass&lt;/code&gt; or &lt;code&gt;fail&lt;/code&gt;, copied from the checks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;failed_checks&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Names of the checks that failed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;summary&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A short explanation of the observed result&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;next_step&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;One concrete follow-up&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The &lt;a href="https://code.claude.com/docs/en/headless" rel="noopener noreferrer"&gt;programmatic execution documentation&lt;/a&gt; describes these output formats. A valid JSON shape does not establish whether the explanation is correct, so the wrapper checks the report against the measured results.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run the complete check
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;run.py&lt;/code&gt; collects fresh evidence, calls Claude with a 180-second process timeout, extracts the report and checks it. Give each run a new output directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 run.py claude http://127.0.0.1:8787 runs/healthy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The directory contains &lt;code&gt;evidence.json&lt;/code&gt;, &lt;code&gt;claude-result.json&lt;/code&gt;, &lt;code&gt;report.json&lt;/code&gt; and &lt;code&gt;stderr.log&lt;/code&gt;. Keep the raw result when debugging a failure; an authentication error can appear in the result on stdout.&lt;/p&gt;

&lt;p&gt;The wrapper uses three exit codes:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Exit code&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Both application checks passed and the report agreed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;1&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;At least one application check failed and the report agreed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;2&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The reporting job failed, timed out or returned invalid or contradictory output&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Code 0 from the Claude process means the agent run completed. The wrapper makes the separate decision about the application. An invalid report cannot turn a failed HTTP check into a successful job.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reproduce a failure that a health check misses
&lt;/h2&gt;

&lt;p&gt;Start a second demo in another terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 demo.py &lt;span class="nt"&gt;--port&lt;/span&gt; 8788 &lt;span class="nt"&gt;--broken&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 run.py claude http://127.0.0.1:8788 runs/broken
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The second demo still answers &lt;code&gt;/healthz&lt;/code&gt; with HTTP 200. Its quote route returns HTTP 503. The evidence therefore records &lt;code&gt;fail&lt;/code&gt;, with &lt;code&gt;quote&lt;/code&gt; as the failed check. With a valid Claude response, the wrapper exits 1.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flizard.build%2Fblog-images%2Fclaude-code-headless%2Ffailure.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flizard.build%2Fblog-images%2Fclaude-code-headless%2Ffailure.svg" alt="A health endpoint returns 200 while the quote route returns 503, so the deployment check fails" width="1200" height="630"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also test the HTTP checks and validation logic without calling a model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 verify.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This checks the healthy and broken demos, then verifies that the gate rejects a false success report and incomplete evidence. It does not use Claude credits.&lt;/p&gt;

&lt;h2&gt;
  
  
  Apply the check to an application on Lizard
&lt;/h2&gt;

&lt;p&gt;Choose the application URL from your project. Inspect the current project context and service state with Lizard CLI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lizard skills get core &lt;span class="nt"&gt;--json&lt;/span&gt;
lizard status &lt;span class="nt"&gt;--json&lt;/span&gt;
lizard ps &lt;span class="nt"&gt;--project&lt;/span&gt; YOUR_PROJECT &lt;span class="nt"&gt;--json&lt;/span&gt;
lizard logs &lt;span class="nt"&gt;--project&lt;/span&gt; YOUR_PROJECT &lt;span class="nt"&gt;--service&lt;/span&gt; YOUR_SERVICE &lt;span class="nt"&gt;--tail&lt;/span&gt; 100 &lt;span class="nt"&gt;--json&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;lizard status&lt;/code&gt; shows the local folder's link. &lt;code&gt;lizard ps&lt;/code&gt; reads the service state for the selected project. JSON logs return a bounded snapshot and exit; they do not keep following the service.&lt;/p&gt;

&lt;p&gt;Use the service's public URL with the same checker after you adapt the two route assertions to your application. If you host the supplied demo itself, bind it to &lt;code&gt;0.0.0.0&lt;/code&gt; and configure the service's port to match. The local examples bind to &lt;code&gt;127.0.0.1&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Read logs around the recorded check time when a route fails. An HTTP 503 alone cannot tell you whether the cause was a database connection, a dependency or application code. Review and redact any logs before adding them to a model prompt.&lt;/p&gt;

&lt;p&gt;For applications that depend on stored data, add a test with a known record. The &lt;a href="https://lizard.build/blog/postgres-mcp" rel="noopener noreferrer"&gt;Postgres MCP guide&lt;/a&gt; explains scoped database access, and the &lt;a href="https://lizard.build/blog/redis-mcp" rel="noopener noreferrer"&gt;Redis MCP guide&lt;/a&gt; covers restricted Redis reads. Use test data and credentials suited to the check.&lt;/p&gt;

&lt;h2&gt;
  
  
  Headless mode, authentication and unattended jobs
&lt;/h2&gt;

&lt;p&gt;Headless mode describes how you run the command. It does not create an unattended login or remove tool permissions. For a scheduled job, prepare authentication on the runner and use an explicit timeout.&lt;/p&gt;

&lt;p&gt;Claude also offers &lt;code&gt;--bare&lt;/code&gt;, which skips much of the normal startup context. Its Anthropic authentication path uses &lt;code&gt;ANTHROPIC_API_KEY&lt;/code&gt; or a configured API key helper; it does not read subscription OAuth credentials. Our account-login example therefore uses &lt;code&gt;--safe-mode&lt;/code&gt;. Review the current documentation before moving the job to CI, where the authentication setup may differ.&lt;/p&gt;

&lt;p&gt;For live progress, Claude supports &lt;code&gt;--output-format stream-json --verbose&lt;/code&gt;. Each line is an event. Use plain &lt;code&gt;json&lt;/code&gt; when you only need one final result, as this example does. Avoid resuming an old conversation for an independent deployment check; each run should use fresh observations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Troubleshooting
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;Check next&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;OAuth session expired&lt;/td&gt;
&lt;td&gt;Run &lt;code&gt;claude auth login&lt;/code&gt;, then retry the actual request&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The report file contains an error&lt;/td&gt;
&lt;td&gt;Inspect the Claude exit code and outer &lt;code&gt;is_error&lt;/code&gt; field&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;structured_output&lt;/code&gt; is missing&lt;/td&gt;
&lt;td&gt;Confirm both schema and JSON output flags reached the CLI&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A tool waits for approval&lt;/td&gt;
&lt;td&gt;Decide which operation the job needs; this report task disables built-in tools&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;/healthz&lt;/code&gt; passes but the wrapper exits 1&lt;/td&gt;
&lt;td&gt;Inspect the quote check and logs at the recorded time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The wrapper exits 2&lt;/td&gt;
&lt;td&gt;Inspect stderr, raw result and schema; use a new output directory on retry&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A hosted route redirects to a login page&lt;/td&gt;
&lt;td&gt;Use the correct test endpoint and its intended authentication; the demo checker rejects redirects&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Test scope and next step
&lt;/h2&gt;

&lt;p&gt;On September 28, 2026, we ran the local HTTP and report-validation tests with Python 3.12.10. They covered healthy responses, a broken quote route, a false success report and missing evidence. We checked the command flags against Claude Code 2.1.259, Lizard CLI 4.0.8 and the official documentation. The Claude model response was not part of the completed tests; the report behavior above describes the documented output contract. These synthetic tests do not establish the health of a production application.&lt;/p&gt;

&lt;p&gt;For the same pattern with JSONL events and a separate final report file, see &lt;a href="https://lizard.build/blog/codex-exec" rel="noopener noreferrer"&gt;Codex Exec deployment checks&lt;/a&gt;. To put your own app online, follow the &lt;a href="https://lizard.build/blog/deploy-from-claude-code" rel="noopener noreferrer"&gt;Claude Code deployment guide&lt;/a&gt;, then add a check for the operation your users need most.&lt;/p&gt;




&lt;p&gt;Originally published on the &lt;a href="https://lizard.build/blog/claude-code-headless" rel="noopener noreferrer"&gt;Lizard blog&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>tutorial</category>
      <category>claude</category>
    </item>
    <item>
      <title>Redis MCP: Connect Your AI Agent to Your Database</title>
      <dc:creator>Yura Dubinin</dc:creator>
      <pubDate>Sat, 26 Sep 2026 20:39:40 +0000</pubDate>
      <link>https://dev.to/yuraoak/redis-mcp-connect-your-ai-agent-to-your-database-3058</link>
      <guid>https://dev.to/yuraoak/redis-mcp-connect-your-ai-agent-to-your-database-3058</guid>
      <description>&lt;p&gt;Redis MCP lets an AI client call tools that read and change data in your Redis database. To connect your own database, run the official &lt;code&gt;redis-mcp-server&lt;/code&gt;, give it a Redis address and a restricted credential, then register that process in Cursor or Claude Desktop.&lt;/p&gt;

&lt;p&gt;This guide gets that connection working with two small demo keys. You will read a string and a hash, inspect a TTL, and check that Redis rejects a write. You can start on your computer, then use the same approach with a dedicated &lt;a href="https://lizard.build/redis" rel="noopener noreferrer"&gt;Managed Redis&lt;/a&gt; instance in Lizard.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tested September 27, 2026, Dubai time:&lt;/strong&gt; Python 3.12.10, Redis 8.8.0, &lt;code&gt;redis-mcp-server&lt;/code&gt; 0.5.1, MCP Python SDK 1.30.0 and redis-py 8.1.0. The downloadable test passed 14 checks against an isolated local Redis process through MCP over stdio. It did not test a hosted database, TLS or the Cursor and Claude Desktop interfaces. Those setup steps follow the linked product documentation. This guide was prepared with AI assistance; the test script and results are available below.&lt;/p&gt;

&lt;h2&gt;
  
  
  Choose the Redis MCP server that accesses data
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://redis.io/docs/latest/integrate/redis-mcp/" rel="noopener noreferrer"&gt;official Redis MCP server&lt;/a&gt; connects to a Redis endpoint. Its tools include string and hash reads, writes, key inspection and server information. Redis enforces the permissions of the credential you supply.&lt;/p&gt;

&lt;p&gt;There are several Redis tools with MCP in their names:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;What it connects to&lt;/th&gt;
&lt;th&gt;Use it for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;redis/mcp-redis&lt;/code&gt;, packaged as &lt;code&gt;redis-mcp-server&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Your Redis database&lt;/td&gt;
&lt;td&gt;Reading or changing application data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Redis documentation MCP at &lt;code&gt;redis.io/mcp&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Redis documentation&lt;/td&gt;
&lt;td&gt;Looking up commands and examples&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Redis Cloud MCP&lt;/td&gt;
&lt;td&gt;The Redis Cloud management API&lt;/td&gt;
&lt;td&gt;Managing Redis Cloud resources&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;We use the first one. A documentation connection will not give your agent access to your keys. Redis describes the distinction in its &lt;a href="https://redis.io/docs/latest/develop/setup/build-with-an-agent/" rel="noopener noreferrer"&gt;agent setup guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flizard.build%2Fblog-images%2Fredis-mcp%2Fredis-mcp-connection.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flizard.build%2Fblog-images%2Fredis-mcp%2Fredis-mcp-connection.svg" alt="Cursor or Claude Desktop connects to Redis through a local MCP server and a reader credential." width="1200" height="650"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The MCP process runs on the same computer as your client and communicates through standard input and output, or &lt;strong&gt;stdio&lt;/strong&gt;. It opens a separate network connection to Redis. This setup needs no public HTTP endpoint for MCP. A green connection indicator in the client only shows that the MCP process started; a tool call must still prove that Redis authentication and data access work.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Prepare a small Redis database
&lt;/h2&gt;

&lt;p&gt;Use a dedicated learning instance with synthetic data. You need Python 3.10 or later, &lt;a href="https://docs.astral.sh/uv/getting-started/installation/" rel="noopener noreferrer"&gt;uv&lt;/a&gt;, and access to a Redis server. The local route also needs &lt;code&gt;redis-server&lt;/code&gt; on your PATH.&lt;/p&gt;

&lt;p&gt;Download these files into a new demo directory:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://lizard.build/blog-examples/redis-mcp/requirements.txt" rel="noopener noreferrer"&gt;requirements.txt&lt;/a&gt;: the pinned Python packages.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://lizard.build/blog-examples/redis-mcp/setup.py" rel="noopener noreferrer"&gt;setup.py&lt;/a&gt;: creates two keys and a restricted reader, then writes the MCP configuration.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://lizard.build/blog-examples/redis-mcp/verify.py" rel="noopener noreferrer"&gt;verify.py&lt;/a&gt;: starts its own local Redis process and tests the MCP connection.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://lizard.build/blog-examples/redis-mcp/validation.json" rel="noopener noreferrer"&gt;validation.json&lt;/a&gt;: the results from this guide's test run.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On macOS or Linux, create the Python environment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;uv venv .venv &lt;span class="nt"&gt;--python&lt;/span&gt; 3.12
uv pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--python&lt;/span&gt; .venv/bin/python &lt;span class="nt"&gt;-r&lt;/span&gt; requirements.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In a separate terminal, start a temporary Redis instance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;redis-server &lt;span class="nt"&gt;--bind&lt;/span&gt; 127.0.0.1 &lt;span class="nt"&gt;--port&lt;/span&gt; 6391 &lt;span class="nt"&gt;--save&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="nt"&gt;--appendonly&lt;/span&gt; no
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Leave that terminal running. This local instance has no persistence and listens only on loopback. Stop it with Ctrl+C when you finish. If port 6391 already belongs to another process, pick a free port and set &lt;code&gt;ADMIN_REDIS_URL&lt;/code&gt; to match before running setup.&lt;/p&gt;

&lt;p&gt;In your demo directory, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;.venv/bin/python setup.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The setup script connects to &lt;code&gt;redis://127.0.0.1:6391/0&lt;/code&gt; by default. It creates:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Key&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;th&gt;Initial TTL&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;mcpdemo:status&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;String&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ready&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;3,600 seconds&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;mcpdemo:session:42&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Hash&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;user=demo-user&lt;/code&gt;, &lt;code&gt;language=english&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;3,600 seconds&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;It also creates the user &lt;code&gt;mcp_reader&lt;/code&gt; with a random password. It refuses to replace an existing user or demo keys, so a repeat run on the same instance stops with an explanation.&lt;/p&gt;

&lt;p&gt;The script saves &lt;code&gt;mcp.local.json&lt;/code&gt; with an absolute path to the installed MCP server. The file contains the reader password. Keep it private and add these paths to the demo project's &lt;code&gt;.gitignore&lt;/code&gt; before committing anything:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.venv/
.env
mcp.local.json
.cursor/mcp.json
test-runs/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On Windows, use &lt;code&gt;.venv\Scripts\python.exe&lt;/code&gt; for the Python commands. The script chooses the matching executable path for the generated config. This guide's automated run used macOS.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Understand the reader's permissions
&lt;/h2&gt;

&lt;p&gt;The script applies this Redis ACL policy. This is Redis command syntax, with a placeholder password; the setup script generates the real password for you:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ACL SETUSER mcp_reader reset on &amp;gt;REPLACE_WITH_RANDOM_PASSWORD ~mcpdemo:* -@all +ping +get +hget +hgetall +type +ttl
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The rules permit reads of known strings and hashes under &lt;code&gt;mcpdemo:*&lt;/code&gt;, plus type and TTL checks. They deny writes, administration commands, pub/sub and key enumeration. The &lt;a href="https://redis.io/docs/latest/commands/acl-setuser/" rel="noopener noreferrer"&gt;Redis ACL reference&lt;/a&gt; explains each rule.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A read-only prompt does not enforce read-only access.&lt;/strong&gt; The database credential does. The MCP server can still advertise write tools; Redis should reject their execution for this user. Keep the client's approval prompts enabled as another check on which calls run.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flizard.build%2Fblog-images%2Fredis-mcp%2Fredis-mcp-permissions.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flizard.build%2Fblog-images%2Fredis-mcp%2Fredis-mcp-permissions.svg" alt="Redis allows reads and TTL checks for demo keys; writes, other prefixes and SCAN are denied." width="1200" height="650"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Why the policy does not allow SCAN
&lt;/h3&gt;

&lt;p&gt;An ACL key pattern restricts access to key values. It does not make &lt;code&gt;SCAN&lt;/code&gt; return only the key names under that pattern. In our test, granting &lt;code&gt;+scan&lt;/code&gt; let &lt;code&gt;mcp_reader&lt;/code&gt; discover the name &lt;code&gt;private:sentinel&lt;/code&gt;, even though it could not read that key's value. Revoking &lt;code&gt;SCAN&lt;/code&gt; blocked enumeration again.&lt;/p&gt;

&lt;p&gt;Start with known demo keys. If you later allow browsing on a separate instance that holds no unrelated data, use &lt;code&gt;scan_keys&lt;/code&gt; in small iterations and follow the returned cursor until it becomes zero. &lt;code&gt;COUNT&lt;/code&gt; is a work hint, not a hard result limit. See the &lt;a href="https://redis.io/docs/latest/commands/scan/" rel="noopener noreferrer"&gt;SCAN reference&lt;/a&gt;. The tutorial's default policy deliberately rejects both &lt;code&gt;scan_keys&lt;/code&gt; and &lt;code&gt;scan_all_keys&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Add Redis MCP to Cursor or Claude Desktop
&lt;/h2&gt;

&lt;p&gt;Open the generated &lt;code&gt;mcp.local.json&lt;/code&gt; locally. It has this shape:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"redis-demo"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/ABSOLUTE/PATH/redis-mcp-demo/.venv/bin/redis-mcp-server"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"--host"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"127.0.0.1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"--port"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"6391"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"--db"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"0"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"env"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"REDIS_USERNAME"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"mcp_reader"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"REDIS_PWD"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"YOUR_GENERATED_READER_PASSWORD"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use the actual generated file, not the placeholders above. Merge the &lt;code&gt;redis-demo&lt;/code&gt; entry into your client's existing &lt;code&gt;mcpServers&lt;/code&gt; object; keep any other servers already there.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cursor:&lt;/strong&gt; use &lt;code&gt;.cursor/mcp.json&lt;/code&gt; in the demo project, or &lt;code&gt;~/.cursor/mcp.json&lt;/code&gt; for a user-level setup. Check the server in the client's MCP settings and enable it for the project. Cursor documents the file locations in its &lt;a href="https://cursor.com/help/customization/mcp" rel="noopener noreferrer"&gt;MCP integration guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Claude Desktop:&lt;/strong&gt; merge the entry into &lt;code&gt;claude_desktop_config.json&lt;/code&gt;. On macOS that file lives under &lt;code&gt;~/Library/Application Support/Claude/&lt;/code&gt;. Restart the app after saving. Follow the &lt;a href="https://redis.io/docs/latest/integrate/redis-mcp/client-conf/" rel="noopener noreferrer"&gt;Redis client configuration guide&lt;/a&gt; for the current client steps.&lt;/p&gt;

&lt;p&gt;This guide passes host, port and database as explicit arguments. In the tested 0.5.1 command-line entry point, default CLI values overwrite those settings if you supply only environment variables. Supplying &lt;code&gt;REDIS_HOST&lt;/code&gt; alone can therefore leave the process trying &lt;code&gt;127.0.0.1&lt;/code&gt;. The username and password in the configuration above use the supported &lt;code&gt;REDIS_USERNAME&lt;/code&gt; and &lt;code&gt;REDIS_PWD&lt;/code&gt; variables.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Prove that the connection works
&lt;/h2&gt;

&lt;p&gt;Ask your client to use the Redis tools explicitly. Approve the requested reads and inspect the tool output before relying on the model's summary.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Use redis-demo to get mcpdemo:status. Then use hgetall on
mcpdemo:session:42 and type on that same key. Report the raw
tool results and the remaining TTL. Do not change any data.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The expected results are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;get&lt;/code&gt; returns &lt;code&gt;ready&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;hgetall&lt;/code&gt; returns the two synthetic fields.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;type&lt;/code&gt; returns &lt;code&gt;hash&lt;/code&gt; and a positive TTL below 3,600 seconds.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The official &lt;code&gt;type&lt;/code&gt; tool includes TTL in its response. In our run it returned:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"mcpdemo:session:42"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"hash"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"ttl"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3591&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your number will differ. A TTL of &lt;code&gt;-2&lt;/code&gt; means the key does not exist; &lt;code&gt;-1&lt;/code&gt; means it exists without expiry. If more than an hour has passed, the demo data may have expired. An authorised administrator can reseed the keys, or you can start a fresh local instance and run setup again.&lt;/p&gt;

&lt;p&gt;Next, use the disposable demo to check the restriction:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Use redis-demo to try setting mcpdemo:status to changed once.
Report the exact tool result. Then read mcpdemo:status again.
Do not retry with other tools or credentials.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our MCP call returned &lt;code&gt;User mcp_reader has no permissions to run the 'set' command&lt;/code&gt;, and a separate read still returned &lt;code&gt;ready&lt;/code&gt;. This verifies both the denial and the unchanged value. Some Redis MCP tools return an error as text, so inspect the response content even when the MCP call itself completes.&lt;/p&gt;

&lt;p&gt;You can reproduce the underlying protocol checks without a model API key:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;.venv/bin/python verify.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The script starts its own Redis process on a free loopback port. It does not accept your database URL. It checks authentication, MCP startup, advertised tools, reads, TTL, blocked writes, unchanged data, another key prefix, missing keys, and the &lt;code&gt;SCAN&lt;/code&gt; behaviour above. It stops only the process it created and saves &lt;code&gt;validation.json&lt;/code&gt; beside the script.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Connect a dedicated Managed Redis instance
&lt;/h2&gt;

&lt;p&gt;For a shared application database, create &lt;a href="https://lizard.build/redis" rel="noopener noreferrer"&gt;Managed Redis&lt;/a&gt; in the project dashboard and follow the &lt;a href="https://lizard.build/docs/addons/redis/" rel="noopener noreferrer"&gt;connection guide&lt;/a&gt;. Use a separate learning instance for this exercise. Copy its connection URL into a private local &lt;code&gt;.env&lt;/code&gt; file under the name &lt;code&gt;ADMIN_REDIS_URL&lt;/code&gt;; never paste that administrator credential into an AI chat.&lt;/p&gt;

&lt;p&gt;Load your own trusted file and run setup from the demo directory:&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;set&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt;
&lt;span class="nb"&gt;.&lt;/span&gt; ./.env
&lt;span class="nb"&gt;set&lt;/span&gt; +a
.venv/bin/python setup.py
&lt;span class="nb"&gt;unset &lt;/span&gt;ADMIN_REDIS_URL
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The setup script uses that credential to create the synthetic keys and reader. Its generated MCP configuration contains only the new reader credential. It extracts host, port and database from the URL, and enables TLS certificate verification for &lt;code&gt;rediss://&lt;/code&gt; endpoints. Query parameters and custom certificate paths need a separate configuration; the script stops rather than guessing them.&lt;/p&gt;

&lt;p&gt;The endpoint must be reachable from the computer running MCP. A plain &lt;code&gt;redis://&lt;/code&gt; URL has no transport encryption. Use a trusted private route or a verified TLS endpoint where available; changing the URL prefix does not add TLS support to a server. The current Managed Redis guide shows &lt;code&gt;redis://&lt;/code&gt; connections, so do not assume it supplies a public TLS endpoint.&lt;/p&gt;

&lt;p&gt;Creating an ACL user also requires the provider to permit &lt;code&gt;ACL SETUSER&lt;/code&gt;. If the provider denies it, use its supported user-management controls before connecting the agent. Do not put the administrator password into the MCP config as a workaround.&lt;/p&gt;

&lt;p&gt;Redis ACL changes made at runtime need a persistence mechanism to survive a Redis restart. The current Managed Redis startup configuration does not declare an ACL file, so treat this demo user as temporary and verify it after restarts. Do not assume AOF persistence saves ACL users. Keep the tested permissions in your setup process and review the &lt;a href="https://lizard.build/docs/platform/storage-and-recovery/" rel="noopener noreferrer"&gt;storage and recovery guide&lt;/a&gt; for the service's other limits.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fix common Redis MCP connection errors
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;Check&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;MCP process fails to start&lt;/td&gt;
&lt;td&gt;Use the absolute executable path from the generated config. Confirm that the Python environment still exists.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Connection refused or timeout&lt;/td&gt;
&lt;td&gt;Check the explicit &lt;code&gt;--host&lt;/code&gt; and &lt;code&gt;--port&lt;/code&gt;, Redis availability and network access from the MCP computer.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;WRONGPASS&lt;/code&gt; or authentication failed&lt;/td&gt;
&lt;td&gt;Check &lt;code&gt;REDIS_USERNAME&lt;/code&gt; and &lt;code&gt;REDIS_PWD&lt;/code&gt;. A password for &lt;code&gt;default&lt;/code&gt; does not authenticate &lt;code&gt;mcp_reader&lt;/code&gt;. Check whether a restart removed the temporary ACL user.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;NOPERM&lt;/code&gt; or a permission error&lt;/td&gt;
&lt;td&gt;Compare the requested command and key with the ACL. A denied write, &lt;code&gt;SCAN&lt;/code&gt; or unrelated prefix is expected in this guide.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;WRONGTYPE&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Use &lt;code&gt;type&lt;/code&gt; first. Read strings with &lt;code&gt;get&lt;/code&gt;; read hashes with &lt;code&gt;hgetall&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Missing key or TTL &lt;code&gt;-2&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Check the database number, exact key name and expiry.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TLS certificate failure&lt;/td&gt;
&lt;td&gt;Confirm the server actually supports TLS and supply its trusted CA through the server's documented SSL options. Keep certificate checks enabled.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;JSON.GET&lt;/code&gt; or &lt;code&gt;FT.SEARCH&lt;/code&gt; is unknown&lt;/td&gt;
&lt;td&gt;Those tools need the matching Redis JSON or search capabilities. Core string/hash tools working does not prove those capabilities exist.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  What to build after the connection works
&lt;/h2&gt;

&lt;p&gt;Use this setup to inspect a synthetic session, check a cache entry's lifetime or debug an agent's saved context. Tool results can enter your model conversation, so choose which data the agent may read before you connect a real application.&lt;/p&gt;

&lt;p&gt;If you want the application to save memories automatically, continue with &lt;a href="https://lizard.build/blog/redis-agent-memory" rel="noopener noreferrer"&gt;AI agent memory with Redis&lt;/a&gt;. If your agent needs relational data, use the separate reader role in &lt;a href="https://lizard.build/blog/postgres-mcp" rel="noopener noreferrer"&gt;Postgres MCP&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Start with &lt;a href="https://lizard.build/redis" rel="noopener noreferrer"&gt;Managed Redis&lt;/a&gt;, connect the restricted reader, and verify one successful read and one denied write before expanding the tool set.&lt;/p&gt;




&lt;p&gt;Originally published on the &lt;a href="https://lizard.build/blog/redis-mcp" rel="noopener noreferrer"&gt;Lizard blog&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>redis</category>
      <category>ai</category>
      <category>python</category>
    </item>
    <item>
      <title>AI Agent Memory with Redis: Remember Users Across Sessions</title>
      <dc:creator>Yura Dubinin</dc:creator>
      <pubDate>Fri, 25 Sep 2026 14:57:30 +0000</pubDate>
      <link>https://dev.to/yuraoak/ai-agent-memory-with-redis-remember-users-across-sessions-4fnc</link>
      <guid>https://dev.to/yuraoak/ai-agent-memory-with-redis-remember-users-across-sessions-4fnc</guid>
      <description>&lt;p&gt;AI agent memory with Redis lets your application save context between model calls and load it when the same user returns. The model sees that context in its next request. Redis holds the data; your application decides what to keep, retrieve and forget.&lt;/p&gt;

&lt;p&gt;In this guide, a small Python assistant remembers that Alice prefers vegetarian meals. We stop one Python process, start another with a new session ID, and ask it to recall her preference. Bob gets a separate profile. A forget command removes Alice's live Redis records.&lt;/p&gt;

&lt;p&gt;You can run the example locally, then connect the same code to &lt;a href="https://lizard.build/redis" rel="noopener noreferrer"&gt;Managed Redis&lt;/a&gt; in Lizard. It uses standard Redis Hash and List commands, so this walkthrough needs no vector index, RedisJSON or agent framework.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tested on September 25, 2026:&lt;/strong&gt; Python 3.12.10, Redis 8.8.0, &lt;code&gt;redis-py==5.2.1&lt;/code&gt; and four live calls to &lt;code&gt;openai/gpt-4.1-mini&lt;/code&gt; through OpenRouter. All 16 checks passed. The test covered separate application processes and sessions on a local Redis instance. It did not cover a hosted instance, concurrent requests or recovery from a Redis crash.&lt;/p&gt;

&lt;h2&gt;
  
  
  What should an AI agent remember?
&lt;/h2&gt;

&lt;p&gt;Start with two kinds of data. They need different keys and retention rules.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Memory&lt;/th&gt;
&lt;th&gt;What it contains&lt;/th&gt;
&lt;th&gt;Redis type&lt;/th&gt;
&lt;th&gt;Retention in this example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;User profile&lt;/td&gt;
&lt;td&gt;A preference the user explicitly saves&lt;/td&gt;
&lt;td&gt;Hash&lt;/td&gt;
&lt;td&gt;30 days after the last profile write&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Session history&lt;/td&gt;
&lt;td&gt;Recent user messages and assistant replies&lt;/td&gt;
&lt;td&gt;List&lt;/td&gt;
&lt;td&gt;Latest 20 messages; expires 24 hours after the last completed turn&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The profile belongs to the user, so a new session can read it. Conversation history belongs to one user and one session. Starting a second session does not copy the first session's transcript.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flizard.build%2Fblog-images%2Fredis-agent-memory%2Fredis-agent-memory-layers.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flizard.build%2Fblog-images%2Fredis-agent-memory%2Fredis-agent-memory-layers.svg" alt="A Redis Hash holds Alice's preference across two sessions, while separate Lists hold each session's recent messages." width="1200" height="650"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This distinction matters when the agent answers “What do you know about me?” A recent message can disappear from a bounded history list. A saved preference has its own retention period. Neither has to stay in the model's context forever.&lt;/p&gt;

&lt;p&gt;Redis also offers a separate &lt;a href="https://redis.io/docs/latest/develop/ai/context-engine/agent-memory/" rel="noopener noreferrer"&gt;Redis Agent Memory service&lt;/a&gt;. This tutorial builds a small memory layer in application code using a Redis connection. It does not use that service or its automatic extraction features.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Set up the demo
&lt;/h2&gt;

&lt;p&gt;You need Python 3.10 or later, a disposable Redis instance and an OpenRouter API key. Use invented preferences while testing: the saved profile and selected chat messages go to the model provider on each call.&lt;/p&gt;

&lt;p&gt;Download the complete, tested program and install its one Python dependency:&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;mkdir &lt;/span&gt;redis-memory-demo
&lt;span class="nb"&gt;cd &lt;/span&gt;redis-memory-demo
python3 &lt;span class="nt"&gt;-m&lt;/span&gt; venv .venv
&lt;span class="nb"&gt;.&lt;/span&gt; .venv/bin/activate
python &lt;span class="nt"&gt;-m&lt;/span&gt; pip &lt;span class="nb"&gt;install &lt;/span&gt;&lt;span class="nv"&gt;redis&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;5.2.1
curl &lt;span class="nt"&gt;-fsSLo&lt;/span&gt; memory_agent.py &lt;span class="se"&gt;\&lt;/span&gt;
  https://lizard.build/blog-examples/redis-agent-memory/memory_agent.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a local test, run Redis in a separate terminal. This command binds it to loopback on port 6387; keep that terminal running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;redis-server &lt;span class="nt"&gt;--bind&lt;/span&gt; 127.0.0.1 &lt;span class="nt"&gt;--port&lt;/span&gt; 6387 &lt;span class="nt"&gt;--save&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="nt"&gt;--appendonly&lt;/span&gt; no
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This local Redis process is deliberately disposable. Its data remains available when the &lt;strong&gt;Python application&lt;/strong&gt; exits, but stopping Redis loses that data. The test below restarts the application, not the database.&lt;/p&gt;

&lt;p&gt;Create a private &lt;code&gt;.env&lt;/code&gt; file in the demo directory using your editor:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;REDIS_URL=redis://127.0.0.1:6387/0
OPENROUTER_API_KEY=replace-with-your-key
OPENROUTER_MODEL=openai/gpt-4.1-mini
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Keep &lt;code&gt;.env&lt;/code&gt; out of Git. Restrict access and load it into the current shell:&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;chmod &lt;/span&gt;600 .env
&lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt;
&lt;span class="nb"&gt;.&lt;/span&gt; ./.env
&lt;span class="nb"&gt;set&lt;/span&gt; +a
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The example calls the &lt;a href="https://openrouter.ai/docs/api/reference/overview" rel="noopener noreferrer"&gt;OpenRouter Chat Completions API&lt;/a&gt;. Redis handles the same memory reads and writes if you replace the model call with another provider.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Give each user and session their own keys
&lt;/h2&gt;

&lt;p&gt;The program creates keys like these:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;agentmem:v1:{alice}:profile
agentmem:v1:{alice}:session:session-1
agentmem:v1:{alice}:session:session-2
agentmem:v1:{bob}:profile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The version prefix gives future data formats a separate namespace. The user ID separates profiles. The session ID separates conversations. The braces are a Redis hash tag; they keep one user's keys in the same hash slot if you later use Redis Cluster. This guide tests a single Redis instance.&lt;/p&gt;

&lt;p&gt;The demo validates IDs before building keys. In a web application, derive the user ID from the authenticated server session. Do not accept another user's ID from a request body and treat it as proof of identity. Redis key names alone do not enforce who can access a user's data.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Save an explicit preference
&lt;/h2&gt;

&lt;p&gt;Save Alice's choice:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python memory_agent.py remember &lt;span class="nt"&gt;--user&lt;/span&gt; alice &lt;span class="nt"&gt;--preference&lt;/span&gt; vegetarian
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The command prints &lt;code&gt;Preference saved.&lt;/code&gt; Internally, it writes a field to a &lt;a href="https://redis.io/docs/latest/develop/data-types/hashes/" rel="noopener noreferrer"&gt;Redis Hash&lt;/a&gt; and sets the profile's expiry in a transaction:&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="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pipeline&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;transaction&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;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;hset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;profile&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mapping&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;dietary_preference&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;preference&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="n"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;expire&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;profile&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The only allowed values are &lt;code&gt;vegetarian&lt;/code&gt;, &lt;code&gt;vegan&lt;/code&gt; and &lt;code&gt;no_preference&lt;/code&gt;. That small schema makes the example easy to inspect. The model cannot write arbitrary claims into the profile. In a real product, a “Remember this” control can make the same validated write after the user confirms it.&lt;/p&gt;

&lt;p&gt;This guide does not infer preferences from every chat message. Changing or correcting a preference uses the same explicit command, which overwrites that field and renews its 30-day TTL.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Load memory before calling the model
&lt;/h2&gt;

&lt;p&gt;Ask the assistant to recall the saved choice:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python memory_agent.py chat &lt;span class="nt"&gt;--user&lt;/span&gt; alice &lt;span class="nt"&gt;--session&lt;/span&gt; session-1 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--message&lt;/span&gt; &lt;span class="s2"&gt;"What dietary preference have I saved?"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In our test, the model replied:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your saved dietary preference is vegetarian.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For each call, the application reads the user's profile and the current session's recent messages. It builds the model request in this order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Instructions that define the assistant's task.&lt;/li&gt;
&lt;li&gt;A data message containing the allowed saved preference.&lt;/li&gt;
&lt;li&gt;This session's recent user and assistant messages.&lt;/li&gt;
&lt;li&gt;The new user question.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The model has no direct Redis credentials or general database tool. It only receives the selected context. After a successful reply, the app stores the new user and assistant messages together:&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="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pipeline&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;transaction&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;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rpush&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;history&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;rows&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ltrim&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;history&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;20&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="n"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;expire&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;history&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each turn contributes two messages, so the list keeps the last ten complete turns. The app also caps each message at 2,000 characters. A message count alone would not bound context size if one message could contain an entire book.&lt;/p&gt;

&lt;p&gt;In this example, reading memory does not renew its expiry. Profile writes renew the profile TTL; completed chat turns renew the session TTL. See the &lt;a href="https://redis.io/docs/latest/commands/expire/" rel="noopener noreferrer"&gt;Redis EXPIRE reference&lt;/a&gt; for how expiry interacts with updates.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Start a new process and a new session
&lt;/h2&gt;

&lt;p&gt;Each CLI command starts and exits its own Python process. Run a second chat command with a different session ID:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python memory_agent.py chat &lt;span class="nt"&gt;--user&lt;/span&gt; alice &lt;span class="nt"&gt;--session&lt;/span&gt; session-2 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--message&lt;/span&gt; &lt;span class="s2"&gt;"What dietary preference have I saved?"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The model again returned &lt;code&gt;Your saved dietary preference is vegetarian.&lt;/code&gt; The new session began without the first conversation's messages. Its request contained the shared user profile, which was enough to answer.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flizard.build%2Fblog-images%2Fredis-agent-memory%2Fredis-agent-memory-flow.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flizard.build%2Fblog-images%2Fredis-agent-memory%2Fredis-agent-memory-flow.svg" alt="After the app restarts, it loads Alice's saved preference before the model call and writes the reply to the new session." width="1200" height="650"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Inspect the records the application reads:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python memory_agent.py inspect &lt;span class="nt"&gt;--user&lt;/span&gt; alice &lt;span class="nt"&gt;--session&lt;/span&gt; session-2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see a profile with &lt;code&gt;dietary_preference&lt;/code&gt; and a history with that session's user question and assistant answer. The model has not learned a new weight or gained permanent internal memory. The application supplies the stored context on each request.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Check user separation and forgetting
&lt;/h2&gt;

&lt;p&gt;First, inspect another user's context:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python memory_agent.py inspect &lt;span class="nt"&gt;--user&lt;/span&gt; bob &lt;span class="nt"&gt;--session&lt;/span&gt; session-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a fresh Bob profile, the result is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"profile"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"history"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Asking Bob's assistant the same preference question produced &lt;code&gt;Your dietary preference is unknown.&lt;/code&gt; in our test. The empty context is the deterministic isolation check; model wording can vary.&lt;/p&gt;

&lt;p&gt;Next, stop any requests for Alice and remove her live Redis memory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python memory_agent.py forget-user &lt;span class="nt"&gt;--user&lt;/span&gt; alice
python memory_agent.py inspect &lt;span class="nt"&gt;--user&lt;/span&gt; alice &lt;span class="nt"&gt;--session&lt;/span&gt; session-1
python memory_agent.py inspect &lt;span class="nt"&gt;--user&lt;/span&gt; alice &lt;span class="nt"&gt;--session&lt;/span&gt; session-2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both inspections should return empty profiles and histories. The command scans only Alice's validated key prefix and unlinks matching keys. It leaves Bob's keys alone.&lt;/p&gt;

&lt;p&gt;For a deployed app, block new writes for that user while deletion runs. Otherwise, a reply that finishes during the scan could recreate a session. Deleting Redis keys also does not delete provider logs, backups or records in another database; those stores need their own retention and deletion rules.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we tested
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://lizard.build/blog-examples/redis-agent-memory/verify.py" rel="noopener noreferrer"&gt;verification script&lt;/a&gt; starts a new Redis process on an available loopback port. It never connects to an existing database. Its &lt;a href="https://lizard.build/blog-examples/redis-agent-memory/validation.json" rel="noopener noreferrer"&gt;saved results&lt;/a&gt; record the versions, scope and four model replies.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Check&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A saved preference survives separate Python processes&lt;/td&gt;
&lt;td&gt;Passed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A new session loads the profile without the old transcript&lt;/td&gt;
&lt;td&gt;Passed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Another user starts with an empty context&lt;/td&gt;
&lt;td&gt;Passed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Expired profile and session keys disappear&lt;/td&gt;
&lt;td&gt;Passed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;History stays within 20 messages and preserves complete turns&lt;/td&gt;
&lt;td&gt;Passed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Forgetting removes both sessions and the profile, leaving another user intact&lt;/td&gt;
&lt;td&gt;Passed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Live model calls recall the preference before deletion and report it unknown afterward&lt;/td&gt;
&lt;td&gt;Passed&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The harness ran 16 checks in total. These results show that the example's reads and writes work as described. They do not establish a production availability or data recovery guarantee.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connect the example to Managed Redis
&lt;/h2&gt;

&lt;p&gt;After the local test, create a separate Redis instance for your project. A new account must first start the 7-day Pro trial (card required); until then, &lt;code&gt;lizard add&lt;/code&gt; returns HTTP 402 with a Checkout link that &lt;code&gt;lizard billing start&lt;/code&gt; opens. In a linked Lizard project, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lizard add redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a deployed service named &lt;code&gt;api&lt;/code&gt;, set the connection reference and redeploy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lizard secrets &lt;span class="nb"&gt;set &lt;/span&gt;&lt;span class="nv"&gt;REDIS_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'${{redis.REDIS_PRIVATE_URL}}'&lt;/span&gt; &lt;span class="nt"&gt;--service&lt;/span&gt; api
lizard redeploy &lt;span class="nt"&gt;--service&lt;/span&gt; api
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The private URL works from services in the same project and region; from your computer, use &lt;code&gt;REDIS_URL&lt;/code&gt;. These commands assume the service already exists and has its model API key configured. They connect that service to Redis; the CLI demo itself is not an HTTP server. Follow the &lt;a href="https://lizard.build/docs/addons/redis/" rel="noopener noreferrer"&gt;Managed Redis connection guide&lt;/a&gt; for environment variables and access from your computer.&lt;/p&gt;

&lt;p&gt;You can inspect the demo's keys in the Redis browser in the dashboard. Keep Redis credentials on the server, and use a private connection or verified TLS when your provider supplies it. A plain &lt;code&gt;redis://&lt;/code&gt; URL does not add transport encryption.&lt;/p&gt;

&lt;h3&gt;
  
  
  Decide which memories must survive data loss
&lt;/h3&gt;

&lt;p&gt;Memory surviving an application restart does not mean it survives every Redis failure. Expiry, &lt;a href="https://redis.io/docs/latest/develop/reference/eviction/" rel="noopener noreferrer"&gt;key eviction&lt;/a&gt;, persistence settings and backups all matter.&lt;/p&gt;

&lt;p&gt;Managed Redis configures no eviction policy and no append-only file. It keeps data on a persistent volume through Redis's default periodic snapshots. If it runs out of memory, the instance restarts and writes made since the last snapshot can be lost. For preferences you cannot afford to lose, keep the source record in &lt;a href="https://lizard.build/postgres" rel="noopener noreferrer"&gt;Managed Postgres&lt;/a&gt; and use Redis for recent context or a reloadable copy. Review the &lt;a href="https://lizard.build/docs/platform/storage-and-recovery/" rel="noopener noreferrer"&gt;storage and recovery guide&lt;/a&gt; before choosing a retention policy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before you put this behind a web API
&lt;/h2&gt;

&lt;p&gt;The CLI keeps the example small. A shared application also needs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Authentication and ownership checks.&lt;/strong&gt; Derive user IDs on the server and check that each session belongs to that user.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One active turn per session.&lt;/strong&gt; Queue or lock the full read → model call → write sequence. The final Redis transaction alone does not stop two model calls from reading the same old context.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A memory size budget.&lt;/strong&gt; Bound profile fields, message size, history length and the number of sessions. Monitor Redis memory and evictions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A Redis failure policy.&lt;/strong&gt; Fail the request clearly or offer an explicitly stateless mode. Never claim a preference was saved when the write failed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Separate authority from remembered text.&lt;/strong&gt; A saved message can contain hostile instructions. Keep permissions and tool decisions in application code; a system prompt is not an access-control boundary.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Common questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Do I need a vector database for AI agent memory?
&lt;/h3&gt;

&lt;p&gt;You can load a known user's explicit preferences and recent messages by key, as this example does. Vector search becomes useful when the application must find relevant facts in a much larger set of memories. That adds embeddings, index configuration and retrieval tests.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does Redis make an agent remember forever?
&lt;/h3&gt;

&lt;p&gt;Retention depends on TTLs, eviction, persistence and your application's writes. This example deliberately expires data. Keep durable records elsewhere when losing them would break the product.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is this RAG or a semantic cache?
&lt;/h3&gt;

&lt;p&gt;This example retrieves one user's saved context. RAG commonly retrieves relevant source material to help answer a question. A semantic cache reuses a prior answer for a similar query. They can share Redis infrastructure, but they need different data models and tests.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I use LangGraph later?
&lt;/h3&gt;

&lt;p&gt;Yes. LangGraph offers checkpoints for conversation state and stores for memory across threads. Its Redis integration has its own requirements; check the &lt;a href="https://pypi.org/project/langgraph-checkpoint-redis/" rel="noopener noreferrer"&gt;LangGraph Redis package documentation&lt;/a&gt; before replacing this simple client with a framework backend.&lt;/p&gt;

&lt;h2&gt;
  
  
  Give your agent a memory you can inspect
&lt;/h2&gt;

&lt;p&gt;Start with one explicit fact, a separate session history and a test that crosses a process boundary. Add expiry, ownership checks and a way to forget before you add automatic extraction or vector search.&lt;/p&gt;

&lt;p&gt;Create &lt;a href="https://lizard.build/redis" rel="noopener noreferrer"&gt;Managed Redis&lt;/a&gt; for the application's shared context. If your agent also needs to query structured project data, the &lt;a href="https://lizard.build/blog/postgres-mcp" rel="noopener noreferrer"&gt;Postgres MCP guide&lt;/a&gt; covers that connection with a separate database reader role.&lt;/p&gt;




&lt;p&gt;Originally published on the &lt;a href="https://lizard.build/blog/redis-agent-memory" rel="noopener noreferrer"&gt;Lizard blog&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>redis</category>
      <category>ai</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Postgres MCP: connect your AI agent to a database</title>
      <dc:creator>Yura Dubinin</dc:creator>
      <pubDate>Fri, 25 Sep 2026 11:40:38 +0000</pubDate>
      <link>https://dev.to/yuraoak/postgres-mcp-connect-your-ai-agent-to-a-database-pd6</link>
      <guid>https://dev.to/yuraoak/postgres-mcp-connect-your-ai-agent-to-a-database-pd6</guid>
      <description>&lt;p&gt;A Postgres MCP server lets an AI agent inspect a PostgreSQL schema and run queries through the Model Context Protocol. You give the server a database connection; your agent calls its tools to read tables and answer questions about the data.&lt;/p&gt;

&lt;p&gt;This guide connects Cursor to a sample database using Postgres MCP Pro, a separate database role and restricted access mode. The end result is easy to check: the agent should find two active projects with a combined monthly budget of $68. It should fail if it tries to change those rows.&lt;/p&gt;

&lt;p&gt;You can create the database with &lt;a href="https://lizard.build/postgres" rel="noopener noreferrer"&gt;Managed Postgres&lt;/a&gt; on Lizard. The MCP process runs on your computer. The same SQL setup also works with a local PostgreSQL instance you own.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Postgres MCP connects to your database
&lt;/h2&gt;

&lt;p&gt;The agent sends a tool call to the MCP server. The server connects to PostgreSQL, runs the query and returns the result. PostgreSQL checks the permissions of the connection's database role.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flizard.build%2Fblog%2Fpostgres-mcp%2Fpostgres-mcp-connection.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flizard.build%2Fblog%2Fpostgres-mcp%2Fpostgres-mcp-connection.svg" alt="Cursor connects through Postgres MCP Pro to Managed Postgres using the mcp_reader role." width="1440" height="760"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We use &lt;a href="https://github.com/crystaldba/postgres-mcp" rel="noopener noreferrer"&gt;Postgres MCP Pro&lt;/a&gt;, an independent open-source project. It exposes tools for listing schemas, reading table details and executing SQL. Lizard supplies the database in this setup.&lt;/p&gt;

&lt;p&gt;The local connection between Cursor and the MCP process uses &lt;code&gt;stdio&lt;/code&gt;. Your computer must be able to reach the database endpoint. Query results can enter your AI provider's context, so this walkthrough uses invented project names and budgets.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you need
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A new PostgreSQL instance or a separate disposable database, with an owner account that can create a database and a role.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;psql&lt;/code&gt; on your computer.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.astral.sh/uv/getting-started/installation/" rel="noopener noreferrer"&gt;uv&lt;/a&gt;, which runs the pinned Python package.&lt;/li&gt;
&lt;li&gt;Cursor with custom MCP servers enabled.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We tested the SQL and MCP calls with PostgreSQL 14.20, Python 3.12.10, &lt;code&gt;postgres-mcp==0.3.0&lt;/code&gt; and &lt;code&gt;mcp==1.30.0&lt;/code&gt;. The result table below records the scope of those checks.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Create a sample Postgres database
&lt;/h2&gt;

&lt;p&gt;In a new Lizard project, add Managed Postgres from the dashboard. If you already use Lizard CLI and have linked the new project, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lizard add postgres
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The dashboard provides the host, port, database and credentials. Follow the &lt;a href="https://lizard.build/docs/addons/postgres/" rel="noopener noreferrer"&gt;Managed Postgres connection guide&lt;/a&gt; to connect with &lt;code&gt;psql&lt;/code&gt;. Use the owner account for this setup; the agent will receive a different account.&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;psql&lt;/code&gt;, create and switch to a fresh database:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;DATABASE&lt;/span&gt; &lt;span class="n"&gt;mcp_demo&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="k"&gt;connect&lt;/span&gt; &lt;span class="n"&gt;mcp_demo&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;\connect&lt;/code&gt; is a &lt;code&gt;psql&lt;/code&gt; command. If you use a SQL editor, select &lt;code&gt;mcp_demo&lt;/code&gt; before running the next block. If the database name already exists, choose another name and update the later examples.&lt;/p&gt;

&lt;p&gt;Create one table with three rows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;SCHEMA&lt;/span&gt; &lt;span class="n"&gt;demo&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;demo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;projects&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="nb"&gt;integer&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="nb"&gt;text&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="nb"&gt;text&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;CHECK&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'active'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'paused'&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
  &lt;span class="n"&gt;monthly_budget_usd&lt;/span&gt; &lt;span class="nb"&gt;numeric&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&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="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;demo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;projects&lt;/span&gt; &lt;span class="k"&gt;VALUES&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="s1"&gt;'Atlas'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'active'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;49&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;00&lt;/span&gt;&lt;span class="p"&gt;),&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="s1"&gt;'Beacon'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'active'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;19&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;00&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="s1"&gt;'Cedar'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'paused'&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="mi"&gt;00&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These amounts belong to the sample data. They are not Lizard prices.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Give the agent a role that can read the sample table
&lt;/h2&gt;

&lt;p&gt;Create a login with no administrative privileges:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;ROLE&lt;/span&gt; &lt;span class="n"&gt;mcp_reader&lt;/span&gt; &lt;span class="n"&gt;LOGIN&lt;/span&gt;
  &lt;span class="n"&gt;NOSUPERUSER&lt;/span&gt; &lt;span class="k"&gt;NOCREATEDB&lt;/span&gt; &lt;span class="n"&gt;NOCREATEROLE&lt;/span&gt; &lt;span class="n"&gt;NOREPLICATION&lt;/span&gt; &lt;span class="n"&gt;NOINHERIT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run this &lt;code&gt;psql&lt;/code&gt; command to set its password without putting the password in SQL history:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;\password mcp_reader
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The following grants are for the &lt;strong&gt;fresh &lt;code&gt;mcp_demo&lt;/code&gt; database&lt;/strong&gt;. The &lt;code&gt;PUBLIC&lt;/code&gt; revocations affect other roles that use that database, so do not paste this block into an existing shared application database.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;REVOKE&lt;/span&gt; &lt;span class="k"&gt;ALL&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="k"&gt;DATABASE&lt;/span&gt; &lt;span class="n"&gt;mcp_demo&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="k"&gt;PUBLIC&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;REVOKE&lt;/span&gt; &lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="k"&gt;SCHEMA&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="k"&gt;PUBLIC&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;GRANT&lt;/span&gt; &lt;span class="k"&gt;CONNECT&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="k"&gt;DATABASE&lt;/span&gt; &lt;span class="n"&gt;mcp_demo&lt;/span&gt; &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;mcp_reader&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;GRANT&lt;/span&gt; &lt;span class="k"&gt;USAGE&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="k"&gt;SCHEMA&lt;/span&gt; &lt;span class="n"&gt;demo&lt;/span&gt; &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;mcp_reader&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;GRANT&lt;/span&gt; &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;demo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;projects&lt;/span&gt; &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;mcp_reader&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;ALTER&lt;/span&gt; &lt;span class="k"&gt;ROLE&lt;/span&gt; &lt;span class="n"&gt;mcp_reader&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="k"&gt;DATABASE&lt;/span&gt; &lt;span class="n"&gt;mcp_demo&lt;/span&gt;
  &lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="n"&gt;default_transaction_read_only&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;on&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;ALTER&lt;/span&gt; &lt;span class="k"&gt;ROLE&lt;/span&gt; &lt;span class="n"&gt;mcp_reader&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="k"&gt;DATABASE&lt;/span&gt; &lt;span class="n"&gt;mcp_demo&lt;/span&gt;
  &lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="n"&gt;statement_timeout&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'5s'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flizard.build%2Fblog%2Fpostgres-mcp%2Fpostgres-mcp-permissions.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flizard.build%2Fblog%2Fpostgres-mcp%2Fpostgres-mcp-permissions.svg" alt="mcp_reader can read demo.projects but cannot write rows or create tables." width="1440" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This grants access to one table. A table you create later needs its own grant. PostgreSQL may still expose object names through system catalogs; table permissions control access to the rows. See PostgreSQL's &lt;a href="https://www.postgresql.org/docs/current/sql-grant.html" rel="noopener noreferrer"&gt;GRANT reference&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The read-only default helps avoid mistakes, but a client can change that setting. The table grants are what prevent this role from writing to &lt;code&gt;demo.projects&lt;/code&gt;. We checked that an update still fails after turning the default off.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Save the reader connection outside your source code
&lt;/h2&gt;

&lt;p&gt;Build a connection URL using the new role and the &lt;code&gt;mcp_demo&lt;/code&gt; database. Keep the host, port and required TLS settings from your provider's connection instructions. Percent-encode special characters in the password when putting it in a URL; PostgreSQL documents the &lt;a href="https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING-URIS" rel="noopener noreferrer"&gt;connection URI format&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For a hosted endpoint that requires TLS, the shape is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;postgresql://mcp_reader:URL_ENCODED_PASSWORD@DB_HOST:DB_PORT/mcp_demo?sslmode=require
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;sslmode=require&lt;/code&gt; requires encryption. If your provider supplies a CA certificate and hostname for full certificate checks, use its &lt;code&gt;verify-full&lt;/code&gt; configuration. A certificate error needs a matching host and trust configuration; do not solve it by disabling TLS on a hosted connection.&lt;/p&gt;

&lt;p&gt;Add &lt;code&gt;.env.mcp&lt;/code&gt; to your project's &lt;code&gt;.gitignore&lt;/code&gt;, then create that file at the project root:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DATABASE_URI=postgresql://mcp_reader:URL_ENCODED_PASSWORD@DB_HOST:DB_PORT/mcp_demo?sslmode=require
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace every placeholder with your reader connection values. The name is &lt;strong&gt;&lt;code&gt;DATABASE_URI&lt;/code&gt;&lt;/strong&gt;: that is what Postgres MCP Pro expects. Lizard's application connection variable is named &lt;code&gt;DATABASE_URL&lt;/code&gt;; passing that name alone will not configure this MCP server.&lt;/p&gt;

&lt;p&gt;Keep the owner connection out of this file. On macOS or Linux, restrict access to the reader file:&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;chmod &lt;/span&gt;600 .env.mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Configure Postgres MCP in Cursor
&lt;/h2&gt;

&lt;p&gt;Create &lt;code&gt;.cursor/mcp.json&lt;/code&gt; in the same project. If the file already contains other servers, add &lt;code&gt;postgres-demo&lt;/code&gt; inside its existing &lt;code&gt;mcpServers&lt;/code&gt; object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"postgres-demo"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"stdio"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"uvx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"--python"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"3.12"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"--with"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"mcp==1.30.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"--from"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"postgres-mcp==0.3.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"postgres-mcp"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"--access-mode=restricted"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"envFile"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"${workspaceFolder}/.env.mcp"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Cursor supports project MCP configuration and &lt;code&gt;envFile&lt;/code&gt; for local &lt;code&gt;stdio&lt;/code&gt; servers. See its &lt;a href="https://cursor.com/docs/mcp#stdio-server-configuration" rel="noopener noreferrer"&gt;MCP configuration reference&lt;/a&gt;. If Cursor cannot find &lt;code&gt;uvx&lt;/code&gt;, replace the command with its full installed path.&lt;/p&gt;

&lt;p&gt;The two version pins matter. During our check, installing &lt;code&gt;postgres-mcp==0.3.0&lt;/code&gt; without an MCP SDK constraint selected &lt;code&gt;mcp==2.2.0&lt;/code&gt;. The server then failed to import &lt;code&gt;mcp.server.fastmcp&lt;/code&gt;. With &lt;code&gt;mcp==1.30.0&lt;/code&gt;, it started and completed the tests below.&lt;/p&gt;

&lt;p&gt;To check the package launch before opening a database connection, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;uvx &lt;span class="nt"&gt;--python&lt;/span&gt; 3.12 &lt;span class="nt"&gt;--with&lt;/span&gt; &lt;span class="s1"&gt;'mcp==1.30.0'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--from&lt;/span&gt; &lt;span class="s1"&gt;'postgres-mcp==0.3.0'&lt;/span&gt; postgres-mcp &lt;span class="nt"&gt;--help&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enable or restart &lt;code&gt;postgres-demo&lt;/code&gt; in Cursor's MCP settings. Leave tool approval enabled while checking the setup, and inspect the SQL arguments before allowing a call.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Verify the tools and the answer
&lt;/h2&gt;

&lt;p&gt;Start with a schema question:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Use postgres-demo to inspect the demo schema. List its tables and the columns
of demo.projects. Show the tool results. Do not change the database.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The server should expose &lt;code&gt;list_schemas&lt;/code&gt;, &lt;code&gt;list_objects&lt;/code&gt;, &lt;code&gt;get_object_details&lt;/code&gt; and &lt;code&gt;execute_sql&lt;/code&gt;. Confirm that the agent calls the tools and reports &lt;code&gt;id&lt;/code&gt;, &lt;code&gt;name&lt;/code&gt;, &lt;code&gt;status&lt;/code&gt; and &lt;code&gt;monthly_budget_usd&lt;/code&gt; from the table.&lt;/p&gt;

&lt;p&gt;Then ask:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Using demo.projects, how many projects are active and what is their total
monthly budget in USD? Show the SQL and the database result.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A query for that answer is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
  &lt;span class="k"&gt;count&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&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;active_projects&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;monthly_budget_usd&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;total_budget_usd&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;demo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;projects&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'active'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The expected values are:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;active_projects&lt;/th&gt;
&lt;th&gt;total_budget_usd&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;68.00&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Finally, check the restriction on this sample table. The &lt;code&gt;WHERE false&lt;/code&gt; condition ensures the query has no matching rows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Use execute_sql to run exactly:
UPDATE demo.projects SET name = name WHERE false;
Report the tool response. Do not retry with another tool or connection.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In our test, restricted mode returned &lt;code&gt;Error: Error validating query&lt;/code&gt;. A separate direct connection using &lt;code&gt;mcp_reader&lt;/code&gt; returned &lt;code&gt;permission denied for table projects&lt;/code&gt; even after we disabled its read-only default. The MCP check and database grants each rejected the operation.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we tested
&lt;/h2&gt;

&lt;p&gt;On 24 September 2026, we ran the sample SQL and real MCP calls against a new local PostgreSQL 14.20 instance with synthetic data. We used Python 3.12.10, Postgres MCP Pro 0.3.0 and MCP SDK 1.30.0.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Check&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Connect as &lt;code&gt;mcp_reader&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Connected to &lt;code&gt;mcp_demo&lt;/code&gt;; read-only default on&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;List the schema, table and columns through MCP&lt;/td&gt;
&lt;td&gt;Returned the sample schema and table fields&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Query the active projects directly and through MCP&lt;/td&gt;
&lt;td&gt;Both returned 2 projects and $68.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Try an update through restricted MCP mode&lt;/td&gt;
&lt;td&gt;Rejected during query validation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Try an update directly with the read-only default off&lt;/td&gt;
&lt;td&gt;Rejected by PostgreSQL table permissions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Read a table in an ungranted test schema&lt;/td&gt;
&lt;td&gt;Rejected by PostgreSQL schema permissions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Check table creation in the public schema and temporary table privileges&lt;/td&gt;
&lt;td&gt;Neither granted&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These checks cover the SQL permissions and MCP protocol. We did not run the Cursor UI flow or deploy a new Lizard database for this test. Follow the checks above against your own endpoint; a connected MCP indicator alone does not prove the database tools work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fix common Postgres MCP connection errors
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;What to check&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;No module named mcp.server.fastmcp&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Use the tested &lt;code&gt;mcp==1.30.0&lt;/code&gt; pin with Postgres MCP Pro 0.3.0. Restart the server after changing its arguments.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;uvx&lt;/code&gt; not found&lt;/td&gt;
&lt;td&gt;Install uv, then use the full path to &lt;code&gt;uvx&lt;/code&gt; in Cursor if needed.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Missing database URL&lt;/td&gt;
&lt;td&gt;Confirm &lt;code&gt;.env.mcp&lt;/code&gt; contains &lt;code&gt;DATABASE_URI&lt;/code&gt; and that &lt;code&gt;envFile&lt;/code&gt; points to the right project.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Password authentication failed&lt;/td&gt;
&lt;td&gt;Use the password for &lt;code&gt;mcp_reader&lt;/code&gt;, check URL encoding and confirm the endpoint.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Connection timed out or refused&lt;/td&gt;
&lt;td&gt;Check host, port, network access and whether the database is running. A private service hostname may not resolve from your laptop.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Certificate verification failed&lt;/td&gt;
&lt;td&gt;Match the provider's hostname, CA certificate and TLS settings.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Permission denied for schema or table&lt;/td&gt;
&lt;td&gt;Check &lt;code&gt;USAGE&lt;/code&gt; on the intended schema and &lt;code&gt;SELECT&lt;/code&gt; on the intended table. Grant only the access the example needs.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Empty table list&lt;/td&gt;
&lt;td&gt;Confirm the database name and schema. This guide puts the table in &lt;code&gt;demo&lt;/code&gt;, not &lt;code&gt;public&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Do you need PostgreSQL extensions?
&lt;/h2&gt;

&lt;p&gt;The schema and data queries in this guide need no extra extension. Postgres MCP Pro also offers performance tools that have different requirements.&lt;/p&gt;

&lt;p&gt;Its top-query analysis uses &lt;code&gt;pg_stat_statements&lt;/code&gt;. Hypothetical index analysis uses &lt;code&gt;hypopg&lt;/code&gt;. Availability, server configuration and role permissions all matter; creating an extension may require an owner action or a server change. Check the project's &lt;a href="https://github.com/crystaldba/postgres-mcp#postgres-extension-installation-optional" rel="noopener noreferrer"&gt;extension requirements&lt;/a&gt; before using those tools.&lt;/p&gt;

&lt;p&gt;Start with the schema and &lt;code&gt;SELECT&lt;/code&gt; checks. An extension-related failure in a tuning tool does not, by itself, mean the basic MCP connection is broken.&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Is Postgres MCP the same as Lizard MCP?
&lt;/h3&gt;

&lt;p&gt;No. This example uses Postgres MCP Pro to query a PostgreSQL database. Managed Postgres provides that database. The connector is a separate project.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I use a different AI agent?
&lt;/h3&gt;

&lt;p&gt;Yes, if its client supports local MCP servers over &lt;code&gt;stdio&lt;/code&gt;. Use the same pinned process, reader credentials and restricted mode, then follow that client's configuration format. The JSON above is for Cursor.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does restricted mode replace database permissions?
&lt;/h3&gt;

&lt;p&gt;Use both. Restricted mode checks queries in the MCP server. PostgreSQL's grants limit what the connection role can do even through another client. Keep the owner account for migrations and administration.&lt;/p&gt;

&lt;h3&gt;
  
  
  Will it create tables or run migrations for me?
&lt;/h3&gt;

&lt;p&gt;This setup grants the reader access to the sample table. It cannot create or change your application's schema. Run reviewed migrations with your normal application deployment process.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connect the database to your app next
&lt;/h2&gt;

&lt;p&gt;Once the agent can inspect the sample schema and return the expected answer, you have a working basis for database questions during development. Keep the agent's reader credentials separate from your application's credentials as you add tables.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://lizard.build/postgres" rel="noopener noreferrer"&gt;Create Managed Postgres&lt;/a&gt; for your project, follow the &lt;a href="https://lizard.build/docs/addons/postgres/" rel="noopener noreferrer"&gt;database connection guide&lt;/a&gt;, or continue with the &lt;a href="https://lizard.build/blog/deploy-cursor-app-postgres" rel="noopener noreferrer"&gt;Cursor app deployment example&lt;/a&gt;. For deploying an MCP service shared by several clients, see the separate &lt;a href="https://lizard.build/docs/guides/deploy-mcp-server/" rel="noopener noreferrer"&gt;remote MCP server guide&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;Originally published on the &lt;a href="https://lizard.build/blog/postgres-mcp" rel="noopener noreferrer"&gt;Lizard blog&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>postgres</category>
      <category>mcp</category>
      <category>ai</category>
    </item>
    <item>
      <title>Welcome to the Lizard blog</title>
      <dc:creator>Yura Dubinin</dc:creator>
      <pubDate>Wed, 23 Sep 2026 12:06:30 +0000</pubDate>
      <link>https://dev.to/yuraoak/welcome-to-the-lizard-blog-1hnn</link>
      <guid>https://dev.to/yuraoak/welcome-to-the-lizard-blog-1hnn</guid>
      <description>&lt;p&gt;The Lizard blog helps developers turn working code into an application they can deploy, check and operate. It covers the decisions that come after the first successful local run: where the process lives, how it reaches its database, what happens to files and how to recover when something fails.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with the task you have
&lt;/h2&gt;

&lt;p&gt;If an agent helped write your app, use the &lt;a href="https://lizard.build/blog/deploy-from-claude-code" rel="noopener noreferrer"&gt;Claude Code deployment guide&lt;/a&gt; or &lt;a href="https://lizard.build/blog/google-antigravity-how-to-deploy-your-app-to-production" rel="noopener noreferrer"&gt;Google Antigravity guide&lt;/a&gt;. Both explain how to check the live application after deployment.&lt;/p&gt;

&lt;p&gt;For Python projects, start with &lt;a href="https://lizard.build/blog/python-app-hosting" rel="noopener noreferrer"&gt;hosting Django, Flask and FastAPI&lt;/a&gt;. If you prefer to manage a server, the &lt;a href="https://lizard.build/blog/deploy-django-app-vps" rel="noopener noreferrer"&gt;Django VPS walkthrough&lt;/a&gt; covers the process, proxy and release setup.&lt;/p&gt;

&lt;p&gt;If you are choosing infrastructure, compare &lt;a href="https://lizard.build/blog/best-paas-providers" rel="noopener noreferrer"&gt;PaaS providers&lt;/a&gt;, learn what &lt;a href="https://lizard.build/blog/container-as-a-service" rel="noopener noreferrer"&gt;container as a service&lt;/a&gt; includes, or assess &lt;a href="https://lizard.build/blog/kubernetes-alternatives" rel="noopener noreferrer"&gt;Kubernetes alternatives&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to read our comparisons
&lt;/h2&gt;

&lt;p&gt;We build Lizard, so these articles include our product and explain where it fits. They should also help you identify when another option suits your requirements better.&lt;/p&gt;

&lt;p&gt;Prices need their billing units, plan terms and sources. A calculation should state its assumptions. A test result should explain what ran and how it was measured. A product feature should not become a promise about your application's performance or bill.&lt;/p&gt;

&lt;p&gt;Use the linked documentation to check the details that matter to your deployment. If you find a mistake or a changed product term, &lt;a href="https://lizard.build/support" rel="noopener noreferrer"&gt;contact us&lt;/a&gt; with the page and the claim. For the current command reference and setup instructions, go to the &lt;a href="https://lizard.build/docs/" rel="noopener noreferrer"&gt;Lizard documentation&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;Originally published on the &lt;a href="https://lizard.build/blog/welcome-to-the-lizard-blog" rel="noopener noreferrer"&gt;Lizard blog&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>cloud</category>
    </item>
  </channel>
</rss>
