A Python-based AI coding agent built as part of the Boot.dev guided project.
The agent can inspect a controlled working directory, read and write files, execute Python programs, and use tool calling through an OpenAI-compatible API.
- Accepts prompts through the command line
- Uses OpenRouter through the OpenAI Python SDK
- Supports multi-step agent loops
- Lists files and directories
- Reads file contents
- Writes and overwrites files
- Executes Python files with optional arguments
- Restricts file operations to a permitted working directory
- Displays token usage in verbose mode
- Uses structured function declarations for tool calling
- Returns tool results back to the model during the agent loop
bootdev-ai-agent/
├── calculator/
│ ├── main.py
│ ├── tests.py
│ └── pkg/
│ ├── calculator.py
│ └── render.py
├── functions/
│ ├── get_file_content.py
│ ├── get_files_info.py
│ ├── run_python.py
│ └── write_file.py
├── call_function.py
├── config.py
├── main.py
├── prompts.py
├── pyproject.toml
└── README.md
- Python 3.10 or newer
uv- An OpenRouter account
- An OpenRouter API key
Clone the repository:
git clone https://github.com/antonisloukis/bootdev-ai-agent.git
cd bootdev-ai-agentInstall the project dependencies:
uv syncCreate a .env file in the project root:
OPENROUTER_API_KEY=your_api_key_hereThe .env file is ignored by Git and must never be committed.
Run the agent with a prompt:
uv run main.py "How does the calculator render results?"Run the agent with verbose output:
uv run main.py "List the files in the root directory" --verboseVerbose mode displays:
- The original user prompt
- Prompt token usage
- Response token usage
- Function names
- Function arguments
- Tool results
The agent can use the following tools:
Lists files and directories inside the permitted working directory.
get_files_info
Reads the contents of a file while enforcing the working-directory restriction.
get_file_content
Creates or overwrites files inside the permitted working directory.
write_file
Executes Python files with optional command-line arguments.
run_python_file
This project was created for educational purposes.
The agent can read, modify, and execute files inside its configured working directory. Although the project includes path validation and execution limits, it does not contain all the security controls required for production use.
Do not run it against:
- Sensitive repositories
- Important production code
- Private credentials
- Personal documents
- Untrusted files
- Systems where unintended code execution could cause damage
Always review the agent's actions and generated changes.
This project demonstrates:
- Command-line argument parsing with
argparse - Environment-variable management with
python-dotenv - OpenRouter integration through the OpenAI SDK
- System prompts
- Structured tool declarations
- Function calling
- Multi-step agent loops
- Safe path validation
- File reading and writing
- Subprocess execution
- Token-usage reporting
- Error handling
- Basic agent architecture
This project was created as a guided Boot.dev learning project.
The repository is intended primarily for educational and portfolio use.