Dev.to
6/29/2026

I Built an AI Agent That Handles Orders, Refunds & Support Without LangChain
Short summary
Build AI agents as simple while loops calling Claude's tool-use API instead of over-engineered abstraction libraries like LangChain. This tutorial covers the complete agent loop mechanics, how TypeScript type guards ensure proper tool typing, design patterns (Factory, Repository, Command, CQRS) that naturally emerge, and production-ready patterns for migrating from static data to vector-search databases.
- •AI agents are fundamentally a while loop: call LLM, run tool calls, feed results back, loop
- •Tool-calling works via discriminated unions in TypeScript; use type guards for proper typing of tool inputs
- •Design patterns (Factory, Strategy, Repository, Command, CQRS) emerge naturally from organizing agents properly
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



