Milestone Report Release 3.1.0

iFriend AI Agent
Platform

Resultados do 1º Trimestre de 2026 — de bot monolítico a plataforma multi-agente, multi-canal e multi-tenant.

Janeiro – Abril 2026 v2.0.0 → v3.1.0 Glauber Portella
31
Releases
233
Commits
10
Agentes IA
6
Canais
682
Testes

Pilares Estratégicos

Quatro eixos que guiaram todas as entregas do trimestre.

Arquitetura Multi-Agent

Refatoração de agente único (336 linhas de prompt, 24 tools) para 10 agentes especializados com orquestrador inteligente. Redução de ~70% em tokens por turno.

AgentBuilder Feature Flags Coordinator/Dispatcher

Integração Multi-Canal

Framework de messaging extensível com 6 adaptadores. Adicionar novo canal leva ~2h vs ~16h antes. Suporte a Slack, WhatsApp, Telegram, WebChat e SSE Streaming.

AdapterFactory SSE Streaming Webhook Unificado

Segurança (JWT)

Autenticação JWT em todos os canais (5 fases). Contexto de usuário (roles, email, empresa) propagado para tools e agentes. Security Audit completo.

JWTContextManager RS256 Role-based Access

Experiência do Usuário

Generative UI com cards visuais de produtos e guias. Whitelabel com detecção automática de domínio. Streaming SSE com feedback de tool calls em tempo real.

Generative UI Whitelabel Experience Cards

Evolução da Arquitetura

De bot Slack monolítico a plataforma multi-agente completa em um trimestre.

graph LR
    subgraph "v1.0 — Dez/2025"
        A1["1 Bot Slack\n1 Agente\n24 Tools\n336 linhas prompt"]
    end

    subgraph "v2.0 — Jan/2026"
        A2["Unified Bot\n6 Canais\n1 Agente\nMessaging Framework"]
    end

    subgraph "v2.3 — Fev/2026"
        A3["+ JWT Auth\n+ OpenWebUI\n+ API Client\n+ SendGrid"]
    end

    subgraph "v2.5 — Mar/2026"
        A4["+ Whitelabel\n+ Temporal Logic\n+ Metadata"]
    end

    subgraph "v3.0 — Mar/2026"
        A5["Multi-Agent\n10 Agentes\n25 Tools\nFeature Flags\nMemory v2\nGenerative UI"]
    end

    subgraph "v3.1 — Abr/2026"
        A6["+ Custom Tour\n+ Itinerary\n+ Perf Tuning\n+ Salesforce"]
    end

    A1 --> A2 --> A3 --> A4 --> A5 --> A6

    style A1 fill:#ff6b6b,color:#fff
    style A2 fill:#ff922b,color:#fff
    style A3 fill:#fcc419,color:#333
    style A4 fill:#94d82d,color:#333
    style A5 fill:#51cf66,color:#fff
    style A6 fill:#4263eb,color:#fff
                

Timeline de Releases

31 releases entregues em 3 meses.

JAN

Janeiro 2026

v2.0.0 03/Jan

Multi-Platform Messaging Framework

Refatoração completa: unified_bot.py, AdapterFactory, 6 adaptadores, webhook unificado.

v2.1.0 04/Jan

Email, Booking e Avaliação

Gmail API OAuth 2.0, MailerSend, tools de booking para agências, evaluation tests.

v2.2.0 31/Jan

SSE Streaming, Search Agent e Telegram

Server-Sent Events com feedback em tempo real, Research Agent com Google Search, adaptador Telegram.

FEV

Fevereiro 2026

v2.3.0 24/Fev

JWT Authentication e OpenWebUI

Autenticação JWT em 5 fases, OpenWebUI integration, SendGrid, IFriendAPIClient, CORS regex.

v2.4.0 26/Fev

Refatoração de Tools e CORS

Remoção de wrappers, renomeação padronizada, middleware CORS com regex.

MAR

Março 2026

v2.5.0 11/Mar

Whitelabel e Lógica Temporal

Detecção automática de whitelabel via Origin/Referer, substituição de URLs, lógica temporal.

v3.0.0 30/Mar

Arquitetura Multi-Agent

