#6311·deepagents

langchain-quickjs: the eval tool description does not state that only one eval may be in flight

Author: radu-mocanuCreated Sep 15, 2026Updated Sep 28, 2026
Labelstype:bugorg:externalpriority:mediumintegration:quickjstopic:code-interpreter

Submission checklist

  • This is a bug, not a usage question.
  • I added a clear and descriptive title.
  • I searched existing issues and didn't find this.
  • I can reproduce this with the latest released version.
  • I included a minimal reproducible example and steps to reproduce.

Area (Required)

  • deepagents (SDK)
  • dcode
  • talon
  • acp
  • evals
  • harbor
  • daytona
  • modal
  • quickjs
  • runloop
  • vercel
  • langsmith-sandbox
  • Other / not sure / general

Related Issues / PRs

#4546

Reproduction Steps / Example Code (Python)

python
import asyncio
from typing import Any

from deepagents import create_deep_agent
from deepagents.backends import FilesystemBackend
from langchain_core.language_models.fake_chat_models import GenericFakeChatModel
from langchain_core.messages import AIMessage
from langchain_core.tools import tool
from langchain_quickjs import CodeInterpreterMiddleware


class ScriptedModel(GenericFakeChatModel):
    """Stands in for a model that batched two eval calls into one turn."""

    def bind_tools(self, tools: Any, **kwargs: Any) -> "ScriptedModel":
        return self

  
async def main(workspace: str) -> None:
    @tool
    async def slow_tool() -> str:
        """Take a moment, so the sibling eval starts while this one awaits."""
        await asyncio.sleep(2)
        return "done"

    middleware = CodeInterpreterMiddleware(mode="thread", ptc=["slow_tool"])
    print(middleware.tools[0].description)

    model = ScriptedModel(
        messages=iter([
            AIMessage(content="", tool_calls=[
                {"name": "eval", "args": {"code": "await tools.slowTool({})"}, "id": "a"},
                {"name": "eval", "args": {"code": "2 + 2"}, "id": "b"},
            ]),
            AIMessage(content="done"),
        ])
    )
    agent = create_deep_agent(
        model=model,
        tools=[slow_tool],
        backend=FilesystemBackend(root_dir=workspace, virtual_mode=True),
        middleware=[middleware],
    )
    result = await agent.ainvoke({"messages": [{"role": "user", "content": "go"}]})
    for message in result["messages"]:
        if message.type == "tool":
            print(f"{message.tool_call_id}: {message.content}")


asyncio.run(main("/tmp/ws"))

Error Message and Stack Trace (if applicable)

bash
a: <result>done</result>
b: <error type="ConcurrentEval">another eval_async is already in flight on this context; use a separate context for concurrent JS workloads</error>

Description

_aeval_async declines to queue overlapping evals on purpose:

Execute JavaScript in a sandboxed REPL. Persistent state is enabled: variables and
functions defined in one call are visible to subsequent calls in this conversation.
No filesystem, network, or real clock. Top-level `await` is supported; a
final-expression Promise resolves before the call returns.

That is a reasonable position, but the rule is nowhere the model can read it. The rendered description (above) does not mention it and CodeInterpreterMiddleware takes no description override. So a model that batches two eval calls learns the rule by failing and spending a turn recovering.

As a current workaround we append the description in our uipath-langchain integration: https://github.com/UiPath/uipath-langchain-python/pull/1081.

Suggested fix: add an explanatory sentence to the rendered description.

Environment / System Info

OS: macOS 26.5.2 Python: 3.11.15 deepagents: 0.7.13 langchain-quickjs: 0.3.7 langchain: 1.4.0 langchain-core: 1.6.2 langgraph: 1.2.11 quickjs-rs: 0.2.5 wasmtime: 48.0.0