Skip to main content

Agente LLM com execução de funções, histórico persistente e suporte a arquivos.

Project description

🤖 Tyr Agent

PyPI version Python version 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

  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

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

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
📫 Contato por e-mail

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tyr_agent-0.0.1.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tyr_agent-0.0.1-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file tyr_agent-0.0.1.tar.gz.

File metadata

  • Download URL: tyr_agent-0.0.1.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for tyr_agent-0.0.1.tar.gz
Algorithm Hash digest
SHA256 4eddd36edbc5f0707a22b6d426fc701dd32d7bd780dab0c2e7160a307a28e9b0
MD5 66f7c150873f276f8b81e7987f139751
BLAKE2b-256 4261c9043aaaa005a3e7ac2e051f6892f83e4e17b1011c4382e658cc7aab98ad

See more details on using hashes here.

File details

Details for the file tyr_agent-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: tyr_agent-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for tyr_agent-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 df92192f800085ee3a8ffc5d0588348f4384e47bab9ddbc0789127a59708d8f8
MD5 9d3bf8cf6f2b762e52ced1eb906201a2
BLAKE2b-256 f718ffa86bade26fca8673e7220101c59f9ea8e0615c13cfb1b1b8ac02e90ab2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page