A modern personal AI agent built with TypeScript that can assist with various tasks using LLM capabilities.
- 🤖 Multi-tool Support: Integrates with multiple AI models and tools
- 🔄 Reasoning Loop: Iterative reasoning and task execution
- 📝 Task Management: Handle complex multi-step tasks
- 🛠️ Tool Integration: Extensible tool system for custom capabilities
- 📊 Logging & Monitoring: Built-in logging and error handling
npm install-
Create a
.envfile from.env.example:cp .env.example .env
-
Add your OpenAI API key:
OPENAI_API_KEY=sk-...
npm run devnpm run buildnpm start├── src/
│ ├── index.ts # Main entry point
│ ├── agent/
│ │ ├── Agent.ts # Core agent class
│ │ └── Tool.ts # Tool interface
│ ├── tools/
│ │ ├── WebSearchTool.ts # Web search capability
│ │ ├── CalculatorTool.ts # Math calculations
│ │ └── index.ts # Tool exports
│ ├── models/
│ │ ├── Message.ts # Message types
│ │ └── AgentState.ts # Agent state types
│ ├── utils/
│ │ ├── logger.ts # Logging utility
│ │ └── config.ts # Configuration
│ └── services/
│ └── OpenAIService.ts # OpenAI integration
├── dist/ # Compiled output
├── package.json
├── tsconfig.json
└── README.md
The agent follows a reasoning loop pattern:
- Observation: Analyze the current state and available tools
- Thought: Reason about the best action
- Action: Execute the selected tool
- Result: Integrate the result and continue
Environment variables:
OPENAI_API_KEY: Your OpenAI API keyAGENT_NAME: Custom agent nameMAX_ITERATIONS: Maximum reasoning loop iterationsLOG_LEVEL: Logging level (debug, info, warn, error)
Contributions are welcome! Please feel free to submit pull requests.
MIT