Skip to main content

SmartAgent 🤖

Biblioteca Python leve para criar agentes de IA com execução determinística em 3 fases.

Características ✨

  • Multi-Provider: Suporta Groq, OpenAI, Gemini, Grok, Ollama e Llama
  • Sem Schemas: Não precisa de Pydantic ou definições complexas
  • 3 Fases: Análise → Execução → Resposta
  • Econômico: Minimiza uso de tokens
  • Simples: Menos de 500 linhas de código

Instalação

# Instalar dependências
pip install requests

Uso Rápido

from agent import Agent

# Criar agente
agent = Agent(provider="groq")

# Registrar ferramentas
@agent.tool
def get_products(max_price=100):
    return [{"nome": "Mouse", "preço": 50}]

# Executar
response = agent.chat("Quais produtos baratos?")
print(response)

Instruções Customizadas

Você pode adicionar instruções personalizadas ao agente:

agent = Agent(
    provider="groq",
    info="""
    Você é um assistente especializado em e-commerce.
    - Sempre sugira produtos relacionados
    - Use tom amigável e profissional
    - Destaque promoções quando disponíveis
    """
)

Providers Suportados

  • Groq: Agent(provider="groq", api_key="...")
  • OpenAI: Agent(provider="openai", api_key="...")
  • Gemini: Agent(provider="gemini", api_key="...")
  • Grok: Agent(provider="grok", api_key="...")
  • Ollama: Agent(provider="ollama") (local)
  • Llama: Agent(provider="llama", api_key="...")

Variáveis de Ambiente

# Provider default global (opcional)
export SMARTAGENT_PROVIDER="groq"

export GROQ_API_KEY="your-key"
export OPENAI_API_KEY="your-key"
export GEMINI_API_KEY="your-key"
export XAI_API_KEY="your-key"
export LLAMA_API_KEY="your-key"

# Modelo global (novo)
export SMARTAGENT_MODEL="modelo-ai"

# Modelo por provider (opcional)
export SMARTAGENT_OPENAI_MODEL="gpt-4o-mini"
export SMARTAGENT_GROQ_MODEL="qwen/qwen3-32b"

# Rede (opcional)
export SMARTAGENT_TIMEOUT="30"
export SMARTAGENT_RETRIES="2"

# Compatibilidade legada (ainda suportado)
export LLM="modelo-ai"

Compatibilidade (1-2 versões)

  • model=\"groq\" (estilo antigo) ainda funciona, mas o recomendado é provider=\"groq\".
  • As variáveis *_API_KEY continuam suportadas.
  • LLM continua suportada como fallback para modelo global.

Arquitetura

  1. Analyzer: Determina quais ferramentas executar
  2. Executor: Executa ferramentas com parâmetros
  3. Responder: Gera resposta humanizada

Exemplo Completo

Veja examples/minimal_agent.py

Metadata

Release files for smartagent-sf 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smartagent-sf 0.2.0
File Size Uploaded Provenance Actions
smartagent_sf-0.2.0.tar.gz 16.4 kB Without provenance Details for smartagent_sf-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for smartagent-sf 0.2.0
File Interpreter ABI Platform Actions
smartagent_sf-0.2.0-py3-none-any.whl Python 3 none any Details for smartagent_sf-0.2.0-py3-none-any.whl

Total release size: 36.6 kB

Release files / smartagent_sf-0.2.0.tar.gz

Download URL smartagent_sf-0.2.0.tar.gz
Size 16.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3f6a73ee5fa40cdc633c0ff224686aa094d5eb86bd4011cc41263fcdfc8109cf
BLAKE2b-256 checksum
How to use checksums
d63024b0990e70ccd80adebdd19f150382472bce6393c85c02ebef0d629ea2f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / smartagent_sf-0.2.0-py3-none-any.whl

Download URL smartagent_sf-0.2.0-py3-none-any.whl
Size 20.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
63415fd355e2ca08fa38952743ba40aa168abddc17e28b9e3c88f3f12a59bcee
BLAKE2b-256 checksum
How to use checksums
322cca32d3e3a76c58b39495f754a25b707f54ae1c63e9de04813d1e08312437
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for smartagent-sf 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page