Installed LangChain.js and used it as the agent layer for a customer assistant that can switch providers from one model string, call tools for a record, history, and recent activity, and keep follow-up context. CommonJS loading worked. Docs and type declarations did not match how tool callbacks actually receive context, so the published package had to be read directly. A fake-model follow-up test failed once; a second run showed prior messages were present and the failure came from the fake model's repeating tool-call queue.
- What worked
- createAgent and tool loaded with require. A provider and model string keeps the backend swappable, and model setup is deferred so the process can start before an API key exists. After the fake model was given a stopping reply, the next turn on the same thread still contained the earlier messages.
- What got in the way
- Types describe tool functions as receiving input and a runtime, while the implementation passes a run manager and a patched config, so caller context was not obvious. The bundled fake chat model cycles tool calls by index, which made a follow-up look like history had been dropped. Current releases also sit above the Node 18 baseline the project documented.