10 agentes especializados, AgentBuilder, Feature Flags, CloudSQL Memory v2, Generative UI, anti-flood guardrails. A maior entrega do trimestre.

discovery quote booking payment support utils research faq
ABR

Abril 2026

v3.0.1–v3.0.11 30/Mar – 01/Abr

Estabilização, Discovery e Itinerary

Discovery Agent com recomendação inteligente, Experience/Guide Cards com fotos, Itinerary Agent textual, 11 patches.

v3.1.0 06/Abr

Custom Tour Agent, Performance e Feature Flags

Qualificação de tours personalizados, feature flag ENABLE_ITINERARY (JWT role-based), otimização de performance, plano Salesforce.

Arquitetura Multi-Agent (v3.1.0)

Orquestrador inteligente com 10 agentes especializados e 25+ tools.

graph TB
    ROOT["root_agent\n(Orquestrador)"]

    ROOT -->|transfer| DISC["discovery_agent\nBusca de Produtos\n6 tools"]
    ROOT -->|transfer| ITIN["itinerary_agent\nRoteiros Multi-Destino\n5 tools"]
    ROOT -->|transfer| QUOT["quote_agent\nCotação e Preços\n4 tools"]
    ROOT -->|transfer| BOOK["booking_agent\nReservas\n8 tools"]
    ROOT -->|transfer| PAY["payment_agent\nPagamentos\n3 tools"]
    ROOT -->|transfer| UTIL["utils_agent\nEmail e CSV\n2 tools"]
    ROOT -->|transfer| SUPP["support_agent\nAtendimento Humano\n1 tool"]
    ROOT -->|transfer| CTOUR["custom_tour_agent\nTours Personalizados\n2 tools"]

    ROOT -.->|AgentTool| RES["research_agent\nGoogle Search\n1 tool"]
    ROOT -.->|AgentTool| FAQ["faq_agent\nFAQ iFriend\n0 tools"]

    style ROOT fill:#4263eb,color:#fff,stroke-width:2px
    style DISC fill:#51cf66,color:#fff
    style ITIN fill:#51cf66,color:#fff
    style QUOT fill:#fcc419,color:#333
    style BOOK fill:#ff922b,color:#fff
    style PAY fill:#ff6b6b,color:#fff
    style UTIL fill:#845ef7,color:#fff
    style SUPP fill:#20c997,color:#fff
    style CTOUR fill:#f06595,color:#fff
    style RES fill:#868e96,color:#fff
    style FAQ fill:#868e96,color:#fff
                

Arquitetura Completa — Cloud Run

graph TB
    subgraph Canais["Canais de Entrada"]
        WA["WhatsApp\nEvolution API"]
        WA2["WhatsApp\nOfficial Meta"]
        SL["Slack"]
        TG["Telegram"]
        WC["WebChat Widget"]
        SSE_C["SSE Streaming"]
    end

    subgraph CR["Cloud Run — unified_bot.py"]
        WEBHOOK["/webhook/*"]
        WEBCHAT_EP["/webchat/message"]
        SSE_EP["/sse/chat + /sse/stream"]

        WA & WA2 & SL & TG --> WEBHOOK
        WC --> WEBCHAT_EP
        SSE_C --> SSE_EP

        AF["AdapterFactory"]
        WEBHOOK --> AF
        AF --> CP["ConversationProcessor"]
        WEBCHAT_EP --> CP
        SSE_EP --> SM["StreamManager"]
        SM --> CP
    end

    subgraph ADK["Google ADK Runner"]
        CP --> RUNNER["Runner"]
        RUNNER --> ROOTAG["root_agent"]
        ROOTAG --> AGENTS["10 sub-agents\n25 tools"]
    end

    subgraph Infra["Infraestrutura"]
        RUNNER --> SESS[("CloudSQL\nSessions")]
        RUNNER --> MEM[("CloudSQL\nMemory v2")]
        RUNNER --> REDIS[("Redis\nCache + JWT")]
    end

    subgraph External["Serviços Externos"]
        AGENTS --> API["iFriend API"]
        AGENTS --> GS["Google Search"]
        AGENTS --> SGR["SendGrid"]
    end

    style ROOTAG fill:#4263eb,color:#fff
    style RUNNER fill:#4263eb,color:#fff
    style CR fill:#eef2ff
    style ADK fill:#e0e7ff
                

