langchain-ai / langchain-ai/deepagentsjs
interruptOn is not browser compatible
- Dominant language
- TypeScript
- Stars
- 1.6k
- Forks
- 272
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 38
Description
When bundling a build for the browser, configuring `interruptOn` for a deep agent throws a runtime error `Error: Called interrupt() outside the context of a graph.`, seemingly due to `interrupt` invoking the node-specific `AsyncLocalStorage` at runtime.
Here is an example usage
```
const agent = createDeepAgent({
model,
systemPrompt,
backend,
tools: [...buildTools(toolProvider)],
middleware: [lifecycleMiddleware],
interruptOn: {toolName: true},
checkpointer: new MemorySaver(),
});
```
A node target works as expected.
ideally `interrupt` should be browser compatible, or if impractical should document that another pattern (such as tool middleware with manual interruption) is necessary for a browser build here.
Contributor guide
Research direction
Start by tracing how deep-agent interruptOn reaches interrupt in the browser bundle, focusing on the node-specific AsyncLocalStorage usage described in the report. Reproduce the provided configuration in a browser build and compare it with the working Node target. Done means browser use no longer throws, or the documented alternative pattern clearly explains when manual interruption is required.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- ai, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100