Skip to content

Repository files navigation

Boot.dev AI Agent

Boot.dev AI Agent icon

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.

Features

  • 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

Project Structure

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

Requirements

  • Python 3.10 or newer
  • uv
  • An OpenRouter account
  • An OpenRouter API key

Setup

Clone the repository:

git clone https://github.com/antonisloukis/bootdev-ai-agent.git
cd bootdev-ai-agent

Install the project dependencies:

uv sync

Create a .env file in the project root:

OPENROUTER_API_KEY=your_api_key_here

The .env file is ignored by Git and must never be committed.

Usage

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" --verbose

Verbose mode displays:

  • The original user prompt
  • Prompt token usage
  • Response token usage
  • Function names
  • Function arguments
  • Tool results

Available Tools

The agent can use the following tools:

List files

Lists files and directories inside the permitted working directory.

get_files_info

Read files

Reads the contents of a file while enforcing the working-directory restriction.

get_file_content

Write files

Creates or overwrites files inside the permitted working directory.

write_file

Run Python files

Executes Python files with optional command-line arguments.

run_python_file

Safety Notice

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.

Learning Outcomes

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

License

This project was created as a guided Boot.dev learning project.

The repository is intended primarily for educational and portfolio use.

About

A Python AI coding agent with tool calling, safe file operations, and multi-step agent loops.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages