Learning project: Building AI Agents from scratch using LangChain and LangGraph with TypeScript.
This repository documents my journey learning to build AI agents using LangChain and LangGraph in TypeScript. Each module covers a specific topic with practical examples.
- TypeScript - Type-safe JavaScript
- LangChain - Framework for building LLM applications
- LangGraph - Framework for building stateful agents
- Zod - Schema validation
src/
├── 01-fundamentals/ # LLM basics, messages, streaming, structured output [DONE]
├── 02-tools/ # Custom tools, Zod validation, agents [DONE]
├── 03-langgraph-basics/ # State, nodes, edges, conditional logic
├── 04-calculator-agent/ # Project: Calculator agent
├── 05-memory/ # Short & long-term memory
├── 06-advanced-streaming/ # Advanced streaming patterns
├── 07-human-in-the-loop/ # Interrupts, approvals, state editing
├── 08-multi-agent/ # Subagents, routers, handoffs, supervisors
├── 09-retrieval-rag/ # RAG architectures (2-step, agentic, hybrid)
├── 10-production-security/ # Guardrails, context engineering, MCP
├── 11-advanced/ # Subgraphs, time-travel, durable execution
├── 12-rag-agent-project/ # Project: Complete RAG agent
└── 13-final-project/ # Project: Personal assistant
- Chat Models & Configuration
- Message Types (Human, AI, System, Tool)
- Tools & Tool Calling
- Streaming Responses
- Structured Output with Zod
- State Management
- Nodes & Edges
- Conditional Routing
- Checkpointers & Persistence
- Memory (Short-term & Long-term)
- Human-in-the-Loop
- Multi-Agent Architectures
- RAG (Retrieval-Augmented Generation)
- Guardrails & Security
- Model Context Protocol (MCP)
- Node.js 18+
- npm or pnpm
- Anthropic API Key
# Clone the repository
git clone https://github.com/tostechbr/agent-ai-typescript.git
cd agent-ai-typescript
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env
# Run an example
npx tsx src/01-fundamentals/01-hello-llm.ts- Module 1: Fundamentals
- Module 2: Tools & Agents
- Module 3: LangGraph Basics
- Module 4: Calculator Agent (Project)
- Module 5: Memory
- Module 6: Advanced Streaming
- Module 7: Human-in-the-Loop
- Module 8: Multi-Agent
- Module 9: Retrieval & RAG
- Module 10: Production & Security
- Module 11: Advanced Topics
- Module 12: RAG Agent (Project)
- Module 13: Personal Assistant (Final Project)
Contributions are welcome! Please read our Contributing Guide before submitting a Pull Request.
Tiago Santos
MIT