Skip to content

codewithfourtix/chaingraph-playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Animated Insect

LangChain + LangGraph Playground

Build practical AI workflows with clean demos, memory, tools, and orchestration.

Node LangChain LangGraph Gemini License


✨ Why This Repo

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

🧱 Core Modules

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

🗺 Architecture Snapshot

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
Loading

📁 Project Structure

.
├── 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

🚀 Quick Start

1) Install dependencies

npm install

2) Create your environment file

cp .env.example .env

Windows PowerShell:

Copy-Item .env.example .env

3) Add your Gemini API key

GOOGLE_API_KEY=your_real_key_here

🎮 Run Demos

npm run demo:basics
npm run demo:chains
npm run demo:rag
npm run demo:agent
npm run demo:langgraph
npm run demo:multiagent

📜 Script Reference

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

🔐 Security Notes

  • Keep .env private. Never commit secrets.
  • Calculator tools currently use JavaScript eval for demo speed.
  • Do not expose current calculator logic directly to untrusted user input.

🛠 Troubleshooting

  • Missing API key: confirm GOOGLE_API_KEY is set in .env.
  • Module errors: rerun npm install.
  • Weak RAG answers: check data.txt quality and relevance.

📈 Professional Upgrade Path

  • Replace eval with 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.

📄 License

ISC (see package.json).

About

Node.js LangChain/LangGraph playground with Gemini, RAG, and multi-agent demos.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors