This project is designed as a serious learning and prototyping workspace for modern LLM application patterns in Node.js.
- ⚡ Fast demos for each core concept
- 🧠 Real retrieval pipeline with embeddings + vector search
- 🛠 Tool-calling agents for practical workflows
- 🔁 Stateful memory with LangGraph checkpoints
- 🧩 Supervisor-driven multi-agent architecture
| Module | Purpose | File |
|---|---|---|
| LLM Basics | Minimal model invocation smoke test | src/basics.js |
| Prompt Chains | Prompt template + parser chaining | src/chains.js |
| RAG | Chunking, embeddings, retriever, grounded QA | src/rag.js |
| Agent + Tools | Tool-calling with calculator + KB | src/agent.js |
| LangGraph Memory | Stateful single-agent memory thread | langgraph/index.langgraph.js |
| Multi-Agent Supervisor | Routing between Messi and Math experts | langgraph/multiagent.langgraph.js |
flowchart LR
U[User Question] --> S[Supervisor]
S --> M[Messi Expert Agent]
S --> X[Math Expert Agent]
M --> K[Knowledge Base Tool]
X --> C[Calculator Tool]
K --> V[Vector Store Retriever]
V --> D[data.txt]
M --> R[Final Response]
X --> R
.
├── data.txt
├── langgraph/
│ ├── index.langgraph.js
│ ├── logger.langgraph.js
│ ├── multiagent.langgraph.js
│ └── shared.langgraph.js
├── src/
│ ├── agent.js
│ ├── basics.js
│ ├── chains.js
│ └── rag.js
├── .env.example
├── .gitignore
├── package.json
└── README.md
npm installcp .env.example .envWindows PowerShell:
Copy-Item .env.example .envGOOGLE_API_KEY=your_real_key_herenpm run demo:basics
npm run demo:chains
npm run demo:rag
npm run demo:agent
npm run demo:langgraph
npm run demo:multiagent| Command | Runs |
|---|---|
npm run demo:basics |
src/basics.js |
npm run demo:chains |
src/chains.js |
npm run demo:rag |
src/rag.js |
npm run demo:agent |
src/agent.js |
npm run demo:langgraph |
langgraph/index.langgraph.js |
npm run demo:multiagent |
langgraph/multiagent.langgraph.js |
- Keep
.envprivate. Never commit secrets. - Calculator tools currently use JavaScript
evalfor demo speed. - Do not expose current calculator logic directly to untrusted user input.
- Missing API key: confirm
GOOGLE_API_KEYis set in.env. - Module errors: rerun
npm install. - Weak RAG answers: check
data.txtquality and relevance.
- Replace
evalwith a safe expression parser. - Add ESLint + Prettier + CI workflow.
- Add unit tests for tools, retrieval pipeline, and routing behavior.
- Extract shared model/retriever setup into reusable modules.
ISC (see package.json).
