Este projeto é uma prova de conceito (POC) de um agente de IA escrito em Python que utiliza a API gemini-2.0-flash-001 para auxiliar na análise e manipulação de código.
O agente pode ler arquivos, inspecionar conteúdos, executar scripts Python, corrigir bugs e responder a comandos recebidos diretamente pelo terminal.
- Listar arquivos e diretórios da aplicação.
- Ler conteúdos de arquivos Python.
- Executar scripts Python e retornar a saída.
- Escrever/atualizar arquivos.
- Interagir com o modelo Gemini para auxiliar na depuração, geração de código e documentação.
calculator/
functions/
│ ├── get_file_content.py # Lê conteúdo de um arquivo
│ ├── get_files_info.py # Lista arquivos de um diretório
│ ├── run_python_file.py # Executa scripts Python
│ └── write_file.py # Cria ou sobrescreve arquivos
│
├── call_function.py # Orquestra chamadas de função
├── config.py # Configurações gerais
├── main.py # Script principal da aplicação
├── prompts.py # Prompts base para o agente
├── tests.py # Testes da aplicação
├── pyproject.toml # Configuração de dependências
├── uv.lock # Lockfile de dependências
└── .env # Variáveis de ambiente (ex.: chave da API)
- Python 3.10+
- uv instalado
- Chave de API configurada no arquivo
.env:
GEMINI_API_KEY="sua_chave_aqui"
-
Clone este repositório:
git clone https://github.com/seu-usuario/seu-repo.git cd seu-repo -
Instale as dependências:
uv sync
A execução é feita passando um prompt direto pelo terminal:
uv run main.py "Create a README.md for the whole project, please. I need a brief description of what you do and how to run the main.py using uv."O agente irá processar o comando, ler os arquivos necessários e retornar a resposta solicitada.
Rode os testes com:
uv run tests.py- Este projeto é apenas uma POC e não deve ser usado em produção.
- Algumas funcionalidades são limitadas ao escopo da API Gemini-2.0-Flash.
- Recomendado usar em um ambiente isolado (ex.:
venvouuv).
This project is a proof of concept (POC) of an AI agent written in Python that uses the gemini-2.0-flash-001 API to assist in analyzing and manipulating code.
The agent can read files, inspect contents, execute Python scripts, fix bugs, and respond to commands directly from the terminal.
- List project files and directories.
- Read contents of Python files.
- Execute Python scripts and return the output.
- Write/update files.
- Interact with the Gemini model to help debugging, code generation, and documentation.
calculator/
functions/
│ ├── get_file_content.py # Reads file content
│ ├── get_files_info.py # Lists files in a directory
│ ├── run_python_file.py # Runs Python scripts
│ └── write_file.py # Creates or overwrites files
│
├── call_function.py # Orchestrates function calls
├── config.py # General settings and authentication
├── main.py # Main script of the application
├── prompts.py # Base prompts for the agent
├── tests.py # Application tests
├── pyproject.toml # Dependency configuration
├── uv.lock # Dependency lock file
└── .env # Environment variables (e.g., API key)
- Python 3.10+
- uv installed
- API key set in
.envfile:
GEMINI_API_KEY="your_api_key_here"
-
Clone this repository:
git clone https://github.com/your-username/your-repo.git cd your-repo -
Install dependencies:
uv sync
Run the agent by passing a prompt directly from the terminal:
uv run main.py "Create a README.md for the whole project, please. I need a brief description of what you do and how to run the main.py using uv."The agent will process the command, read the necessary files, and return the requested output.
Run tests with:
uv run tests.py- This project is just a POC and should not be used in production.
- Some features are limited to the scope of the Gemini-2.0-Flash API.
- Recommended to use in an isolated environment (e.g.,
venvoruv).