skillfed

langchain-quickjs

JavaScript REPL middleware for deepagents

langchain-quickjs v0.3.5 198.1K downloads/30d#9,739 on PyPI27,774
Permissive license MIT Active released

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 on this page — 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

langchain-quickjs on PyPI

pip

pip install langchain-quickjs

uv

uv add langchain-quickjs

poetry

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 the current Python release (<4.0,>=3.11)
Install friction low — pure-Python wheel
Runtime dependencies 6 — bsdiff4, deepagents, langchain-core, langchain, langgraph, quickjs-rs
Maintenance actively maintained — 16 days since the last release
Last repo commit
First released
Downloads 198,124/month — #9,739 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: langchain_quickjs-0.3.5-py3-none-any.whl

Keywords: deepagents, javascript, langchain, langgraph, middleware, quickjs, repl

Development Status :: 3 - AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13

Tags

javascript repl for agentsdeepagents middlewaresandboxed code executionagent tool orchestrationquickjs python bindinglangchain javascript integrationagentic code interpreter
agent-middlewarejavascript-sandboxorchestration

More Artificial Intelligence packages

Further reading