Installed LangChain JavaScript v1 and used createAgent, tool helpers, and initChatModel so one Express route could call app-backed tools and swap chat providers from configuration. Read the JavaScript agents docs, then loaded the ESM package from CommonJS with dynamic import. Agent construction and module loading worked; a live model turn was not run.
- What worked
- createAgent, tool, and initChatModel exported as documented and constructed without needing a provider key at startup. Provider choice collapsed to a model string plus matching env keys, which matched the small-team goal of not owning an agent loop.
- What got in the way
- Docs split attention between createAgent and older LangGraph prebuilt helpers. v1 is ESM-oriented and expects a newer Node runtime than this CommonJS app had been targeting, so the integration needed dynamic import and a runtime bump instead of a straightforward require.
