agentium 1.0.0__py3-none-any.whl
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.
- agentium/__init__.py +297 -0
- agentium/core/__init__.py +1 -0
- agentium/core/communicator.py +575 -0
- agentium/core/condenser.py +330 -0
- agentium/core/extractor.py +737 -0
- agentium/core/insight_generator.py +522 -0
- agentium/core/memory_helper.py +647 -0
- agentium/core/optimizer.py +502 -0
- agentium/core/rearranger.py +599 -0
- agentium/core/summarize_custom.py +689 -0
- agentium/core/template_manager.py +516 -0
- agentium/core/translator.py +524 -0
- agentium/core/workflow_helper.py +530 -0
- agentium/integrations/__init__.py +467 -0
- agentium/integrations/crewai.py +630 -0
- agentium/integrations/langchain.py +468 -0
- agentium/integrations/langgraph.py +601 -0
- agentium/utils/__init__.py +1 -0
- agentium/utils/logger_utils.py +392 -0
- agentium-1.0.0.dist-info/METADATA +172 -0
- agentium-1.0.0.dist-info/RECORD +23 -0
- agentium-1.0.0.dist-info/WHEEL +5 -0
- agentium-1.0.0.dist-info/top_level.txt +1 -0
agentium/__init__.py
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Agentium - Comprehensive Python Library for AI Agent Development
|
|
3
|
+
|
|
4
|
+
A production-ready library providing essential tools and utilities for
|
|
5
|
+
building intelligent AI agents, compatible with LangChain, LangGraph, and CrewAI.
|
|
6
|
+
|
|
7
|
+
Core Features:
|
|
8
|
+
- Content condensation and optimization
|
|
9
|
+
- Data extraction and processing
|
|
10
|
+
- Multi-channel communication
|
|
11
|
+
- Translation and localization
|
|
12
|
+
- Insight generation and analysis
|
|
13
|
+
- Workflow orchestration
|
|
14
|
+
- Template management
|
|
15
|
+
- Memory and context storage
|
|
16
|
+
- Custom summarization
|
|
17
|
+
- Advanced logging and monitoring
|
|
18
|
+
|
|
19
|
+
Framework Integrations:
|
|
20
|
+
- LangChain: Tools, memory, parsers, callbacks
|
|
21
|
+
- LangGraph: Workflow nodes, state management
|
|
22
|
+
- CrewAI: Enhanced agents, tasks, crews
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
__version__ = "1.0.0"
|
|
26
|
+
__author__ = "Agentium Development Team"
|
|
27
|
+
__license__ = "MIT"
|
|
28
|
+
|
|
29
|
+
# Core components
|
|
30
|
+
from .core.condenser import Condenser, CondenserConfig
|
|
31
|
+
from .core.optimizer import Optimizer, OptimizerConfig
|
|
32
|
+
from .core.rearranger import Rearranger, RearrangerConfig
|
|
33
|
+
from .core.extractor import Extractor, ExtractorConfig
|
|
34
|
+
from .core.communicator import Communicator, CommunicatorConfig
|
|
35
|
+
from .core.translator import Translator, TranslatorConfig
|
|
36
|
+
from .core.insight_generator import InsightGenerator, InsightConfig
|
|
37
|
+
from .core.workflow_helper import WorkflowHelper, WorkflowConfig
|
|
38
|
+
from .core.template_manager import TemplateManager, TemplateConfig
|
|
39
|
+
from .core.memory_helper import MemoryHelper, MemoryConfig
|
|
40
|
+
from .core.summarize_custom import CustomSummarizer, SummaryConfig
|
|
41
|
+
|
|
42
|
+
# Utilities
|
|
43
|
+
from .utils.logger_utils import LoggerUtils, LoggerConfig
|
|
44
|
+
|
|
45
|
+
# Integrations (with optional imports)
|
|
46
|
+
try:
|
|
47
|
+
from .integrations.langchain import (
|
|
48
|
+
get_agentium_langchain_integration,
|
|
49
|
+
AgentiumLangChainIntegration,
|
|
50
|
+
AgentiumMemory,
|
|
51
|
+
AgentiumOutputParser,
|
|
52
|
+
AgentiumCallbackHandler
|
|
53
|
+
)
|
|
54
|
+
LANGCHAIN_INTEGRATION_AVAILABLE = True
|
|
55
|
+
except Exception:
|
|
56
|
+
LANGCHAIN_INTEGRATION_AVAILABLE = False
|
|
57
|
+
|
|
58
|
+
try:
|
|
59
|
+
from .integrations.langgraph import (
|
|
60
|
+
get_agentium_langgraph_integration,
|
|
61
|
+
AgentiumLangGraphIntegration,
|
|
62
|
+
AgentiumLangGraphBuilder,
|
|
63
|
+
AgentiumLangGraphWorkflow
|
|
64
|
+
)
|
|
65
|
+
LANGGRAPH_INTEGRATION_AVAILABLE = True
|
|
66
|
+
except Exception:
|
|
67
|
+
LANGGRAPH_INTEGRATION_AVAILABLE = False
|
|
68
|
+
|
|
69
|
+
try:
|
|
70
|
+
from .integrations.crewai import (
|
|
71
|
+
get_agentium_crewai_integration,
|
|
72
|
+
AgentiumCrewAIIntegration,
|
|
73
|
+
AgentiumCrewAIAgent,
|
|
74
|
+
AgentiumCrewAITask,
|
|
75
|
+
AgentiumCrewAICrew
|
|
76
|
+
)
|
|
77
|
+
CREWAI_INTEGRATION_AVAILABLE = True
|
|
78
|
+
except Exception:
|
|
79
|
+
CREWAI_INTEGRATION_AVAILABLE = False
|
|
80
|
+
|
|
81
|
+
# Main exports
|
|
82
|
+
__all__ = [
|
|
83
|
+
# Version and metadata
|
|
84
|
+
'__version__',
|
|
85
|
+
'__author__',
|
|
86
|
+
'__license__',
|
|
87
|
+
|
|
88
|
+
# Core components
|
|
89
|
+
'Condenser',
|
|
90
|
+
'CondenserConfig',
|
|
91
|
+
'Optimizer',
|
|
92
|
+
'OptimizerConfig',
|
|
93
|
+
'Rearranger',
|
|
94
|
+
'RearrangerConfig',
|
|
95
|
+
'Extractor',
|
|
96
|
+
'ExtractorConfig',
|
|
97
|
+
'Communicator',
|
|
98
|
+
'CommunicatorConfig',
|
|
99
|
+
'Translator',
|
|
100
|
+
'TranslatorConfig',
|
|
101
|
+
'InsightGenerator',
|
|
102
|
+
'InsightConfig',
|
|
103
|
+
'WorkflowHelper',
|
|
104
|
+
'WorkflowConfig',
|
|
105
|
+
'TemplateManager',
|
|
106
|
+
'TemplateConfig',
|
|
107
|
+
'MemoryHelper',
|
|
108
|
+
'MemoryConfig',
|
|
109
|
+
'CustomSummarizer',
|
|
110
|
+
'SummaryConfig',
|
|
111
|
+
|
|
112
|
+
# Utilities
|
|
113
|
+
'LoggerUtils',
|
|
114
|
+
'LoggerConfig',
|
|
115
|
+
|
|
116
|
+
# Integration flags
|
|
117
|
+
'LANGCHAIN_INTEGRATION_AVAILABLE',
|
|
118
|
+
'LANGGRAPH_INTEGRATION_AVAILABLE',
|
|
119
|
+
'CREWAI_INTEGRATION_AVAILABLE',
|
|
120
|
+
]
|
|
121
|
+
|
|
122
|
+
# Add integration exports if available
|
|
123
|
+
if LANGCHAIN_INTEGRATION_AVAILABLE:
|
|
124
|
+
__all__.extend([
|
|
125
|
+
'get_agentium_langchain_integration',
|
|
126
|
+
'AgentiumLangChainIntegration',
|
|
127
|
+
'AgentiumMemory',
|
|
128
|
+
'AgentiumOutputParser',
|
|
129
|
+
'AgentiumCallbackHandler'
|
|
130
|
+
])
|
|
131
|
+
|
|
132
|
+
if LANGGRAPH_INTEGRATION_AVAILABLE:
|
|
133
|
+
__all__.extend([
|
|
134
|
+
'get_agentium_langgraph_integration',
|
|
135
|
+
'AgentiumLangGraphIntegration',
|
|
136
|
+
'AgentiumLangGraphBuilder',
|
|
137
|
+
'AgentiumLangGraphWorkflow'
|
|
138
|
+
])
|
|
139
|
+
|
|
140
|
+
if CREWAI_INTEGRATION_AVAILABLE:
|
|
141
|
+
__all__.extend([
|
|
142
|
+
'get_agentium_crewai_integration',
|
|
143
|
+
'AgentiumCrewAIIntegration',
|
|
144
|
+
'AgentiumCrewAIAgent',
|
|
145
|
+
'AgentiumCrewAITask',
|
|
146
|
+
'AgentiumCrewAICrew'
|
|
147
|
+
])
|
|
148
|
+
|
|
149
|
+
from typing import Optional, Dict, Any
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
class Agentium:
|
|
153
|
+
"""
|
|
154
|
+
Main Agentium class providing unified access to all components.
|
|
155
|
+
|
|
156
|
+
This class serves as a convenient entry point for accessing all
|
|
157
|
+
Agentium functionality in a single interface.
|
|
158
|
+
"""
|
|
159
|
+
|
|
160
|
+
def __init__(self, logger_config: Optional[LoggerConfig] = None):
|
|
161
|
+
"""Initialize Agentium with optional logging configuration"""
|
|
162
|
+
self.logger = LoggerUtils.get_logger(__name__)
|
|
163
|
+
|
|
164
|
+
if logger_config:
|
|
165
|
+
LoggerUtils.configure(logger_config)
|
|
166
|
+
|
|
167
|
+
# Initialize core components
|
|
168
|
+
self.condenser = Condenser()
|
|
169
|
+
self.optimizer = Optimizer()
|
|
170
|
+
self.rearranger = Rearranger()
|
|
171
|
+
self.extractor = Extractor()
|
|
172
|
+
self.communicator = Communicator()
|
|
173
|
+
self.translator = Translator()
|
|
174
|
+
self.insight_generator = InsightGenerator()
|
|
175
|
+
self.workflow_helper = WorkflowHelper()
|
|
176
|
+
self.template_manager = TemplateManager()
|
|
177
|
+
self.memory_helper = MemoryHelper()
|
|
178
|
+
self.summarizer = CustomSummarizer()
|
|
179
|
+
|
|
180
|
+
# Initialize integrations
|
|
181
|
+
self._init_integrations()
|
|
182
|
+
|
|
183
|
+
self.logger.info("Agentium initialized with all core components")
|
|
184
|
+
|
|
185
|
+
def _init_integrations(self):
|
|
186
|
+
"""Initialize framework integrations"""
|
|
187
|
+
self.langchain_integration = None
|
|
188
|
+
self.langgraph_integration = None
|
|
189
|
+
self.crewai_integration = None
|
|
190
|
+
|
|
191
|
+
if LANGCHAIN_INTEGRATION_AVAILABLE:
|
|
192
|
+
try:
|
|
193
|
+
self.langchain_integration = get_agentium_langchain_integration()
|
|
194
|
+
self.logger.info("LangChain integration initialized")
|
|
195
|
+
except Exception as e:
|
|
196
|
+
self.logger.warning(f"Failed to initialize LangChain integration: {e}")
|
|
197
|
+
|
|
198
|
+
if LANGGRAPH_INTEGRATION_AVAILABLE:
|
|
199
|
+
try:
|
|
200
|
+
self.langgraph_integration = get_agentium_langgraph_integration()
|
|
201
|
+
self.logger.info("LangGraph integration initialized")
|
|
202
|
+
except Exception as e:
|
|
203
|
+
self.logger.warning(f"Failed to initialize LangGraph integration: {e}")
|
|
204
|
+
|
|
205
|
+
if CREWAI_INTEGRATION_AVAILABLE:
|
|
206
|
+
try:
|
|
207
|
+
self.crewai_integration = get_agentium_crewai_integration()
|
|
208
|
+
self.logger.info("CrewAI integration initialized")
|
|
209
|
+
except Exception as e:
|
|
210
|
+
self.logger.warning(f"Failed to initialize CrewAI integration: {e}")
|
|
211
|
+
|
|
212
|
+
def get_integration_status(self) -> Dict[str, bool]:
|
|
213
|
+
"""Get the status of all integrations"""
|
|
214
|
+
return {
|
|
215
|
+
'langchain': LANGCHAIN_INTEGRATION_AVAILABLE and self.langchain_integration is not None,
|
|
216
|
+
'langgraph': LANGGRAPH_INTEGRATION_AVAILABLE and self.langgraph_integration is not None,
|
|
217
|
+
'crewai': CREWAI_INTEGRATION_AVAILABLE and self.crewai_integration is not None,
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
def process_content(self, content: str, workflow: str = "basic") -> Dict[str, Any]:
|
|
221
|
+
"""
|
|
222
|
+
Process content through a predefined workflow
|
|
223
|
+
|
|
224
|
+
Available workflows:
|
|
225
|
+
- basic: condense -> optimize -> summarize
|
|
226
|
+
- analysis: extract -> insights -> summarize
|
|
227
|
+
- translation: translate -> optimize -> summarize
|
|
228
|
+
"""
|
|
229
|
+
|
|
230
|
+
results = {'workflow': workflow, 'steps': []}
|
|
231
|
+
|
|
232
|
+
try:
|
|
233
|
+
if workflow == "basic":
|
|
234
|
+
# Condense -> Optimize -> Summarize
|
|
235
|
+
condensed_result = self.condenser.condense(content)
|
|
236
|
+
condensed_text = condensed_result.get('text') if isinstance(condensed_result, dict) else condensed_result
|
|
237
|
+
results['steps'].append({'step': 'condense', 'result': condensed_result})
|
|
238
|
+
|
|
239
|
+
optimized_result = self.optimizer.optimize(condensed_text)
|
|
240
|
+
optimized_text = optimized_result.get('text') if isinstance(optimized_result, dict) else optimized_result
|
|
241
|
+
results['steps'].append({'step': 'optimize', 'result': optimized_result})
|
|
242
|
+
|
|
243
|
+
summarized_result = self.summarizer.summarize(optimized_text)
|
|
244
|
+
summarized = summarized_result if isinstance(summarized_result, dict) else {'summary': summarized_result}
|
|
245
|
+
results['steps'].append({'step': 'summarize', 'result': summarized})
|
|
246
|
+
|
|
247
|
+
results['final_output'] = summarized.get('summary', str(summarized))
|
|
248
|
+
|
|
249
|
+
elif workflow == "analysis":
|
|
250
|
+
# Extract -> Insights -> Summarize
|
|
251
|
+
extracted_result = self.extractor.extract(content)
|
|
252
|
+
extracted = extracted_result if isinstance(extracted_result, dict) else {'extracted_data': extracted_result}
|
|
253
|
+
results['steps'].append({'step': 'extract', 'result': extracted})
|
|
254
|
+
|
|
255
|
+
insights_result = self.insight_generator.generate_insights(str(extracted['extracted_data']))
|
|
256
|
+
insights = insights_result if isinstance(insights_result, dict) else {'insights': insights_result}
|
|
257
|
+
results['steps'].append({'step': 'insights', 'result': insights})
|
|
258
|
+
|
|
259
|
+
data_str = str(extracted['extracted_data'])
|
|
260
|
+
insights_str = str(insights.get('insights', insights))
|
|
261
|
+
summarized_result = self.summarizer.summarize(f"Data: {data_str} Insights: {insights_str}")
|
|
262
|
+
summarized = summarized_result if isinstance(summarized_result, dict) else {'summary': summarized_result}
|
|
263
|
+
results['steps'].append({'step': 'summarize', 'result': summarized})
|
|
264
|
+
|
|
265
|
+
results['final_output'] = summarized.get('summary', str(summarized))
|
|
266
|
+
|
|
267
|
+
elif workflow == "translation":
|
|
268
|
+
# Translate -> Optimize -> Summarize
|
|
269
|
+
translated_result = self.translator.translate(content)
|
|
270
|
+
translated = translated_result if isinstance(translated_result, dict) else {'translated_text': translated_result}
|
|
271
|
+
results['steps'].append({'step': 'translate', 'result': translated})
|
|
272
|
+
|
|
273
|
+
optimized_result = self.optimizer.optimize(translated['translated_text'])
|
|
274
|
+
optimized = optimized_result if isinstance(optimized_result, dict) else {'optimized_content': optimized_result}
|
|
275
|
+
results['steps'].append({'step': 'optimize', 'result': optimized})
|
|
276
|
+
|
|
277
|
+
summarized_result = self.summarizer.summarize(optimized['optimized_content'])
|
|
278
|
+
summarized = summarized_result if isinstance(summarized_result, dict) else {'summary': summarized_result}
|
|
279
|
+
results['steps'].append({'step': 'summarize', 'result': summarized})
|
|
280
|
+
|
|
281
|
+
results['final_output'] = summarized.get('summary', str(summarized))
|
|
282
|
+
|
|
283
|
+
else:
|
|
284
|
+
raise ValueError(f"Unknown workflow: {workflow}")
|
|
285
|
+
|
|
286
|
+
results['success'] = True
|
|
287
|
+
|
|
288
|
+
except Exception as e:
|
|
289
|
+
results['success'] = False
|
|
290
|
+
results['error'] = str(e)
|
|
291
|
+
self.logger.error(f"Workflow {workflow} failed: {e}")
|
|
292
|
+
|
|
293
|
+
return results
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
# Add to main exports
|
|
297
|
+
__all__.extend(['Agentium'])
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Core package initialization
|