A minimal AI coding agent built in ~200 lines of TypeScript that can read, write, and navigate your filesystem using GEMINI AI.
The agent runs a simple loop:
- You give it a task
- The LLM decides which tool to call
- Your program executes the tool locally
- The result is sent back to the LLM
- Repeat until the task is done
The LLM never touches your filesystem directly - it just asks your program to run tools, and those tools do the actual work.
| Tool | Description |
|---|---|
read_files |
Reads the content of a file |
list_files |
Lists all files inside the /data directory |
write_files |
Creates or overwrites a file with new content |
- Bun v1.3.14+
- A Gemini API key from Google AI Studio
Install dependencies:
bun installCreate a .env file and add your API key:
GEMINI_API_KEY=your_api_key_herebun run index.tsBy default, the agent will work inside the /data directory. All file operations are scoped to it.
- Swap the LLM provider - Replace Gemini with OpenAI, Anthropic, or any other provider
- Tweak the system prompt - Change the agent's behavior and personality
- Add more tools - Extend it with bash execution, web search, database queries, and more
This project was built as part of the AI Agent Series. Check out the full blog post to understand the architecture and core concepts behind it - Read the blog post