LangChain.js Q&A Agent, Internal LLM Spike
Overview
A small internal build building a question-answering agent in Node.js with LangChain.js and OpenAI. A single-day spike used to explore custom agent executors, tool wiring, and structured-output workflows on the JavaScript LLM stack.
Why It Exists
An early-stage exploration to get hands-on with LangChain.js, OpenAI’s Node SDK, and Zod-based structured output, establishing internal familiarity with agent orchestration in JavaScript rather than shipping a product.
What We Built
A minimal Node.js (ESM) project with an internal/ layer holding a custom OkapiAIAssistantRunnable and OkapiAgentExecutor, a tools/GradeTool implementing a callable tool, and an openai.js wrapper. Dependencies are deliberately lean: LangChain ^0.0.202, the OpenAI SDK ^4.20, dotenv for configuration, and zod for schema-validated responses.
Technologies & Approach
JavaScript/Node with LangChain.js and OpenAI; a hand-rolled agent executor and runnable to understand the control flow under LangChain’s abstractions; Zod for typed, validated LLM output. Chosen to evaluate the JS-side LLM ecosystem as an alternative to the Python tooling used elsewhere.
Outcome / Impact
A throwaway-scale spike that confirmed the LangChain.js + OpenAI + Zod workflow and the mechanics of custom agent executors and tools, seeding the studio’s JavaScript LLM capability. Honestly framed as R&D, not production.
Capabilities Demonstrated
- Rapid LLM agent building in Node.js
- Custom LangChain.js agent executor and runnable design
- Tool-calling integration (custom grading tool)
- Schema-validated structured LLM output (Zod)