Submission checklist
Area (Required)
Related Issues / PRs
Reproduction Steps / Example Code (Python)
# langsmith (needs valid LANGSMITH_API_KEY or LANGSMITH_SANDBOX_API_KEY)
dcode --sandbox langsmith
# agentcore (needs AWS credentials)
dcode --sandbox agentcore
# Both abort before the server passes readiness. Reproduced on langsmith and agentcore
Error Message and Stack Trace (if applicable)
# langsmith
Error: Server failed to start: RuntimeError: Server graph 'agent' failed readiness
check (status: 500): Sandbox creation failed for 'langsmith': Failed to list
snapshots: Blocking call to socket.socket.connect
# agentcore
Error: Server failed to start: RuntimeError: Server graph 'agent' failed readiness
check (status: 500): Sandbox creation failed for 'agentcore': Blocking call to
socket.socket.connect
Description
dcode --sandbox <provider> fails at server startup for the synchronous-SDK providers I tried (langsmith and agentcore). The same failure was previously reproduced with daytona in #5278. The server runs python -m langgraph_cli dev, which arms the blockbuster blocking-I/O guard on the event loop (langgraph_runtime_inmem/queue.py -> _enable_blockbuster()). dcode's graph factory then creates the sandbox synchronously on that loop:
_make_graph() async server_graph.py
└─ create_sandbox(...) sync server_graph.py ← creates context manager
└─ __enter__() sync server_graph.py ← on the event loop
└─ provider.get_or_create() sync sandbox_factory.py
└─ socket / filesystem I/O ← guard fires here
For langsmith specifically, _LangSmithProvider._ensure_snapshot -> list_snapshots() uses the sync SandboxClient from langsmith.sandbox, so the first blocking HTTP connect raises BlockingError. The readiness probe 500s and startup aborts.
Unfortunately, inheriting LANGGRAPH_ALLOW_BLOCKING=true does not work around this: langgraph dev rewrites it from the CLI --allow-blocking option, which dcode does not pass, so it becomes false.
Suggested fix: offload the complete synchronous context-manager entry (create_sandbox(...) plus __enter__()) via asyncio.to_thread, with cancellation and late-cleanup handling. SandboxProvider.aget_or_create already exists but has zero call sites. Using AsyncSandboxClient would address LangSmith only; __exit__() currently runs from atexit, outside the guarded event loop.
Environment / System Info
OS: macOS 15.7.4
Python: 3.13.2
deepagents: 0.7.10
deepagents-code: 0.1.65
langsmith: 0.11.2
langgraph-cli: 0.4.31
Submission checklist
Area (Required)
Related Issues / PRs
create_sandboxon the event loop trips the blockbuster guard), filed for daytona; auto-closed by the triage bot before human review. Still unfixed onmain.test(code): sandbox creation must not run on the blockbuster-guarded loop). It was automatically closed for lacking an approved issue link. The test fails onmainand passes once sandbox creation is offloaded from the event loop.Reproduction Steps / Example Code (Python)
Error Message and Stack Trace (if applicable)
Description
dcode --sandbox <provider>fails at server startup for the synchronous-SDK providers I tried (langsmith and agentcore). The same failure was previously reproduced with daytona in #5278. The server runspython -m langgraph_cli dev, which arms the blockbuster blocking-I/O guard on the event loop (langgraph_runtime_inmem/queue.py->_enable_blockbuster()). dcode's graph factory then creates the sandbox synchronously on that loop:For langsmith specifically,
_LangSmithProvider._ensure_snapshot->list_snapshots()uses the syncSandboxClientfromlangsmith.sandbox, so the first blocking HTTP connect raisesBlockingError. The readiness probe 500s and startup aborts.Unfortunately, inheriting
LANGGRAPH_ALLOW_BLOCKING=truedoes not work around this:langgraph devrewrites it from the CLI--allow-blockingoption, which dcode does not pass, so it becomesfalse.Suggested fix: offload the complete synchronous context-manager entry (
create_sandbox(...)plus__enter__()) viaasyncio.to_thread, with cancellation and late-cleanup handling.SandboxProvider.aget_or_createalready exists but has zero call sites. UsingAsyncSandboxClientwould address LangSmith only;__exit__()currently runs fromatexit, outside the guarded event loop.Environment / System Info
OS: macOS 15.7.4
Python: 3.13.2
deepagents: 0.7.10
deepagents-code: 0.1.65
langsmith: 0.11.2
langgraph-cli: 0.4.31