atendentepro 0.5.6__tar.gz → 0.5.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {atendentepro-0.5.6 → atendentepro-0.5.9}/CHANGELOG.md +28 -0
- atendentepro-0.5.6/README.md → atendentepro-0.5.9/PKG-INFO +188 -11
- atendentepro-0.5.6/PKG-INFO → atendentepro-0.5.9/README.md +130 -67
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/__init__.py +16 -0
- atendentepro-0.5.9/atendentepro/utils/__init__.py +40 -0
- atendentepro-0.5.9/atendentepro/utils/tracing.py +263 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/pyproject.toml +12 -3
- atendentepro-0.5.6/atendentepro/utils/__init__.py +0 -19
- atendentepro-0.5.6/atendentepro/utils/tracing.py +0 -71
- {atendentepro-0.5.6 → atendentepro-0.5.9}/LICENSE +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/MANIFEST.in +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/README.md +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/agents/__init__.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/agents/answer.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/agents/confirmation.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/agents/escalation.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/agents/feedback.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/agents/flow.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/agents/interview.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/agents/knowledge.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/agents/onboarding.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/agents/triage.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/agents/usage.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/config/__init__.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/config/settings.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/guardrails/__init__.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/guardrails/manager.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/license.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/models/__init__.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/models/context.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/models/outputs.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/network.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/prompts/__init__.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/prompts/answer.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/prompts/confirmation.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/prompts/escalation.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/prompts/feedback.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/prompts/flow.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/prompts/interview.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/prompts/knowledge.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/prompts/onboarding.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/prompts/triage.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/templates/__init__.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/templates/manager.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro/utils/openai_client.py +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/atendentepro.egg-info/SOURCES.txt +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/requirements.txt +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/setup.cfg +0 -0
- {atendentepro-0.5.6 → atendentepro-0.5.9}/setup.py +0 -0
|
@@ -5,6 +5,34 @@ All notable changes to AtendentePro will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.5.9] - 2025-01-07
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- Descrição PyPI formal: "Framework de orquestração de agentes IA"
|
|
12
|
+
- README profissional com foco em capacidades corporativas
|
|
13
|
+
- Tabela de capacidades técnicas no README
|
|
14
|
+
|
|
15
|
+
## [0.5.8] - 2025-01-07
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- Updated PyPI description to highlight all agent types
|
|
19
|
+
- Added new keywords: triage, handoff, escalation, feedback, knowledge-base, interview
|
|
20
|
+
- Changed `tracing` optional dependency to use `monkai-trace`
|
|
21
|
+
- Added `azure` optional dependency for Application Insights
|
|
22
|
+
|
|
23
|
+
## [0.5.7] - 2025-01-07
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
- MonkAI Trace integration for comprehensive agent monitoring
|
|
27
|
+
- New functions: `configure_monkai_trace`, `run_with_monkai_tracking`
|
|
28
|
+
- Session management with `set_monkai_user`, `set_monkai_input`
|
|
29
|
+
- Token segmentation support (input, output, process, memory)
|
|
30
|
+
- Multi-user session tracking for WhatsApp/chat bots
|
|
31
|
+
- Documentation for tracing setup in README
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
- Renamed `configure_tracing` to `configure_application_insights` (legacy alias kept)
|
|
35
|
+
|
|
8
36
|
## [0.5.6] - 2025-01-07
|
|
9
37
|
|
|
10
38
|
### Added
|
|
@@ -1,12 +1,81 @@
|
|
|
1
|
-
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: atendentepro
|
|
3
|
+
Version: 0.5.9
|
|
4
|
+
Summary: Framework de orquestração de agentes IA para resolver interações complexas integrando múltiplas fontes de dados (documentos, APIs, bancos) em uma única plataforma inteligente.
|
|
5
|
+
Author-email: BeMonkAI <contato@monkai.com.br>
|
|
6
|
+
Maintainer-email: BeMonkAI <contato@monkai.com.br>
|
|
7
|
+
License: Proprietary
|
|
8
|
+
Project-URL: Homepage, https://github.com/BeMonkAI/atendentepro
|
|
9
|
+
Project-URL: Documentation, https://github.com/BeMonkAI/atendentepro#readme
|
|
10
|
+
Project-URL: Repository, https://github.com/BeMonkAI/atendentepro
|
|
11
|
+
Project-URL: Issues, https://github.com/BeMonkAI/atendentepro/issues
|
|
12
|
+
Project-URL: Changelog, https://github.com/BeMonkAI/atendentepro/blob/main/CHANGELOG.md
|
|
13
|
+
Keywords: ai,agents,customer-service,chatbot,openai,multi-agent,atendimento,openai-agents,conversational-ai,rag,triage,handoff,escalation,feedback,knowledge-base,interview
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: Other/Proprietary License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
|
+
Classifier: Topic :: Communications :: Chat
|
|
24
|
+
Classifier: Operating System :: OS Independent
|
|
25
|
+
Requires-Python: >=3.9
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: openai-agents>=0.3.3
|
|
29
|
+
Requires-Dist: openai>=1.107.1
|
|
30
|
+
Requires-Dist: pydantic>=2.0.0
|
|
31
|
+
Requires-Dist: PyYAML>=6.0
|
|
32
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
33
|
+
Requires-Dist: httpx>=0.27.0
|
|
34
|
+
Requires-Dist: numpy>=1.24.0
|
|
35
|
+
Requires-Dist: scikit-learn>=1.3.0
|
|
36
|
+
Provides-Extra: dev
|
|
37
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
38
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
39
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
40
|
+
Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
41
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
42
|
+
Provides-Extra: docs
|
|
43
|
+
Requires-Dist: mkdocs>=1.5.0; extra == "docs"
|
|
44
|
+
Requires-Dist: mkdocs-material>=9.0.0; extra == "docs"
|
|
45
|
+
Provides-Extra: rag
|
|
46
|
+
Requires-Dist: PyPDF2>=3.0.0; extra == "rag"
|
|
47
|
+
Requires-Dist: python-docx>=0.8.11; extra == "rag"
|
|
48
|
+
Requires-Dist: python-pptx>=0.6.21; extra == "rag"
|
|
49
|
+
Requires-Dist: PyMuPDF>=1.23.0; extra == "rag"
|
|
50
|
+
Provides-Extra: tracing
|
|
51
|
+
Requires-Dist: monkai-trace>=0.2.9; extra == "tracing"
|
|
52
|
+
Provides-Extra: azure
|
|
53
|
+
Requires-Dist: opentelemetry-sdk>=1.20.0; extra == "azure"
|
|
54
|
+
Requires-Dist: azure-monitor-opentelemetry-exporter>=1.0.0; extra == "azure"
|
|
55
|
+
Provides-Extra: all
|
|
56
|
+
Requires-Dist: atendentepro[azure,dev,docs,rag,tracing]; extra == "all"
|
|
57
|
+
Dynamic: license-file
|
|
58
|
+
|
|
59
|
+
# AtendentePro
|
|
2
60
|
|
|
3
61
|
[](https://www.python.org/downloads/)
|
|
4
62
|
[](https://pypi.org/project/atendentepro/)
|
|
5
63
|
[](LICENSE)
|
|
6
64
|
|
|
7
|
-
**
|
|
65
|
+
**Framework de orquestração de agentes IA para interações complexas**
|
|
8
66
|
|
|
9
|
-
|
|
67
|
+
Plataforma que unifica múltiplos agentes especializados para resolver demandas que envolvem diferentes fontes de dados, sistemas e fluxos de decisão — tudo orquestrado em um único lugar. Baseado no [OpenAI Agents SDK](https://github.com/openai/openai-agents-python).
|
|
68
|
+
|
|
69
|
+
### Principais Capacidades
|
|
70
|
+
|
|
71
|
+
| Capacidade | Descrição |
|
|
72
|
+
|------------|-----------|
|
|
73
|
+
| **Classificação Inteligente** | Identifica a intenção e direciona para o agente especializado |
|
|
74
|
+
| **Integração de Dados** | Conecta documentos (RAG), CSVs, bancos de dados SQL e APIs externas |
|
|
75
|
+
| **Orquestração de Fluxos** | Handoffs automáticos entre agentes conforme a complexidade da demanda |
|
|
76
|
+
| **Escalonamento Controlado** | Transferência para atendimento humano com contexto preservado |
|
|
77
|
+
| **Gestão de Feedbacks** | Sistema de tickets para reclamações, sugestões e acompanhamento |
|
|
78
|
+
| **Configuração Declarativa** | Personalização completa via arquivos YAML |
|
|
10
79
|
|
|
11
80
|
---
|
|
12
81
|
|
|
@@ -23,6 +92,7 @@ Uma biblioteca Python modular para criar sistemas de atendimento automatizado us
|
|
|
23
92
|
- [Escalation Agent](#-escalation-agent)
|
|
24
93
|
- [Feedback Agent](#-feedback-agent)
|
|
25
94
|
- [Fluxo de Handoffs](#-fluxo-de-handoffs)
|
|
95
|
+
- [Tracing e Monitoramento](#-tracing-e-monitoramento)
|
|
26
96
|
- [Suporte](#-suporte)
|
|
27
97
|
|
|
28
98
|
---
|
|
@@ -33,8 +103,8 @@ Uma biblioteca Python modular para criar sistemas de atendimento automatizado us
|
|
|
33
103
|
# Via PyPI
|
|
34
104
|
pip install atendentepro
|
|
35
105
|
|
|
36
|
-
#
|
|
37
|
-
pip install atendentepro
|
|
106
|
+
# Com monitoramento (recomendado)
|
|
107
|
+
pip install atendentepro[tracing]
|
|
38
108
|
```
|
|
39
109
|
|
|
40
110
|
---
|
|
@@ -553,6 +623,83 @@ network = create_standard_network(
|
|
|
553
623
|
|
|
554
624
|
---
|
|
555
625
|
|
|
626
|
+
## 📊 Tracing e Monitoramento
|
|
627
|
+
|
|
628
|
+
### MonkAI Trace (Recomendado)
|
|
629
|
+
|
|
630
|
+
Integração com [MonkAI Trace](https://github.com/BeMonkAI/monkai-trace) para monitoramento completo de agentes:
|
|
631
|
+
|
|
632
|
+
```bash
|
|
633
|
+
pip install monkai-trace
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
```python
|
|
637
|
+
from atendentepro import (
|
|
638
|
+
activate,
|
|
639
|
+
create_standard_network,
|
|
640
|
+
configure_monkai_trace,
|
|
641
|
+
run_with_monkai_tracking,
|
|
642
|
+
)
|
|
643
|
+
|
|
644
|
+
# 1. Ativar biblioteca
|
|
645
|
+
activate("ATP_seu-token")
|
|
646
|
+
|
|
647
|
+
# 2. Configurar MonkAI Trace
|
|
648
|
+
configure_monkai_trace(
|
|
649
|
+
tracer_token="tk_seu_token_monkai", # ou env MONKAI_TRACER_TOKEN
|
|
650
|
+
namespace="meu-projeto",
|
|
651
|
+
)
|
|
652
|
+
|
|
653
|
+
# 3. Criar rede
|
|
654
|
+
network = create_standard_network(...)
|
|
655
|
+
|
|
656
|
+
# 4. Executar com tracking
|
|
657
|
+
result = await run_with_monkai_tracking(
|
|
658
|
+
agent=network.triage,
|
|
659
|
+
user_input="Olá, preciso de ajuda",
|
|
660
|
+
user_id="user123", # Opcional: para sessões multi-usuário
|
|
661
|
+
)
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
**Recursos do MonkAI Trace:**
|
|
665
|
+
- ✅ Tracking automático de sessões
|
|
666
|
+
- ✅ Segmentação de tokens (input, output, process, memory)
|
|
667
|
+
- ✅ Rastreamento de handoffs entre agentes
|
|
668
|
+
- ✅ Captura de ferramentas internas (web_search, RAG)
|
|
669
|
+
- ✅ Suporte multi-usuário (WhatsApp, chat)
|
|
670
|
+
|
|
671
|
+
### Uso Avançado
|
|
672
|
+
|
|
673
|
+
```python
|
|
674
|
+
from atendentepro import (
|
|
675
|
+
get_monkai_hooks,
|
|
676
|
+
set_monkai_user,
|
|
677
|
+
set_monkai_input,
|
|
678
|
+
)
|
|
679
|
+
from agents import Runner
|
|
680
|
+
|
|
681
|
+
# Para controle manual
|
|
682
|
+
hooks = get_monkai_hooks()
|
|
683
|
+
set_monkai_user("5511999999999") # WhatsApp
|
|
684
|
+
set_monkai_input("Como cancelar?")
|
|
685
|
+
|
|
686
|
+
result = await Runner.run(network.triage, messages, hooks=hooks)
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
### Application Insights (Azure)
|
|
690
|
+
|
|
691
|
+
Para Azure, use Application Insights:
|
|
692
|
+
|
|
693
|
+
```python
|
|
694
|
+
from atendentepro import configure_application_insights
|
|
695
|
+
|
|
696
|
+
configure_application_insights(
|
|
697
|
+
connection_string="InstrumentationKey=..."
|
|
698
|
+
)
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
---
|
|
702
|
+
|
|
556
703
|
## 🤝 Suporte
|
|
557
704
|
|
|
558
705
|
- 📧 **Email:** contato@monkai.com.br
|
|
@@ -562,26 +709,56 @@ network = create_standard_network(
|
|
|
562
709
|
|
|
563
710
|
## 📝 Changelog
|
|
564
711
|
|
|
712
|
+
### v0.5.9 (Atual)
|
|
713
|
+
- Descrição PyPI formal: "Framework de orquestração de agentes IA"
|
|
714
|
+
- README profissional com foco em capacidades corporativas
|
|
715
|
+
|
|
716
|
+
### v0.5.8
|
|
717
|
+
- Novos keywords: triage, handoff, escalation, feedback, knowledge-base
|
|
718
|
+
- Dependência `tracing` agora usa `monkai-trace`
|
|
719
|
+
|
|
720
|
+
### v0.5.7
|
|
721
|
+
- **MonkAI Trace**: Integração completa para monitoramento de agentes
|
|
722
|
+
- Novas funções: `configure_monkai_trace`, `run_with_monkai_tracking`
|
|
723
|
+
- Suporte multi-usuário para WhatsApp/chat
|
|
724
|
+
|
|
725
|
+
### v0.5.6
|
|
726
|
+
- **Agentes configuráveis**: `include_knowledge=False`, `include_flow=False`, etc.
|
|
727
|
+
- Permite criar redes sem agentes específicos
|
|
728
|
+
|
|
729
|
+
### v0.5.5
|
|
730
|
+
- Workflow PyPI apenas com tags de versão
|
|
731
|
+
|
|
732
|
+
### v0.5.4
|
|
733
|
+
- Documentação completa standalone no PyPI
|
|
734
|
+
|
|
565
735
|
### v0.5.3
|
|
566
|
-
-
|
|
736
|
+
- Links de documentação corrigidos para PyPI
|
|
567
737
|
|
|
568
738
|
### v0.5.2
|
|
569
|
-
-
|
|
739
|
+
- Contatos atualizados (monkai.com.br)
|
|
570
740
|
|
|
571
741
|
### v0.5.1
|
|
572
742
|
- Prompts modulares para Escalation e Feedback
|
|
573
743
|
- Remoção de handoff circular Answer→Interview
|
|
574
744
|
|
|
575
745
|
### v0.5.0
|
|
576
|
-
- Novo
|
|
746
|
+
- **Novo**: Feedback Agent (tickets/SAC)
|
|
747
|
+
- Ferramentas: criar_ticket, consultar_ticket, listar_meus_tickets
|
|
577
748
|
|
|
578
749
|
### v0.4.0
|
|
579
|
-
- Novo
|
|
750
|
+
- **Novo**: Escalation Agent (transferência humana)
|
|
751
|
+
- Verificação de horário, prioridade automática, webhooks
|
|
580
752
|
|
|
581
753
|
### v0.3.0
|
|
582
|
-
- Sistema de licenciamento
|
|
754
|
+
- Sistema de licenciamento com tokens
|
|
583
755
|
- Publicação inicial no PyPI
|
|
584
756
|
|
|
757
|
+
### v0.2.0
|
|
758
|
+
- Arquitetura modular completa
|
|
759
|
+
- 8 agentes especializados
|
|
760
|
+
- Sistema de templates YAML
|
|
761
|
+
|
|
585
762
|
---
|
|
586
763
|
|
|
587
|
-
**Made with ❤️ by MonkAI**
|
|
764
|
+
**Made with ❤️ by [MonkAI](https://www.monkai.com.br)**
|
|
@@ -1,68 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
Name: atendentepro
|
|
3
|
-
Version: 0.5.6
|
|
4
|
-
Summary: Sistema de Atendimento Inteligente com Múltiplos Agentes IA - Biblioteca independente e modular baseada no OpenAI Agents SDK
|
|
5
|
-
Author-email: BeMonkAI <contato@monkai.com.br>
|
|
6
|
-
Maintainer-email: BeMonkAI <contato@monkai.com.br>
|
|
7
|
-
License: Proprietary
|
|
8
|
-
Project-URL: Homepage, https://github.com/BeMonkAI/atendentepro
|
|
9
|
-
Project-URL: Documentation, https://github.com/BeMonkAI/atendentepro#readme
|
|
10
|
-
Project-URL: Repository, https://github.com/BeMonkAI/atendentepro
|
|
11
|
-
Project-URL: Issues, https://github.com/BeMonkAI/atendentepro/issues
|
|
12
|
-
Project-URL: Changelog, https://github.com/BeMonkAI/atendentepro/blob/main/CHANGELOG.md
|
|
13
|
-
Keywords: ai,agents,customer-service,chatbot,openai,multi-agent,atendimento,openai-agents,conversational-ai,rag
|
|
14
|
-
Classifier: Development Status :: 4 - Beta
|
|
15
|
-
Classifier: Intended Audience :: Developers
|
|
16
|
-
Classifier: License :: Other/Proprietary License
|
|
17
|
-
Classifier: Programming Language :: Python :: 3
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
-
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
|
-
Classifier: Topic :: Communications :: Chat
|
|
24
|
-
Classifier: Operating System :: OS Independent
|
|
25
|
-
Requires-Python: >=3.9
|
|
26
|
-
Description-Content-Type: text/markdown
|
|
27
|
-
License-File: LICENSE
|
|
28
|
-
Requires-Dist: openai-agents>=0.3.3
|
|
29
|
-
Requires-Dist: openai>=1.107.1
|
|
30
|
-
Requires-Dist: pydantic>=2.0.0
|
|
31
|
-
Requires-Dist: PyYAML>=6.0
|
|
32
|
-
Requires-Dist: python-dotenv>=1.0.0
|
|
33
|
-
Requires-Dist: httpx>=0.27.0
|
|
34
|
-
Requires-Dist: numpy>=1.24.0
|
|
35
|
-
Requires-Dist: scikit-learn>=1.3.0
|
|
36
|
-
Provides-Extra: dev
|
|
37
|
-
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
38
|
-
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
39
|
-
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
40
|
-
Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
41
|
-
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
42
|
-
Provides-Extra: docs
|
|
43
|
-
Requires-Dist: mkdocs>=1.5.0; extra == "docs"
|
|
44
|
-
Requires-Dist: mkdocs-material>=9.0.0; extra == "docs"
|
|
45
|
-
Provides-Extra: rag
|
|
46
|
-
Requires-Dist: PyPDF2>=3.0.0; extra == "rag"
|
|
47
|
-
Requires-Dist: python-docx>=0.8.11; extra == "rag"
|
|
48
|
-
Requires-Dist: python-pptx>=0.6.21; extra == "rag"
|
|
49
|
-
Requires-Dist: PyMuPDF>=1.23.0; extra == "rag"
|
|
50
|
-
Provides-Extra: tracing
|
|
51
|
-
Requires-Dist: opentelemetry-sdk>=1.20.0; extra == "tracing"
|
|
52
|
-
Requires-Dist: azure-monitor-opentelemetry-exporter>=1.0.0; extra == "tracing"
|
|
53
|
-
Provides-Extra: all
|
|
54
|
-
Requires-Dist: atendentepro[dev,docs,rag,tracing]; extra == "all"
|
|
55
|
-
Dynamic: license-file
|
|
56
|
-
|
|
57
|
-
# AtendentePro 🤖
|
|
1
|
+
# AtendentePro
|
|
58
2
|
|
|
59
3
|
[](https://www.python.org/downloads/)
|
|
60
4
|
[](https://pypi.org/project/atendentepro/)
|
|
61
5
|
[](LICENSE)
|
|
62
6
|
|
|
63
|
-
**
|
|
7
|
+
**Framework de orquestração de agentes IA para interações complexas**
|
|
64
8
|
|
|
65
|
-
|
|
9
|
+
Plataforma que unifica múltiplos agentes especializados para resolver demandas que envolvem diferentes fontes de dados, sistemas e fluxos de decisão — tudo orquestrado em um único lugar. Baseado no [OpenAI Agents SDK](https://github.com/openai/openai-agents-python).
|
|
10
|
+
|
|
11
|
+
### Principais Capacidades
|
|
12
|
+
|
|
13
|
+
| Capacidade | Descrição |
|
|
14
|
+
|------------|-----------|
|
|
15
|
+
| **Classificação Inteligente** | Identifica a intenção e direciona para o agente especializado |
|
|
16
|
+
| **Integração de Dados** | Conecta documentos (RAG), CSVs, bancos de dados SQL e APIs externas |
|
|
17
|
+
| **Orquestração de Fluxos** | Handoffs automáticos entre agentes conforme a complexidade da demanda |
|
|
18
|
+
| **Escalonamento Controlado** | Transferência para atendimento humano com contexto preservado |
|
|
19
|
+
| **Gestão de Feedbacks** | Sistema de tickets para reclamações, sugestões e acompanhamento |
|
|
20
|
+
| **Configuração Declarativa** | Personalização completa via arquivos YAML |
|
|
66
21
|
|
|
67
22
|
---
|
|
68
23
|
|
|
@@ -79,6 +34,7 @@ Uma biblioteca Python modular para criar sistemas de atendimento automatizado us
|
|
|
79
34
|
- [Escalation Agent](#-escalation-agent)
|
|
80
35
|
- [Feedback Agent](#-feedback-agent)
|
|
81
36
|
- [Fluxo de Handoffs](#-fluxo-de-handoffs)
|
|
37
|
+
- [Tracing e Monitoramento](#-tracing-e-monitoramento)
|
|
82
38
|
- [Suporte](#-suporte)
|
|
83
39
|
|
|
84
40
|
---
|
|
@@ -89,8 +45,8 @@ Uma biblioteca Python modular para criar sistemas de atendimento automatizado us
|
|
|
89
45
|
# Via PyPI
|
|
90
46
|
pip install atendentepro
|
|
91
47
|
|
|
92
|
-
#
|
|
93
|
-
pip install atendentepro
|
|
48
|
+
# Com monitoramento (recomendado)
|
|
49
|
+
pip install atendentepro[tracing]
|
|
94
50
|
```
|
|
95
51
|
|
|
96
52
|
---
|
|
@@ -609,6 +565,83 @@ network = create_standard_network(
|
|
|
609
565
|
|
|
610
566
|
---
|
|
611
567
|
|
|
568
|
+
## 📊 Tracing e Monitoramento
|
|
569
|
+
|
|
570
|
+
### MonkAI Trace (Recomendado)
|
|
571
|
+
|
|
572
|
+
Integração com [MonkAI Trace](https://github.com/BeMonkAI/monkai-trace) para monitoramento completo de agentes:
|
|
573
|
+
|
|
574
|
+
```bash
|
|
575
|
+
pip install monkai-trace
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
```python
|
|
579
|
+
from atendentepro import (
|
|
580
|
+
activate,
|
|
581
|
+
create_standard_network,
|
|
582
|
+
configure_monkai_trace,
|
|
583
|
+
run_with_monkai_tracking,
|
|
584
|
+
)
|
|
585
|
+
|
|
586
|
+
# 1. Ativar biblioteca
|
|
587
|
+
activate("ATP_seu-token")
|
|
588
|
+
|
|
589
|
+
# 2. Configurar MonkAI Trace
|
|
590
|
+
configure_monkai_trace(
|
|
591
|
+
tracer_token="tk_seu_token_monkai", # ou env MONKAI_TRACER_TOKEN
|
|
592
|
+
namespace="meu-projeto",
|
|
593
|
+
)
|
|
594
|
+
|
|
595
|
+
# 3. Criar rede
|
|
596
|
+
network = create_standard_network(...)
|
|
597
|
+
|
|
598
|
+
# 4. Executar com tracking
|
|
599
|
+
result = await run_with_monkai_tracking(
|
|
600
|
+
agent=network.triage,
|
|
601
|
+
user_input="Olá, preciso de ajuda",
|
|
602
|
+
user_id="user123", # Opcional: para sessões multi-usuário
|
|
603
|
+
)
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
**Recursos do MonkAI Trace:**
|
|
607
|
+
- ✅ Tracking automático de sessões
|
|
608
|
+
- ✅ Segmentação de tokens (input, output, process, memory)
|
|
609
|
+
- ✅ Rastreamento de handoffs entre agentes
|
|
610
|
+
- ✅ Captura de ferramentas internas (web_search, RAG)
|
|
611
|
+
- ✅ Suporte multi-usuário (WhatsApp, chat)
|
|
612
|
+
|
|
613
|
+
### Uso Avançado
|
|
614
|
+
|
|
615
|
+
```python
|
|
616
|
+
from atendentepro import (
|
|
617
|
+
get_monkai_hooks,
|
|
618
|
+
set_monkai_user,
|
|
619
|
+
set_monkai_input,
|
|
620
|
+
)
|
|
621
|
+
from agents import Runner
|
|
622
|
+
|
|
623
|
+
# Para controle manual
|
|
624
|
+
hooks = get_monkai_hooks()
|
|
625
|
+
set_monkai_user("5511999999999") # WhatsApp
|
|
626
|
+
set_monkai_input("Como cancelar?")
|
|
627
|
+
|
|
628
|
+
result = await Runner.run(network.triage, messages, hooks=hooks)
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
### Application Insights (Azure)
|
|
632
|
+
|
|
633
|
+
Para Azure, use Application Insights:
|
|
634
|
+
|
|
635
|
+
```python
|
|
636
|
+
from atendentepro import configure_application_insights
|
|
637
|
+
|
|
638
|
+
configure_application_insights(
|
|
639
|
+
connection_string="InstrumentationKey=..."
|
|
640
|
+
)
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
---
|
|
644
|
+
|
|
612
645
|
## 🤝 Suporte
|
|
613
646
|
|
|
614
647
|
- 📧 **Email:** contato@monkai.com.br
|
|
@@ -618,26 +651,56 @@ network = create_standard_network(
|
|
|
618
651
|
|
|
619
652
|
## 📝 Changelog
|
|
620
653
|
|
|
654
|
+
### v0.5.9 (Atual)
|
|
655
|
+
- Descrição PyPI formal: "Framework de orquestração de agentes IA"
|
|
656
|
+
- README profissional com foco em capacidades corporativas
|
|
657
|
+
|
|
658
|
+
### v0.5.8
|
|
659
|
+
- Novos keywords: triage, handoff, escalation, feedback, knowledge-base
|
|
660
|
+
- Dependência `tracing` agora usa `monkai-trace`
|
|
661
|
+
|
|
662
|
+
### v0.5.7
|
|
663
|
+
- **MonkAI Trace**: Integração completa para monitoramento de agentes
|
|
664
|
+
- Novas funções: `configure_monkai_trace`, `run_with_monkai_tracking`
|
|
665
|
+
- Suporte multi-usuário para WhatsApp/chat
|
|
666
|
+
|
|
667
|
+
### v0.5.6
|
|
668
|
+
- **Agentes configuráveis**: `include_knowledge=False`, `include_flow=False`, etc.
|
|
669
|
+
- Permite criar redes sem agentes específicos
|
|
670
|
+
|
|
671
|
+
### v0.5.5
|
|
672
|
+
- Workflow PyPI apenas com tags de versão
|
|
673
|
+
|
|
674
|
+
### v0.5.4
|
|
675
|
+
- Documentação completa standalone no PyPI
|
|
676
|
+
|
|
621
677
|
### v0.5.3
|
|
622
|
-
-
|
|
678
|
+
- Links de documentação corrigidos para PyPI
|
|
623
679
|
|
|
624
680
|
### v0.5.2
|
|
625
|
-
-
|
|
681
|
+
- Contatos atualizados (monkai.com.br)
|
|
626
682
|
|
|
627
683
|
### v0.5.1
|
|
628
684
|
- Prompts modulares para Escalation e Feedback
|
|
629
685
|
- Remoção de handoff circular Answer→Interview
|
|
630
686
|
|
|
631
687
|
### v0.5.0
|
|
632
|
-
- Novo
|
|
688
|
+
- **Novo**: Feedback Agent (tickets/SAC)
|
|
689
|
+
- Ferramentas: criar_ticket, consultar_ticket, listar_meus_tickets
|
|
633
690
|
|
|
634
691
|
### v0.4.0
|
|
635
|
-
- Novo
|
|
692
|
+
- **Novo**: Escalation Agent (transferência humana)
|
|
693
|
+
- Verificação de horário, prioridade automática, webhooks
|
|
636
694
|
|
|
637
695
|
### v0.3.0
|
|
638
|
-
- Sistema de licenciamento
|
|
696
|
+
- Sistema de licenciamento com tokens
|
|
639
697
|
- Publicação inicial no PyPI
|
|
640
698
|
|
|
699
|
+
### v0.2.0
|
|
700
|
+
- Arquitetura modular completa
|
|
701
|
+
- 8 agentes especializados
|
|
702
|
+
- Sistema de templates YAML
|
|
703
|
+
|
|
641
704
|
---
|
|
642
705
|
|
|
643
|
-
**Made with ❤️ by MonkAI**
|
|
706
|
+
**Made with ❤️ by [MonkAI](https://www.monkai.com.br)**
|
|
@@ -144,6 +144,14 @@ from atendentepro.utils import (
|
|
|
144
144
|
get_async_client,
|
|
145
145
|
get_provider,
|
|
146
146
|
configure_tracing,
|
|
147
|
+
# MonkAI Trace
|
|
148
|
+
configure_monkai_trace,
|
|
149
|
+
get_monkai_hooks,
|
|
150
|
+
set_monkai_user,
|
|
151
|
+
set_monkai_input,
|
|
152
|
+
run_with_monkai_tracking,
|
|
153
|
+
# Application Insights
|
|
154
|
+
configure_application_insights,
|
|
147
155
|
)
|
|
148
156
|
|
|
149
157
|
__all__ = [
|
|
@@ -225,5 +233,13 @@ __all__ = [
|
|
|
225
233
|
"get_async_client",
|
|
226
234
|
"get_provider",
|
|
227
235
|
"configure_tracing",
|
|
236
|
+
# MonkAI Trace
|
|
237
|
+
"configure_monkai_trace",
|
|
238
|
+
"get_monkai_hooks",
|
|
239
|
+
"set_monkai_user",
|
|
240
|
+
"set_monkai_input",
|
|
241
|
+
"run_with_monkai_tracking",
|
|
242
|
+
# Application Insights
|
|
243
|
+
"configure_application_insights",
|
|
228
244
|
]
|
|
229
245
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""Utility modules for AtendentePro library."""
|
|
3
|
+
|
|
4
|
+
from .openai_client import (
|
|
5
|
+
get_async_client,
|
|
6
|
+
get_provider,
|
|
7
|
+
AsyncClient,
|
|
8
|
+
Provider,
|
|
9
|
+
)
|
|
10
|
+
from .tracing import (
|
|
11
|
+
# MonkAI Trace (recommended)
|
|
12
|
+
configure_monkai_trace,
|
|
13
|
+
get_monkai_hooks,
|
|
14
|
+
set_monkai_user,
|
|
15
|
+
set_monkai_input,
|
|
16
|
+
run_with_monkai_tracking,
|
|
17
|
+
# Application Insights (Azure)
|
|
18
|
+
configure_application_insights,
|
|
19
|
+
# Legacy
|
|
20
|
+
configure_tracing,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
__all__ = [
|
|
24
|
+
# OpenAI Client
|
|
25
|
+
"get_async_client",
|
|
26
|
+
"get_provider",
|
|
27
|
+
"AsyncClient",
|
|
28
|
+
"Provider",
|
|
29
|
+
# MonkAI Trace
|
|
30
|
+
"configure_monkai_trace",
|
|
31
|
+
"get_monkai_hooks",
|
|
32
|
+
"set_monkai_user",
|
|
33
|
+
"set_monkai_input",
|
|
34
|
+
"run_with_monkai_tracking",
|
|
35
|
+
# Application Insights
|
|
36
|
+
"configure_application_insights",
|
|
37
|
+
# Legacy
|
|
38
|
+
"configure_tracing",
|
|
39
|
+
]
|
|
40
|
+
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Tracing configuration for AtendentePro.
|
|
4
|
+
|
|
5
|
+
Provides optional tracing integrations:
|
|
6
|
+
- MonkAI Trace (recommended): Full agent tracking with token segmentation
|
|
7
|
+
- Application Insights: Azure telemetry
|
|
8
|
+
|
|
9
|
+
MonkAI Trace: https://github.com/BeMonkAI/monkai-trace
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import logging
|
|
15
|
+
import os
|
|
16
|
+
from typing import Optional, Any, TYPE_CHECKING
|
|
17
|
+
|
|
18
|
+
from atendentepro.config import get_config
|
|
19
|
+
|
|
20
|
+
if TYPE_CHECKING:
|
|
21
|
+
from agents import Agent
|
|
22
|
+
|
|
23
|
+
logger = logging.getLogger(__name__)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
# =============================================================================
|
|
27
|
+
# MONKAI TRACE INTEGRATION
|
|
28
|
+
# =============================================================================
|
|
29
|
+
|
|
30
|
+
_MONKAI_HOOKS: Optional[Any] = None
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def configure_monkai_trace(
|
|
34
|
+
tracer_token: Optional[str] = None,
|
|
35
|
+
namespace: Optional[str] = None,
|
|
36
|
+
inactivity_timeout: int = 120,
|
|
37
|
+
batch_size: int = 1,
|
|
38
|
+
) -> bool:
|
|
39
|
+
"""
|
|
40
|
+
Configure MonkAI Trace for agent tracking.
|
|
41
|
+
|
|
42
|
+
MonkAI Trace provides comprehensive agent monitoring with:
|
|
43
|
+
- Automatic session management
|
|
44
|
+
- Token segmentation (input, output, process, memory)
|
|
45
|
+
- Multi-agent handoff tracking
|
|
46
|
+
- Web search and tool tracking
|
|
47
|
+
|
|
48
|
+
Args:
|
|
49
|
+
tracer_token: MonkAI tracer token (or env MONKAI_TRACER_TOKEN)
|
|
50
|
+
namespace: Namespace for grouping traces (default: "atendentepro")
|
|
51
|
+
inactivity_timeout: Session timeout in seconds (default: 120)
|
|
52
|
+
batch_size: Upload batch size, 1 for real-time (default: 1)
|
|
53
|
+
|
|
54
|
+
Returns:
|
|
55
|
+
True if MonkAI Trace was configured, False otherwise.
|
|
56
|
+
|
|
57
|
+
Example:
|
|
58
|
+
>>> from atendentepro.utils import configure_monkai_trace
|
|
59
|
+
>>> configure_monkai_trace(tracer_token="tk_your_token")
|
|
60
|
+
True
|
|
61
|
+
|
|
62
|
+
>>> # Or via environment variable
|
|
63
|
+
>>> # export MONKAI_TRACER_TOKEN="tk_your_token"
|
|
64
|
+
>>> configure_monkai_trace()
|
|
65
|
+
True
|
|
66
|
+
"""
|
|
67
|
+
global _MONKAI_HOOKS
|
|
68
|
+
|
|
69
|
+
# Get token from parameter or environment
|
|
70
|
+
token = tracer_token or os.environ.get("MONKAI_TRACER_TOKEN")
|
|
71
|
+
|
|
72
|
+
if not token:
|
|
73
|
+
logger.debug("No MonkAI tracer token provided. MonkAI Trace disabled.")
|
|
74
|
+
return False
|
|
75
|
+
|
|
76
|
+
try:
|
|
77
|
+
from monkai_trace.integrations.openai_agents import MonkAIRunHooks
|
|
78
|
+
|
|
79
|
+
_MONKAI_HOOKS = MonkAIRunHooks(
|
|
80
|
+
tracer_token=token,
|
|
81
|
+
namespace=namespace or "atendentepro",
|
|
82
|
+
inactivity_timeout=inactivity_timeout,
|
|
83
|
+
batch_size=batch_size,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
logger.info(f"MonkAI Trace configured successfully (namespace: {namespace or 'atendentepro'})")
|
|
87
|
+
return True
|
|
88
|
+
|
|
89
|
+
except ImportError:
|
|
90
|
+
logger.warning(
|
|
91
|
+
"MonkAI Trace not available. "
|
|
92
|
+
"Install 'monkai-trace' for agent tracking: pip install monkai-trace"
|
|
93
|
+
)
|
|
94
|
+
return False
|
|
95
|
+
except Exception as e:
|
|
96
|
+
logger.error(f"Failed to configure MonkAI Trace: {e}")
|
|
97
|
+
return False
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def get_monkai_hooks() -> Optional[Any]:
|
|
101
|
+
"""
|
|
102
|
+
Get the configured MonkAI Run Hooks.
|
|
103
|
+
|
|
104
|
+
Returns:
|
|
105
|
+
MonkAIRunHooks instance if configured, None otherwise.
|
|
106
|
+
|
|
107
|
+
Example:
|
|
108
|
+
>>> hooks = get_monkai_hooks()
|
|
109
|
+
>>> if hooks:
|
|
110
|
+
... result = await Runner.run(agent, messages, hooks=hooks)
|
|
111
|
+
"""
|
|
112
|
+
return _MONKAI_HOOKS
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def set_monkai_user(user_id: str) -> None:
|
|
116
|
+
"""
|
|
117
|
+
Set the user ID for MonkAI session tracking.
|
|
118
|
+
|
|
119
|
+
Useful for multi-user scenarios like WhatsApp bots.
|
|
120
|
+
|
|
121
|
+
Args:
|
|
122
|
+
user_id: Unique user identifier (phone, email, etc.)
|
|
123
|
+
|
|
124
|
+
Example:
|
|
125
|
+
>>> set_monkai_user("5511999999999") # WhatsApp
|
|
126
|
+
>>> set_monkai_user("user@email.com") # Email
|
|
127
|
+
"""
|
|
128
|
+
if _MONKAI_HOOKS:
|
|
129
|
+
_MONKAI_HOOKS.set_user_id(user_id)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def set_monkai_input(user_input: str) -> None:
|
|
133
|
+
"""
|
|
134
|
+
Set the user input for MonkAI tracking.
|
|
135
|
+
|
|
136
|
+
Call this before running the agent to capture the user message.
|
|
137
|
+
|
|
138
|
+
Args:
|
|
139
|
+
user_input: The user's message/query
|
|
140
|
+
|
|
141
|
+
Example:
|
|
142
|
+
>>> set_monkai_input("Como faço para cancelar minha assinatura?")
|
|
143
|
+
>>> result = await Runner.run(agent, messages, hooks=get_monkai_hooks())
|
|
144
|
+
"""
|
|
145
|
+
if _MONKAI_HOOKS:
|
|
146
|
+
_MONKAI_HOOKS.set_user_input(user_input)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
async def run_with_monkai_tracking(
|
|
150
|
+
agent: "Agent",
|
|
151
|
+
user_input: str,
|
|
152
|
+
user_id: Optional[str] = None,
|
|
153
|
+
) -> Any:
|
|
154
|
+
"""
|
|
155
|
+
Run an agent with MonkAI tracking enabled.
|
|
156
|
+
|
|
157
|
+
This is the recommended way to run agents with full tracking.
|
|
158
|
+
Captures internal tools (web_search, file_search) automatically.
|
|
159
|
+
|
|
160
|
+
Args:
|
|
161
|
+
agent: The agent to run
|
|
162
|
+
user_input: User's message/query
|
|
163
|
+
user_id: Optional user identifier for session management
|
|
164
|
+
|
|
165
|
+
Returns:
|
|
166
|
+
RunResult from the agent execution
|
|
167
|
+
|
|
168
|
+
Example:
|
|
169
|
+
>>> from atendentepro.utils import configure_monkai_trace, run_with_monkai_tracking
|
|
170
|
+
>>> configure_monkai_trace(tracer_token="tk_your_token")
|
|
171
|
+
>>> result = await run_with_monkai_tracking(network.triage, "Olá!")
|
|
172
|
+
"""
|
|
173
|
+
if not _MONKAI_HOOKS:
|
|
174
|
+
# Fallback to normal execution without tracking
|
|
175
|
+
from agents import Runner
|
|
176
|
+
return await Runner.run(agent, user_input)
|
|
177
|
+
|
|
178
|
+
try:
|
|
179
|
+
from monkai_trace.integrations.openai_agents import MonkAIRunHooks
|
|
180
|
+
|
|
181
|
+
if user_id:
|
|
182
|
+
_MONKAI_HOOKS.set_user_id(user_id)
|
|
183
|
+
|
|
184
|
+
# Use run_with_tracking for full internal tools capture
|
|
185
|
+
return await MonkAIRunHooks.run_with_tracking(agent, user_input, _MONKAI_HOOKS)
|
|
186
|
+
|
|
187
|
+
except Exception as e:
|
|
188
|
+
logger.error(f"Error running with MonkAI tracking: {e}")
|
|
189
|
+
# Fallback to normal execution
|
|
190
|
+
from agents import Runner
|
|
191
|
+
return await Runner.run(agent, user_input)
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
# =============================================================================
|
|
195
|
+
# APPLICATION INSIGHTS INTEGRATION (Azure)
|
|
196
|
+
# =============================================================================
|
|
197
|
+
|
|
198
|
+
def configure_application_insights(connection_string: Optional[str] = None) -> bool:
|
|
199
|
+
"""
|
|
200
|
+
Configure Application Insights tracing if connection string is available.
|
|
201
|
+
|
|
202
|
+
Args:
|
|
203
|
+
connection_string: Optional connection string. If not provided,
|
|
204
|
+
uses the value from configuration.
|
|
205
|
+
|
|
206
|
+
Returns:
|
|
207
|
+
True if tracing was configured, False otherwise.
|
|
208
|
+
"""
|
|
209
|
+
config = get_config()
|
|
210
|
+
conn_str = connection_string or config.application_insights_connection_string
|
|
211
|
+
|
|
212
|
+
if not conn_str:
|
|
213
|
+
logger.debug("No Application Insights connection string provided. Tracing disabled.")
|
|
214
|
+
return False
|
|
215
|
+
|
|
216
|
+
try:
|
|
217
|
+
# Try to configure Application Insights
|
|
218
|
+
from opentelemetry import trace
|
|
219
|
+
from opentelemetry.sdk.trace import TracerProvider
|
|
220
|
+
from opentelemetry.sdk.trace.export import BatchSpanProcessor
|
|
221
|
+
|
|
222
|
+
# Check if azure monitor is available
|
|
223
|
+
try:
|
|
224
|
+
from azure.monitor.opentelemetry.exporter import AzureMonitorTraceExporter
|
|
225
|
+
|
|
226
|
+
exporter = AzureMonitorTraceExporter(connection_string=conn_str)
|
|
227
|
+
provider = TracerProvider()
|
|
228
|
+
processor = BatchSpanProcessor(exporter)
|
|
229
|
+
provider.add_span_processor(processor)
|
|
230
|
+
trace.set_tracer_provider(provider)
|
|
231
|
+
|
|
232
|
+
logger.info("Application Insights tracing configured successfully.")
|
|
233
|
+
return True
|
|
234
|
+
|
|
235
|
+
except ImportError:
|
|
236
|
+
logger.warning(
|
|
237
|
+
"Azure Monitor exporter not available. "
|
|
238
|
+
"Install 'azure-monitor-opentelemetry-exporter' for Application Insights support."
|
|
239
|
+
)
|
|
240
|
+
return False
|
|
241
|
+
|
|
242
|
+
except ImportError:
|
|
243
|
+
logger.warning(
|
|
244
|
+
"OpenTelemetry not available. "
|
|
245
|
+
"Install 'opentelemetry-sdk' for tracing support."
|
|
246
|
+
)
|
|
247
|
+
return False
|
|
248
|
+
except Exception as e:
|
|
249
|
+
logger.error(f"Failed to configure tracing: {e}")
|
|
250
|
+
return False
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
# =============================================================================
|
|
254
|
+
# LEGACY ALIAS
|
|
255
|
+
# =============================================================================
|
|
256
|
+
|
|
257
|
+
def configure_tracing(connection_string: Optional[str] = None) -> bool:
|
|
258
|
+
"""
|
|
259
|
+
Legacy alias for configure_application_insights.
|
|
260
|
+
|
|
261
|
+
Deprecated: Use configure_monkai_trace() or configure_application_insights().
|
|
262
|
+
"""
|
|
263
|
+
return configure_application_insights(connection_string)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "atendentepro"
|
|
3
|
-
version = "0.5.
|
|
4
|
-
description = "
|
|
3
|
+
version = "0.5.9"
|
|
4
|
+
description = "Framework de orquestração de agentes IA para resolver interações complexas integrando múltiplas fontes de dados (documentos, APIs, bancos) em uma única plataforma inteligente."
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "BeMonkAI", email = "contato@monkai.com.br" }
|
|
7
7
|
]
|
|
@@ -22,6 +22,12 @@ keywords = [
|
|
|
22
22
|
"openai-agents",
|
|
23
23
|
"conversational-ai",
|
|
24
24
|
"rag",
|
|
25
|
+
"triage",
|
|
26
|
+
"handoff",
|
|
27
|
+
"escalation",
|
|
28
|
+
"feedback",
|
|
29
|
+
"knowledge-base",
|
|
30
|
+
"interview",
|
|
25
31
|
]
|
|
26
32
|
classifiers = [
|
|
27
33
|
"Development Status :: 4 - Beta",
|
|
@@ -66,11 +72,14 @@ rag = [
|
|
|
66
72
|
"PyMuPDF>=1.23.0",
|
|
67
73
|
]
|
|
68
74
|
tracing = [
|
|
75
|
+
"monkai-trace>=0.2.9",
|
|
76
|
+
]
|
|
77
|
+
azure = [
|
|
69
78
|
"opentelemetry-sdk>=1.20.0",
|
|
70
79
|
"azure-monitor-opentelemetry-exporter>=1.0.0",
|
|
71
80
|
]
|
|
72
81
|
all = [
|
|
73
|
-
"atendentepro[dev,docs,rag,tracing]",
|
|
82
|
+
"atendentepro[dev,docs,rag,tracing,azure]",
|
|
74
83
|
]
|
|
75
84
|
|
|
76
85
|
[project.urls]
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""Utility modules for AtendentePro library."""
|
|
3
|
-
|
|
4
|
-
from .openai_client import (
|
|
5
|
-
get_async_client,
|
|
6
|
-
get_provider,
|
|
7
|
-
AsyncClient,
|
|
8
|
-
Provider,
|
|
9
|
-
)
|
|
10
|
-
from .tracing import configure_tracing
|
|
11
|
-
|
|
12
|
-
__all__ = [
|
|
13
|
-
"get_async_client",
|
|
14
|
-
"get_provider",
|
|
15
|
-
"AsyncClient",
|
|
16
|
-
"Provider",
|
|
17
|
-
"configure_tracing",
|
|
18
|
-
]
|
|
19
|
-
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""
|
|
3
|
-
Tracing configuration for AtendentePro.
|
|
4
|
-
|
|
5
|
-
Provides optional Application Insights integration for telemetry.
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
from __future__ import annotations
|
|
9
|
-
|
|
10
|
-
import logging
|
|
11
|
-
from typing import Optional
|
|
12
|
-
|
|
13
|
-
from atendentepro.config import get_config
|
|
14
|
-
|
|
15
|
-
logger = logging.getLogger(__name__)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def configure_tracing(connection_string: Optional[str] = None) -> bool:
|
|
19
|
-
"""
|
|
20
|
-
Configure Application Insights tracing if connection string is available.
|
|
21
|
-
|
|
22
|
-
Args:
|
|
23
|
-
connection_string: Optional connection string. If not provided,
|
|
24
|
-
uses the value from configuration.
|
|
25
|
-
|
|
26
|
-
Returns:
|
|
27
|
-
True if tracing was configured, False otherwise.
|
|
28
|
-
"""
|
|
29
|
-
config = get_config()
|
|
30
|
-
conn_str = connection_string or config.application_insights_connection_string
|
|
31
|
-
|
|
32
|
-
if not conn_str:
|
|
33
|
-
logger.debug("No Application Insights connection string provided. Tracing disabled.")
|
|
34
|
-
return False
|
|
35
|
-
|
|
36
|
-
try:
|
|
37
|
-
# Try to configure Application Insights
|
|
38
|
-
from opentelemetry import trace
|
|
39
|
-
from opentelemetry.sdk.trace import TracerProvider
|
|
40
|
-
from opentelemetry.sdk.trace.export import BatchSpanProcessor
|
|
41
|
-
|
|
42
|
-
# Check if azure monitor is available
|
|
43
|
-
try:
|
|
44
|
-
from azure.monitor.opentelemetry.exporter import AzureMonitorTraceExporter
|
|
45
|
-
|
|
46
|
-
exporter = AzureMonitorTraceExporter(connection_string=conn_str)
|
|
47
|
-
provider = TracerProvider()
|
|
48
|
-
processor = BatchSpanProcessor(exporter)
|
|
49
|
-
provider.add_span_processor(processor)
|
|
50
|
-
trace.set_tracer_provider(provider)
|
|
51
|
-
|
|
52
|
-
logger.info("Application Insights tracing configured successfully.")
|
|
53
|
-
return True
|
|
54
|
-
|
|
55
|
-
except ImportError:
|
|
56
|
-
logger.warning(
|
|
57
|
-
"Azure Monitor exporter not available. "
|
|
58
|
-
"Install 'azure-monitor-opentelemetry-exporter' for Application Insights support."
|
|
59
|
-
)
|
|
60
|
-
return False
|
|
61
|
-
|
|
62
|
-
except ImportError:
|
|
63
|
-
logger.warning(
|
|
64
|
-
"OpenTelemetry not available. "
|
|
65
|
-
"Install 'opentelemetry-sdk' for tracing support."
|
|
66
|
-
)
|
|
67
|
-
return False
|
|
68
|
-
except Exception as e:
|
|
69
|
-
logger.error(f"Failed to configure tracing: {e}")
|
|
70
|
-
return False
|
|
71
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|