SSE Streaming — Experiência em Tempo Real

Feedback progressivo de tool calls e text chunks via Server-Sent Events.

sequenceDiagram
    participant U as Usuário (Browser)
    participant S as Cloud Run (SSE)
    participant A as Agente IA
    participant T as Tool (ex: busca)

    U->>S: POST /sse/chat
    S-->>U: { stream_id }
    U->>S: GET /sse/stream/{id} (EventSource)
    S->>A: run_async()
    A->>T: busca_produtos()
    S-->>U: event: tool_call_start 🔍
    T-->>A: resultados
    S-->>U: event: tool_call_complete ✅
    A-->>S: texto em chunks
    S-->>U: event: text_chunk (1)
    S-->>U: event: text_chunk (2)
    S-->>U: event: complete 🏁
                

Feature Flags — Configurabilidade por Cliente

Composição dinâmica de agentes e funcionalidades sem alterar código.

graph TD
    FF["Feature Flags Engine"]
    FF --> EB["ENABLE_BOOKING\n(default: true)"]
    FF --> EP["ENABLE_PAYMENT\n(default: true)"]
    FF --> EM["ENABLE_MEMORY\n(default: true)"]
    FF --> ECT["ENABLE_CUSTOM_TOUR\n(default: true)"]
    FF --> EI["ENABLE_ITINERARY\n(JWT role-based)"]

    EB --> BOOK["booking_agent"]
    EP --> PAY["payment_agent"]
    EM --> MEMAG["Memory v2\n+ PreloadMemoryTool"]
    ECT --> CT["custom_tour_agent"]
    EI --> IT["itinerary_agent"]

    EP -.->|requer| EB

    style FF fill:#4263eb,color:#fff
                    

Cenários de Configuração

Cenário Agents Tools Uso
Completo 8 31 Full B2C
Sem payment 7 28 Reserva offline
Sem booking 6 20 Orçamento (Whitelabel)
Mínimo 5 18 Vitrine

Economia de Tokens

A arquitetura multi-agent com feature flags reduz drasticamente o uso de tokens por turno.

100%
v1.0 (Single)
~30%
v3.1 (Multi)
~70% de redução em tokens por turno

Métricas Detalhadas

Números que refletem a escala e qualidade das entregas.

Código

Linhas Python 26.542
Linhas adicionadas +55.172
Arquivos modificados 281

Qualidade

Testes automatizados 682
Arquivos de teste 42
Documentação (arquivos) 117

Plataforma

Agentes IA 10 + 1 orq.
Tools de domínio 25
Canais de atendimento 6
Feature flags 5
Provedores de email 3

Cobertura de Testes por Categoria

60+
Sub-agentes
45+
Orquestrador
52
Memory Service
30
AgentBuilder
26
Feature Flags
20
App Config
449+
Outros (tools, API, etc.)
682
Total

Canais de Atendimento

6 canais suportados, com arquitetura pronta para novos.

Slack
Produção
WhatsApp
Produção
SSE Streaming
Produção
WebChat
Produção
WhatsApp Official
Disponível
Telegram
Disponível
Salesforce Einstein Bot
Planejado Q2

Stack Tecnológico

Tecnologias que sustentam a plataforma.

ADK
Google ADK
v1.25.1
G
Gemini
2.5 Flash
Py
Python
3.11
F
FastAPI
Server HTTP
CR
Cloud Run
GCP Serverless
SQL
CloudSQL
MySQL 5.7+
R
Redis
Cache + JWT
SG
SendGrid
Email
T
pytest
7.4+

Próximos Passos — Q2 2026

Iniciativas planejadas para o próximo trimestre.

1

Salesforce Integration

Einstein Bot ↔ Cloud Run via Apex Action. Plano detalhado já disponível.

Planejado
2

Usage Tracking

Métricas de uso por cliente, canal e agente para analytics e billing.

Backlog
3

Whitelabel v2

Personalização de persona, idioma e catálogo por tenant.

Backlog