Metadata-Version: 2.4
Name: tyr-agent
Version: 0.0.1
Summary: Agente LLM com execução de funções, histórico persistente e suporte a arquivos.
Author-email: Witor Oliveira <witoredson@gmail.com>
License: MIT License
        
        Copyright (c) 2025 Witor Oliveira
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Keywords: llm,agent,gemini,function-calling,ai
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: google-generativeai
Requires-Dist: python-dotenv
Requires-Dist: pillow
Dynamic: license-file

# 🤖 Tyr Agent

[![PyPI version](https://badge.fury.io/py/tyr-agent.svg)](https://pypi.org/project/tyr-agent/)
[![Python version](https://img.shields.io/badge/python-3.9%2B-blue)](https://www.python.org/)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)

TyrAgent é uma biblioteca para criação de agentes inteligentes com histórico, function-calling e suporte a arquivos. Ideal para aplicações com modelos generativos como o Gemini da Google.

- 💬 Conversas com ou sem streaming
- 🧠 Memória persistente de interações (por agente)
- ⚙️ Execução de múltiplas funções via JSON
- 🖼️ Interpretação de imagens base64
- 🧩 Estrutura modular e extensível

---

## 📦 Instalação via PyPI

```bash
  pip install tyr-agent
```

> 🔒 Lembre-se de configurar sua variável `GEMINI_KEY` no `.env`

---

## 🧩 Estrutura do projeto

```
tyr_agent/
├── core/
│   ├── agent.py  # SimpleAgent e ComplexAgent
│   └── ai_config.py  # configure_gemini
├── storage/
│   └── interaction_history.py  # InteractionHistory
└── utils/
   └── image_utils.py  # image_to_base64
```

---

## 💡 Exemplos de uso

### 📘 Criando um agente simples

```python
import google.generativeai as genai
from tyr_agent import SimpleAgent, configure_gemini

configure_gemini()
agent = SimpleAgent(
    prompt_build="Você é um assistente de clima.",
    agent_name="WeatherBot",
    model=genai.GenerativeModel("gemini-2.5-flash-preview-04-17")
)
response = agent.chat("Qual o clima em Salvador?", streaming=True)
```

### ⚙️ Criando um agente com funções

```python
import google.generativeai as genai
from tyr_agent import ComplexAgent, configure_gemini

def somar(a: float, b: float): return a + b

def pegar_clima(cidade: str): return f"Clima em {cidade}: Ensolarado 28°C"

configure_gemini()
agent = ComplexAgent(
    prompt_build="Você pode fazer cálculos e responder sobre o clima.",
    agent_name="WeatherSumBot",
    model=genai.GenerativeModel("gemini-2.5-flash-preview-04-17"),
    functions={"somar": somar, "pegar_clima": pegar_clima}
)

response = agent.chat_with_functions("Me diga quanto é 10+5 e o clima de São Paulo", streaming=True)
```

---

## 🧠 Principais recursos

- `SimpleAgent`: Conversa com contexto e histórico;
- `ComplexAgent`: Pode sugerir funções a serem chamadas, recebe resultados e finaliza a resposta;
- `InteractionHistory`: Armazena histórico por agente em JSON;
- Suporte a arquivos base64 e imagens;
- Modular para expansão com novas capacidades (benchmark, visão, execução, etc.).

---

## 📄 Licença

Este repositório está licenciado sob os termos da MIT License.

---

## 📬 Contato

Criado por **Witor Oliveira**  
🔗 [LinkedIn](https://www.linkedin.com/in/witoroliveira/)  
📫 [Contato por e-mail](mailto:witoredson@gmail.com)
