--- id: langchain-quickjs version: "0.3.5" license: MIT license_treatment: permissive maintenance: active --- # langchain-quickjs — JavaScript REPL middleware for deepagents License: permissive · Maintenance: active · Downloads: 198.1K/mo ## What it is and what it does langchain-quickjs is a middleware for deepagents that injects a persistent, sandboxed JavaScript REPL into an agent's tool set. Instead of the model issuing N serial tool calls, it can write one JavaScript block that orchestrates work in-loop—variables and functions persist across calls, Promise.all runs concurrent work, and configured subagents are dispatchable as await task({...}). The REPL runs in a QuickJS context with no ambient capabilities (no filesystem, network, or real clock), but can explicitly call into the agent's own tools via programmatic tool calling (PTC). The middleware registers an eval tool, appends a system-prompt snippet explaining sandbox semantics, and gives each LangGraph thread_id its own QuickJS Runtime so conversations remain isolated. Persistence modes control how far state reaches: thread (default, survives across turns), turn (within a turn only), or call (fresh per eval). Each call has a wall-clock timeout (default 5 s) and the runtime has a shared memory limit (default 64 MiB); PTC calls are budgeted at 256 per eval by default. Results and console output are independently truncated before returning to the model. Use it for: - Loop over a list and call tools per item without round-tripping to the model between iterations. - Run multiple independent tool calls concurrently using Promise.all and orchestrate filtering or aggregation in one eval. - Dispatch multiple subagents in parallel, filter results, and synthesize them in JavaScript before returning to the parent. - Compute intermediate state between tool calls (aggregate, dedupe, format) without leaving the REPL. - Reuse state across several turns by persisting variables and functions in thread mode. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Adds a persistent, sandboxed JavaScript REPL tool to deepagents agents, letting the model write orchestrated JavaScript code instead of issuing serial tool calls. Yes, if you are building deepagents-based agents and need to reduce model round-trips for orchestrated tool use. The low install friction, active maintenance, and permissive MIT license make it a straightforward addition. The 16-day-old release and alpha status mean expect occasional breaking changes; verify that the default timeouts and memory limits suit your workload before production use. ## Install pip install langchain-quickjs uv add langchain-quickjs poetry add langchain-quickjs ## Installing langchain-quickjs Before you install: Low friction: ships as a prebuilt wheel for CPython 3.11+ on macOS, Linux, and Windows. Active maintenance with recent releases; 27774 repository stars suggest established backing. License in practice: MIT license permits unrestricted use, modification, and distribution in commercial and private projects with minimal obligations. Quickstart: from deepagents import create_deep_agent from langchain_quickjs import CodeInterpreterMiddleware agent = create_deep_agent( model="claude-sonnet-4-6", middleware=[CodeInterpreterMiddleware()], ) result = await agent.ainvoke({"messages": [{"role": "user", "content": "..."}]}) Requires Python 3.11+; must use ainvoke (async) rather than sync invoke when PTC bridges are registered, or ConcurrentEvalError is raised. Verify before relying: - Whether the 64 MiB default memory limit and 5 s timeout are tunable per-agent or only globally configurable. - Exact concurrency cap for subagent dispatching mentioned as 'per REPL' but not quantified. - Whether PTC host-function budget of 256 calls can be tuned or only disabled entirely. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 198.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags javascript repl for agents, deepagents middleware, sandboxed code execution, agent tool orchestration, quickjs python binding, langchain javascript integration, agentic code interpreter, agent-middleware, javascript-sandbox, orchestration [View on SkillFed](https://skillfed.io/packages/langchain-quickjs) · [View on PyPI](https://pypi.org/project/langchain-quickjs/)