A hands-on learning project for building conversational AI agents using the Anthropic Agent SDK.
Repository: https://github.com/waynefp/agent_test
# Install dependencies
npm install
# Add your API key to .env file
# ANTHROPIC_API_KEY=sk-ant-your-key-here
# Run interactive chat
npm run dev
# Or run automated test
npm run test-agent- PROJECT_SUMMARY.md - Complete progress summary and reference guide
- Implementation Plan - Detailed 8-phase roadmap
Phase 1: Foundation ✅ Complete
- Project setup with TypeScript
- Type definitions for all components
- Logging and error handling utilities
Phase 2: Core Agent ✅ Complete
- Conversational agent that talks to Claude
- Multi-turn conversations with memory
- Interactive CLI interface
- Token usage tracking
Phase 3: Tool System Foundation ✅ Complete
BaseToolabstract class for creating toolsCalculatorTool(add, subtract, multiply, divide)ToolRegistryfor managing available tools- Zod schema validation for tool inputs
Phase 4: Tool Calling Integration ✅ Complete
ToolExecutorfor running tools safely- Agent updated with agentic loop
- Claude can autonomously decide when to use tools
- Multi-turn tool interactions
Phase 5: Task Tracking 🔜 Next
- TaskTracker class for managing tasks
- Hierarchical task structure
- Task persistence to JSON files
This is a learning-focused project that teaches you how to:
- Build conversational AI agents with the Anthropic SDK
- Manage conversation history and state
- Create custom tools for your agent
- Track tasks and sub-agents
- Build production-ready TypeScript applications
npm run devCommands available in chat:
/help- Show available commands/clear- Clear conversation history/history- View past messages/stats- See token usage statistics/thinking- Toggle extended thinking (step-by-step reasoning)/thinking-budget <tokens>- Set thinking token budget/exit- Quit the chat
npm run test-agentRuns an automated 2-question conversation to verify everything works.
Agent_SDK-Test/
├── src/
│ ├── agent/ # Agent logic & conversation management
│ ├── cli/ # CLI interface (display, prompts, commands)
│ ├── config/ # Environment & Anthropic client config
│ ├── types/ # TypeScript type definitions
│ └── utils/ # Logger & error utilities
├── data/ # Saved conversations & tasks (future)
├── docs/ # Documentation
├── tests/ # Unit & integration tests (future)
└── examples/ # Learning examples (future)
- TypeScript (types, interfaces, async/await)
- Node.js development
- API integration (Anthropic SDK)
- State management
- CLI development
- Error handling
- Design patterns (Singleton, Factory, Strategy)
- Separation of concerns
- Type safety
- Testing strategies
- Project organization
- Node.js 18+
- npm (comes with Node.js)
- Anthropic API Key (get free at https://console.anthropic.com)
-
Copy
.env.exampleto.env:cp .env.example .env
-
Edit
.envand add your API key:ANTHROPIC_API_KEY=sk-ant-your-key-here
-
Optional configuration:
ANTHROPIC_MODEL=claude-sonnet-4-5-20250929 MAX_TOKENS=2048 LOG_LEVEL=info
This project follows an 8-phase learning path:
- Foundation ✅ - Project setup, types, utilities
- Core Agent ✅ - Conversational AI with memory
- Tool Foundation ✅ - Create custom tools (BaseTool, CalculatorTool)
- Tool Integration ✅ - Agent autonomously uses tools (agentic loop)
- Task Tracking 🔜 - Track tasks and subtasks
- Persistence - Save/load conversations
- Enhanced UX - Better CLI experience
- Testing & Docs - Production-quality code
This is a personal learning project, but feel free to fork and adapt for your own learning!
ISC
Current Phase: 4/8 Complete | Next: Task Tracking
For detailed progress and concepts learned, see PROJECT_SUMMARY.md