pygeai-orchestration 0.1.0b6__tar.gz → 0.1.0b7__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.
- pygeai_orchestration-0.1.0b7/CHANGELOG.md +75 -0
- {pygeai_orchestration-0.1.0b6/pygeai_orchestration.egg-info → pygeai_orchestration-0.1.0b7}/PKG-INFO +153 -42
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/README.md +152 -41
- pygeai_orchestration-0.1.0b7/docs/source/patterns.rst +571 -0
- pygeai_orchestration-0.1.0b7/docs/source/quickstart.rst +343 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7/pygeai_orchestration.egg-info}/PKG-INFO +153 -42
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration.egg-info/SOURCES.txt +0 -2
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pyproject.toml +1 -1
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/snippets/tool_use_calculator.py +5 -2
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/snippets/tool_use_data_processing.py +11 -4
- pygeai_orchestration-0.1.0b6/CHANGELOG.md +0 -29
- pygeai_orchestration-0.1.0b6/docs/patterns_guide.md +0 -313
- pygeai_orchestration-0.1.0b6/docs/quickstart.md +0 -139
- pygeai_orchestration-0.1.0b6/docs/source/patterns.rst +0 -380
- pygeai_orchestration-0.1.0b6/docs/source/quickstart.rst +0 -251
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/BUILD.md +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/CONTRIBUTING.md +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/LICENSE +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/MANIFEST.in +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/docs/source/api/core.rst +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/docs/source/api/exceptions.rst +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/docs/source/api/patterns.rst +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/docs/source/changelog.rst +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/docs/source/contributing.rst +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/docs/source/examples.rst +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/docs/source/index.rst +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/__init__.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/cli/__init__.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/cli/__main__.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/cli/commands/__init__.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/cli/commands/base.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/cli/error_handler.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/cli/formatters.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/cli/geai_orch.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/cli/interactive.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/cli/texts/help.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/core/__init__.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/core/base/__init__.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/core/base/agent.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/core/base/geai_agent.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/core/base/geai_orchestrator.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/core/base/orchestrator.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/core/base/pattern.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/core/base/tool.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/core/common/__init__.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/core/common/context.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/core/common/memory.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/core/common/message.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/core/common/state.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/core/composition.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/core/config.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/core/exceptions.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/core/handlers.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/core/utils/__init__.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/core/utils/cache.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/core/utils/config.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/core/utils/metrics.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/core/utils/validators.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/dev/__init__.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/dev/debug.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/dev/templates.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/dev/testing.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/patterns/__init__.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/patterns/multi_agent.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/patterns/planning.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/patterns/react.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/patterns/reflection.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/patterns/tool_use.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/tests/__init__.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/tests/test_base_classes.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/tests/test_cache.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/tests/test_cli_formatters.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/tests/test_common.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/tests/test_composition.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/tests/test_config.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/tests/test_dev_utils.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/tests/test_exceptions.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/tests/test_handlers.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/tests/test_metrics.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration/tests/test_patterns.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration.egg-info/dependency_links.txt +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration.egg-info/entry_points.txt +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration.egg-info/requires.txt +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/pygeai_orchestration.egg-info/top_level.txt +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/requirements.txt +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/setup.cfg +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/snippets/multi_agent_collaboration.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/snippets/planning_analysis.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/snippets/planning_project.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/snippets/react_problem_solving.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/snippets/react_research.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/snippets/reflection_code_review.py +0 -0
- {pygeai_orchestration-0.1.0b6 → pygeai_orchestration-0.1.0b7}/snippets/reflection_explanation.py +0 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to PyGEAI-Orchestration will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Initial project structure and configuration
|
|
12
|
+
- Core base classes for agents, orchestrators, and patterns
|
|
13
|
+
- CLI framework with `geai-orch` command
|
|
14
|
+
- Reflection pattern for iterative improvement
|
|
15
|
+
- Tool Use pattern for function calling
|
|
16
|
+
- ReAct pattern for reasoning and acting
|
|
17
|
+
- Planning pattern for multi-step execution
|
|
18
|
+
- Multi-Agent pattern for collaborative workflows
|
|
19
|
+
- Comprehensive test suite with unit and integration tests
|
|
20
|
+
- Documentation and examples for all patterns
|
|
21
|
+
- GitHub Actions CI/CD workflows
|
|
22
|
+
- 9 working code snippets demonstrating all patterns:
|
|
23
|
+
- `reflection_explanation.py` - Iterative explanation improvement
|
|
24
|
+
- `reflection_code_review.py` - Code review with self-critique
|
|
25
|
+
- `react_research.py` - Structured research tasks
|
|
26
|
+
- `react_problem_solving.py` - Step-by-step problem solving
|
|
27
|
+
- `planning_project.py` - Project planning and breakdown
|
|
28
|
+
- `planning_analysis.py` - Data analysis planning
|
|
29
|
+
- `tool_use_calculator.py` - Mathematical operations with tools
|
|
30
|
+
- `tool_use_data_processing.py` - Data validation and transformation
|
|
31
|
+
- `multi_agent_collaboration.py` - Collaborative multi-agent workflow
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
- **BREAKING**: Refactored entire import system to use absolute imports only
|
|
35
|
+
- All imports now use full module paths: `from pygeai_orchestration.core.base import ...`
|
|
36
|
+
- Removed all relative imports (`.module` style)
|
|
37
|
+
- **BREAKING**: Removed `get_logger()` and `OrchestrationLogger` from public API
|
|
38
|
+
- All modules now use standard `logging.getLogger("pygeai_orchestration")`
|
|
39
|
+
- Logging disabled by default with `NullHandler` (follows PyGEAI pattern)
|
|
40
|
+
- Users can enable logging by configuring the `"pygeai_orchestration"` logger
|
|
41
|
+
- **BREAKING**: Renamed all snippet files from `*_snippet.py` to `<pattern>_<topic>.py` format
|
|
42
|
+
- More descriptive naming that indicates pattern and use case
|
|
43
|
+
- Example: `reflection_snippet.py` → `reflection_explanation.py`
|
|
44
|
+
- Updated `GEAIAgent` to use actual PyGEAI Session and ChatManager APIs
|
|
45
|
+
- Proper integration with PyGEAI chat completion
|
|
46
|
+
- Correct credential loading from `~/.geai/credentials`
|
|
47
|
+
- Support for provider-prefixed model names (e.g., `openai/gpt-4o-mini`)
|
|
48
|
+
- Tool system improvements:
|
|
49
|
+
- `BaseTool` subclasses must implement `validate_parameters()` method
|
|
50
|
+
- `ToolConfig` uses `parameters_schema` field (not `parameters`)
|
|
51
|
+
- Clear ToolCategory enum values: SEARCH, COMPUTATION, DATA_ACCESS, COMMUNICATION, CUSTOM
|
|
52
|
+
- All pattern implementations updated to use absolute imports and standard logging
|
|
53
|
+
|
|
54
|
+
### Fixed
|
|
55
|
+
- PyGEAI integration now uses correct Session and ChatManager APIs
|
|
56
|
+
- Removed incorrect assumptions about `Session.agents` and `Session.chats` attributes
|
|
57
|
+
- Fixed message formatting to use proper PyGEAI `ChatMessageList` and `ChatMessage` models
|
|
58
|
+
- Fixed credential loading to delegate to PyGEAI's configuration system
|
|
59
|
+
- Corrected model naming to include provider prefix as required by PyGEAI
|
|
60
|
+
|
|
61
|
+
### Removed
|
|
62
|
+
- **BREAKING**: Removed PyGEAI availability checks
|
|
63
|
+
- PyGEAI is now a required dependency
|
|
64
|
+
- No fallback or mock implementations
|
|
65
|
+
- Removed `get_logger()` utility function from `pygeai_orchestration.core.utils`
|
|
66
|
+
- Removed `OrchestrationLogger` singleton class
|
|
67
|
+
- Removed all relative import statements across the codebase
|
|
68
|
+
|
|
69
|
+
## [0.1.0b1] - 2026-02-05
|
|
70
|
+
|
|
71
|
+
### Added
|
|
72
|
+
- Initial beta release of PyGEAI-Orchestration
|
|
73
|
+
- Foundation for agentic AI orchestration patterns
|
|
74
|
+
- Integration with PyGEAI SDK
|
|
75
|
+
- Basic project structure and tooling
|
{pygeai_orchestration-0.1.0b6/pygeai_orchestration.egg-info → pygeai_orchestration-0.1.0b7}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pygeai-orchestration
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.0b7
|
|
4
4
|
Summary: Agentic AI orchestration patterns built on Globant Enterprise AI
|
|
5
5
|
Author-email: Globant <geai-sdk@globant.com>
|
|
6
6
|
Keywords: geai,pygeai,orchestration,agents,ai,multi-agent,autogen,crewai
|
|
@@ -88,27 +88,37 @@ import asyncio
|
|
|
88
88
|
from pygeai_orchestration import (
|
|
89
89
|
GEAIAgent,
|
|
90
90
|
AgentConfig,
|
|
91
|
+
PatternConfig,
|
|
92
|
+
PatternType,
|
|
91
93
|
ReflectionPattern
|
|
92
94
|
)
|
|
93
95
|
|
|
94
96
|
async def main():
|
|
95
|
-
# Create
|
|
96
|
-
|
|
97
|
+
# Create agent configuration
|
|
98
|
+
agent_config = AgentConfig(
|
|
97
99
|
name="my-agent",
|
|
98
|
-
model="gpt-
|
|
100
|
+
model="openai/gpt-4o-mini",
|
|
99
101
|
temperature=0.7
|
|
100
102
|
)
|
|
101
|
-
agent = GEAIAgent(config)
|
|
103
|
+
agent = GEAIAgent(config=agent_config)
|
|
104
|
+
|
|
105
|
+
# Create pattern configuration
|
|
106
|
+
pattern_config = PatternConfig(
|
|
107
|
+
name="reflection-example",
|
|
108
|
+
pattern_type=PatternType.REFLECTION,
|
|
109
|
+
max_iterations=3
|
|
110
|
+
)
|
|
102
111
|
|
|
103
112
|
# Create and execute pattern
|
|
104
|
-
pattern = ReflectionPattern(agent=agent)
|
|
105
|
-
result = await pattern.execute("
|
|
113
|
+
pattern = ReflectionPattern(agent=agent, config=pattern_config)
|
|
114
|
+
result = await pattern.execute("Explain quantum computing in simple terms")
|
|
106
115
|
|
|
107
116
|
print(f"Success: {result.success}")
|
|
108
|
-
print(f"Result: {result.result}")
|
|
109
117
|
print(f"Iterations: {result.iterations}")
|
|
118
|
+
print(f"Result: {result.result[:200]}...") # First 200 chars
|
|
110
119
|
|
|
111
|
-
|
|
120
|
+
if __name__ == "__main__":
|
|
121
|
+
asyncio.run(main())
|
|
112
122
|
```
|
|
113
123
|
|
|
114
124
|
## Configuration
|
|
@@ -137,10 +147,24 @@ See [PyGEAI Configuration](https://docs.globant.ai/en/wiki?1149,Getting+started+
|
|
|
137
147
|
Enables agents to self-critique and iteratively improve their outputs.
|
|
138
148
|
|
|
139
149
|
```python
|
|
140
|
-
from pygeai_orchestration
|
|
150
|
+
from pygeai_orchestration import GEAIAgent, AgentConfig, PatternConfig, PatternType, ReflectionPattern
|
|
151
|
+
|
|
152
|
+
agent = GEAIAgent(config=AgentConfig(
|
|
153
|
+
name="reflector",
|
|
154
|
+
model="openai/gpt-4o-mini",
|
|
155
|
+
temperature=0.7
|
|
156
|
+
))
|
|
157
|
+
|
|
158
|
+
pattern = ReflectionPattern(
|
|
159
|
+
agent=agent,
|
|
160
|
+
config=PatternConfig(
|
|
161
|
+
name="reflection",
|
|
162
|
+
pattern_type=PatternType.REFLECTION,
|
|
163
|
+
max_iterations=3
|
|
164
|
+
)
|
|
165
|
+
)
|
|
141
166
|
|
|
142
|
-
|
|
143
|
-
result = agent.reflect_and_improve("Initial output", iterations=3)
|
|
167
|
+
result = await pattern.execute("Explain quantum computing in simple terms")
|
|
144
168
|
```
|
|
145
169
|
|
|
146
170
|
**Use Cases:**
|
|
@@ -148,30 +172,28 @@ result = agent.reflect_and_improve("Initial output", iterations=3)
|
|
|
148
172
|
- Code review and refinement
|
|
149
173
|
- Self-correcting responses
|
|
150
174
|
|
|
151
|
-
### 2.
|
|
152
|
-
Integrates function calling and tool execution into agent workflows.
|
|
153
|
-
|
|
154
|
-
```python
|
|
155
|
-
from pygeai_orchestration.patterns.tool_use import ToolUseAgent
|
|
156
|
-
|
|
157
|
-
agent = ToolUseAgent(session=session)
|
|
158
|
-
agent.register_tool("search", search_function)
|
|
159
|
-
result = agent.execute("Search for information about AI")
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
**Use Cases:**
|
|
163
|
-
- API integration
|
|
164
|
-
- External data retrieval
|
|
165
|
-
- Action execution
|
|
166
|
-
|
|
167
|
-
### 3. ReAct Pattern
|
|
175
|
+
### 2. ReAct Pattern
|
|
168
176
|
Implements the Reasoning + Acting loop for step-by-step problem solving.
|
|
169
177
|
|
|
170
178
|
```python
|
|
171
|
-
from pygeai_orchestration
|
|
179
|
+
from pygeai_orchestration import GEAIAgent, AgentConfig, PatternConfig, PatternType, ReActPattern
|
|
180
|
+
|
|
181
|
+
agent = GEAIAgent(config=AgentConfig(
|
|
182
|
+
name="reasoner",
|
|
183
|
+
model="openai/gpt-4o-mini",
|
|
184
|
+
temperature=0.7
|
|
185
|
+
))
|
|
186
|
+
|
|
187
|
+
pattern = ReActPattern(
|
|
188
|
+
agent=agent,
|
|
189
|
+
config=PatternConfig(
|
|
190
|
+
name="react",
|
|
191
|
+
pattern_type=PatternType.REACT,
|
|
192
|
+
max_iterations=5
|
|
193
|
+
)
|
|
194
|
+
)
|
|
172
195
|
|
|
173
|
-
|
|
174
|
-
result = agent.solve("Complex multi-step problem")
|
|
196
|
+
result = await pattern.execute("Research and summarize renewable energy benefits")
|
|
175
197
|
```
|
|
176
198
|
|
|
177
199
|
**Use Cases:**
|
|
@@ -179,15 +201,28 @@ result = agent.solve("Complex multi-step problem")
|
|
|
179
201
|
- Research tasks
|
|
180
202
|
- Multi-step workflows
|
|
181
203
|
|
|
182
|
-
###
|
|
204
|
+
### 3. Planning Pattern
|
|
183
205
|
Creates and executes multi-step plans with adaptive execution.
|
|
184
206
|
|
|
185
207
|
```python
|
|
186
|
-
from pygeai_orchestration
|
|
208
|
+
from pygeai_orchestration import GEAIAgent, AgentConfig, PatternConfig, PatternType, PlanningPattern
|
|
209
|
+
|
|
210
|
+
agent = GEAIAgent(config=AgentConfig(
|
|
211
|
+
name="planner",
|
|
212
|
+
model="openai/gpt-4o-mini",
|
|
213
|
+
temperature=0.5
|
|
214
|
+
))
|
|
215
|
+
|
|
216
|
+
pattern = PlanningPattern(
|
|
217
|
+
agent=agent,
|
|
218
|
+
config=PatternConfig(
|
|
219
|
+
name="planning",
|
|
220
|
+
pattern_type=PatternType.PLANNING,
|
|
221
|
+
max_iterations=1
|
|
222
|
+
)
|
|
223
|
+
)
|
|
187
224
|
|
|
188
|
-
|
|
189
|
-
plan = agent.create_plan("Build a web application")
|
|
190
|
-
result = agent.execute_plan(plan)
|
|
225
|
+
result = await pattern.execute("Create a project plan for building a REST API")
|
|
191
226
|
```
|
|
192
227
|
|
|
193
228
|
**Use Cases:**
|
|
@@ -195,16 +230,92 @@ result = agent.execute_plan(plan)
|
|
|
195
230
|
- Task decomposition
|
|
196
231
|
- Workflow automation
|
|
197
232
|
|
|
233
|
+
### 4. Tool Use Pattern
|
|
234
|
+
Integrates function calling and tool execution into agent workflows.
|
|
235
|
+
|
|
236
|
+
```python
|
|
237
|
+
from pygeai_orchestration import (
|
|
238
|
+
GEAIAgent, AgentConfig, PatternConfig, PatternType,
|
|
239
|
+
ToolUsePattern, BaseTool, ToolConfig, ToolResult, ToolCategory
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
class CalculatorTool(BaseTool):
|
|
243
|
+
def __init__(self):
|
|
244
|
+
super().__init__(ToolConfig(
|
|
245
|
+
name="calculator",
|
|
246
|
+
description="Performs calculations",
|
|
247
|
+
category=ToolCategory.COMPUTATION,
|
|
248
|
+
parameters_schema={"operation": "string", "values": "list"}
|
|
249
|
+
))
|
|
250
|
+
|
|
251
|
+
def validate_parameters(self, parameters):
|
|
252
|
+
return "operation" in parameters and "values" in parameters
|
|
253
|
+
|
|
254
|
+
async def execute(self, operation, values, **kwargs):
|
|
255
|
+
if operation == "average":
|
|
256
|
+
result = sum(values) / len(values)
|
|
257
|
+
return ToolResult(success=True, result=result)
|
|
258
|
+
return ToolResult(success=False, error="Unknown operation")
|
|
259
|
+
|
|
260
|
+
agent = GEAIAgent(config=AgentConfig(name="calculator", model="openai/gpt-4o-mini"))
|
|
261
|
+
pattern = ToolUsePattern(
|
|
262
|
+
agent=agent,
|
|
263
|
+
config=PatternConfig(name="tools", pattern_type=PatternType.TOOL_USE),
|
|
264
|
+
tools=[CalculatorTool()]
|
|
265
|
+
)
|
|
266
|
+
|
|
267
|
+
result = await pattern.execute("Calculate average of: 10, 20, 30")
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
**Use Cases:**
|
|
271
|
+
- API integration
|
|
272
|
+
- External data retrieval
|
|
273
|
+
- Action execution
|
|
274
|
+
|
|
198
275
|
### 5. Multi-Agent Pattern
|
|
199
276
|
Coordinates multiple agents working collaboratively on complex tasks.
|
|
200
277
|
|
|
201
278
|
```python
|
|
202
|
-
from pygeai_orchestration
|
|
279
|
+
from pygeai_orchestration import (
|
|
280
|
+
GEAIAgent, AgentConfig, PatternConfig, PatternType, MultiAgentPattern, AgentRole
|
|
281
|
+
)
|
|
282
|
+
|
|
283
|
+
# Create specialized agents
|
|
284
|
+
researcher = GEAIAgent(config=AgentConfig(
|
|
285
|
+
name="researcher",
|
|
286
|
+
model="openai/gpt-4o-mini",
|
|
287
|
+
system_prompt="You are a research specialist."
|
|
288
|
+
))
|
|
289
|
+
|
|
290
|
+
writer = GEAIAgent(config=AgentConfig(
|
|
291
|
+
name="writer",
|
|
292
|
+
model="openai/gpt-4o-mini",
|
|
293
|
+
system_prompt="You are a technical writer."
|
|
294
|
+
))
|
|
295
|
+
|
|
296
|
+
coordinator = GEAIAgent(config=AgentConfig(
|
|
297
|
+
name="coordinator",
|
|
298
|
+
model="openai/gpt-4o-mini",
|
|
299
|
+
system_prompt="You coordinate tasks and synthesize results."
|
|
300
|
+
))
|
|
301
|
+
|
|
302
|
+
# Create agent roles
|
|
303
|
+
agent_roles = [
|
|
304
|
+
AgentRole(name="researcher", agent=researcher, role_description="Researches topics"),
|
|
305
|
+
AgentRole(name="writer", agent=writer, role_description="Writes reports")
|
|
306
|
+
]
|
|
307
|
+
|
|
308
|
+
# Create multi-agent pattern
|
|
309
|
+
pattern = MultiAgentPattern(
|
|
310
|
+
agents=agent_roles,
|
|
311
|
+
coordinator_agent=coordinator,
|
|
312
|
+
config=PatternConfig(
|
|
313
|
+
name="collaboration",
|
|
314
|
+
pattern_type=PatternType.MULTI_AGENT
|
|
315
|
+
)
|
|
316
|
+
)
|
|
203
317
|
|
|
204
|
-
|
|
205
|
-
coordinator.add_agent("researcher", researcher_agent)
|
|
206
|
-
coordinator.add_agent("writer", writer_agent)
|
|
207
|
-
result = coordinator.execute("Create research report")
|
|
318
|
+
result = await pattern.execute("Create a report on AI in healthcare")
|
|
208
319
|
```
|
|
209
320
|
|
|
210
321
|
**Use Cases:**
|
|
@@ -58,27 +58,37 @@ import asyncio
|
|
|
58
58
|
from pygeai_orchestration import (
|
|
59
59
|
GEAIAgent,
|
|
60
60
|
AgentConfig,
|
|
61
|
+
PatternConfig,
|
|
62
|
+
PatternType,
|
|
61
63
|
ReflectionPattern
|
|
62
64
|
)
|
|
63
65
|
|
|
64
66
|
async def main():
|
|
65
|
-
# Create
|
|
66
|
-
|
|
67
|
+
# Create agent configuration
|
|
68
|
+
agent_config = AgentConfig(
|
|
67
69
|
name="my-agent",
|
|
68
|
-
model="gpt-
|
|
70
|
+
model="openai/gpt-4o-mini",
|
|
69
71
|
temperature=0.7
|
|
70
72
|
)
|
|
71
|
-
agent = GEAIAgent(config)
|
|
73
|
+
agent = GEAIAgent(config=agent_config)
|
|
74
|
+
|
|
75
|
+
# Create pattern configuration
|
|
76
|
+
pattern_config = PatternConfig(
|
|
77
|
+
name="reflection-example",
|
|
78
|
+
pattern_type=PatternType.REFLECTION,
|
|
79
|
+
max_iterations=3
|
|
80
|
+
)
|
|
72
81
|
|
|
73
82
|
# Create and execute pattern
|
|
74
|
-
pattern = ReflectionPattern(agent=agent)
|
|
75
|
-
result = await pattern.execute("
|
|
83
|
+
pattern = ReflectionPattern(agent=agent, config=pattern_config)
|
|
84
|
+
result = await pattern.execute("Explain quantum computing in simple terms")
|
|
76
85
|
|
|
77
86
|
print(f"Success: {result.success}")
|
|
78
|
-
print(f"Result: {result.result}")
|
|
79
87
|
print(f"Iterations: {result.iterations}")
|
|
88
|
+
print(f"Result: {result.result[:200]}...") # First 200 chars
|
|
80
89
|
|
|
81
|
-
|
|
90
|
+
if __name__ == "__main__":
|
|
91
|
+
asyncio.run(main())
|
|
82
92
|
```
|
|
83
93
|
|
|
84
94
|
## Configuration
|
|
@@ -107,10 +117,24 @@ See [PyGEAI Configuration](https://docs.globant.ai/en/wiki?1149,Getting+started+
|
|
|
107
117
|
Enables agents to self-critique and iteratively improve their outputs.
|
|
108
118
|
|
|
109
119
|
```python
|
|
110
|
-
from pygeai_orchestration
|
|
120
|
+
from pygeai_orchestration import GEAIAgent, AgentConfig, PatternConfig, PatternType, ReflectionPattern
|
|
121
|
+
|
|
122
|
+
agent = GEAIAgent(config=AgentConfig(
|
|
123
|
+
name="reflector",
|
|
124
|
+
model="openai/gpt-4o-mini",
|
|
125
|
+
temperature=0.7
|
|
126
|
+
))
|
|
127
|
+
|
|
128
|
+
pattern = ReflectionPattern(
|
|
129
|
+
agent=agent,
|
|
130
|
+
config=PatternConfig(
|
|
131
|
+
name="reflection",
|
|
132
|
+
pattern_type=PatternType.REFLECTION,
|
|
133
|
+
max_iterations=3
|
|
134
|
+
)
|
|
135
|
+
)
|
|
111
136
|
|
|
112
|
-
|
|
113
|
-
result = agent.reflect_and_improve("Initial output", iterations=3)
|
|
137
|
+
result = await pattern.execute("Explain quantum computing in simple terms")
|
|
114
138
|
```
|
|
115
139
|
|
|
116
140
|
**Use Cases:**
|
|
@@ -118,30 +142,28 @@ result = agent.reflect_and_improve("Initial output", iterations=3)
|
|
|
118
142
|
- Code review and refinement
|
|
119
143
|
- Self-correcting responses
|
|
120
144
|
|
|
121
|
-
### 2.
|
|
122
|
-
Integrates function calling and tool execution into agent workflows.
|
|
123
|
-
|
|
124
|
-
```python
|
|
125
|
-
from pygeai_orchestration.patterns.tool_use import ToolUseAgent
|
|
126
|
-
|
|
127
|
-
agent = ToolUseAgent(session=session)
|
|
128
|
-
agent.register_tool("search", search_function)
|
|
129
|
-
result = agent.execute("Search for information about AI")
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
**Use Cases:**
|
|
133
|
-
- API integration
|
|
134
|
-
- External data retrieval
|
|
135
|
-
- Action execution
|
|
136
|
-
|
|
137
|
-
### 3. ReAct Pattern
|
|
145
|
+
### 2. ReAct Pattern
|
|
138
146
|
Implements the Reasoning + Acting loop for step-by-step problem solving.
|
|
139
147
|
|
|
140
148
|
```python
|
|
141
|
-
from pygeai_orchestration
|
|
149
|
+
from pygeai_orchestration import GEAIAgent, AgentConfig, PatternConfig, PatternType, ReActPattern
|
|
150
|
+
|
|
151
|
+
agent = GEAIAgent(config=AgentConfig(
|
|
152
|
+
name="reasoner",
|
|
153
|
+
model="openai/gpt-4o-mini",
|
|
154
|
+
temperature=0.7
|
|
155
|
+
))
|
|
156
|
+
|
|
157
|
+
pattern = ReActPattern(
|
|
158
|
+
agent=agent,
|
|
159
|
+
config=PatternConfig(
|
|
160
|
+
name="react",
|
|
161
|
+
pattern_type=PatternType.REACT,
|
|
162
|
+
max_iterations=5
|
|
163
|
+
)
|
|
164
|
+
)
|
|
142
165
|
|
|
143
|
-
|
|
144
|
-
result = agent.solve("Complex multi-step problem")
|
|
166
|
+
result = await pattern.execute("Research and summarize renewable energy benefits")
|
|
145
167
|
```
|
|
146
168
|
|
|
147
169
|
**Use Cases:**
|
|
@@ -149,15 +171,28 @@ result = agent.solve("Complex multi-step problem")
|
|
|
149
171
|
- Research tasks
|
|
150
172
|
- Multi-step workflows
|
|
151
173
|
|
|
152
|
-
###
|
|
174
|
+
### 3. Planning Pattern
|
|
153
175
|
Creates and executes multi-step plans with adaptive execution.
|
|
154
176
|
|
|
155
177
|
```python
|
|
156
|
-
from pygeai_orchestration
|
|
178
|
+
from pygeai_orchestration import GEAIAgent, AgentConfig, PatternConfig, PatternType, PlanningPattern
|
|
179
|
+
|
|
180
|
+
agent = GEAIAgent(config=AgentConfig(
|
|
181
|
+
name="planner",
|
|
182
|
+
model="openai/gpt-4o-mini",
|
|
183
|
+
temperature=0.5
|
|
184
|
+
))
|
|
185
|
+
|
|
186
|
+
pattern = PlanningPattern(
|
|
187
|
+
agent=agent,
|
|
188
|
+
config=PatternConfig(
|
|
189
|
+
name="planning",
|
|
190
|
+
pattern_type=PatternType.PLANNING,
|
|
191
|
+
max_iterations=1
|
|
192
|
+
)
|
|
193
|
+
)
|
|
157
194
|
|
|
158
|
-
|
|
159
|
-
plan = agent.create_plan("Build a web application")
|
|
160
|
-
result = agent.execute_plan(plan)
|
|
195
|
+
result = await pattern.execute("Create a project plan for building a REST API")
|
|
161
196
|
```
|
|
162
197
|
|
|
163
198
|
**Use Cases:**
|
|
@@ -165,16 +200,92 @@ result = agent.execute_plan(plan)
|
|
|
165
200
|
- Task decomposition
|
|
166
201
|
- Workflow automation
|
|
167
202
|
|
|
203
|
+
### 4. Tool Use Pattern
|
|
204
|
+
Integrates function calling and tool execution into agent workflows.
|
|
205
|
+
|
|
206
|
+
```python
|
|
207
|
+
from pygeai_orchestration import (
|
|
208
|
+
GEAIAgent, AgentConfig, PatternConfig, PatternType,
|
|
209
|
+
ToolUsePattern, BaseTool, ToolConfig, ToolResult, ToolCategory
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
class CalculatorTool(BaseTool):
|
|
213
|
+
def __init__(self):
|
|
214
|
+
super().__init__(ToolConfig(
|
|
215
|
+
name="calculator",
|
|
216
|
+
description="Performs calculations",
|
|
217
|
+
category=ToolCategory.COMPUTATION,
|
|
218
|
+
parameters_schema={"operation": "string", "values": "list"}
|
|
219
|
+
))
|
|
220
|
+
|
|
221
|
+
def validate_parameters(self, parameters):
|
|
222
|
+
return "operation" in parameters and "values" in parameters
|
|
223
|
+
|
|
224
|
+
async def execute(self, operation, values, **kwargs):
|
|
225
|
+
if operation == "average":
|
|
226
|
+
result = sum(values) / len(values)
|
|
227
|
+
return ToolResult(success=True, result=result)
|
|
228
|
+
return ToolResult(success=False, error="Unknown operation")
|
|
229
|
+
|
|
230
|
+
agent = GEAIAgent(config=AgentConfig(name="calculator", model="openai/gpt-4o-mini"))
|
|
231
|
+
pattern = ToolUsePattern(
|
|
232
|
+
agent=agent,
|
|
233
|
+
config=PatternConfig(name="tools", pattern_type=PatternType.TOOL_USE),
|
|
234
|
+
tools=[CalculatorTool()]
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
result = await pattern.execute("Calculate average of: 10, 20, 30")
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
**Use Cases:**
|
|
241
|
+
- API integration
|
|
242
|
+
- External data retrieval
|
|
243
|
+
- Action execution
|
|
244
|
+
|
|
168
245
|
### 5. Multi-Agent Pattern
|
|
169
246
|
Coordinates multiple agents working collaboratively on complex tasks.
|
|
170
247
|
|
|
171
248
|
```python
|
|
172
|
-
from pygeai_orchestration
|
|
249
|
+
from pygeai_orchestration import (
|
|
250
|
+
GEAIAgent, AgentConfig, PatternConfig, PatternType, MultiAgentPattern, AgentRole
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
# Create specialized agents
|
|
254
|
+
researcher = GEAIAgent(config=AgentConfig(
|
|
255
|
+
name="researcher",
|
|
256
|
+
model="openai/gpt-4o-mini",
|
|
257
|
+
system_prompt="You are a research specialist."
|
|
258
|
+
))
|
|
259
|
+
|
|
260
|
+
writer = GEAIAgent(config=AgentConfig(
|
|
261
|
+
name="writer",
|
|
262
|
+
model="openai/gpt-4o-mini",
|
|
263
|
+
system_prompt="You are a technical writer."
|
|
264
|
+
))
|
|
265
|
+
|
|
266
|
+
coordinator = GEAIAgent(config=AgentConfig(
|
|
267
|
+
name="coordinator",
|
|
268
|
+
model="openai/gpt-4o-mini",
|
|
269
|
+
system_prompt="You coordinate tasks and synthesize results."
|
|
270
|
+
))
|
|
271
|
+
|
|
272
|
+
# Create agent roles
|
|
273
|
+
agent_roles = [
|
|
274
|
+
AgentRole(name="researcher", agent=researcher, role_description="Researches topics"),
|
|
275
|
+
AgentRole(name="writer", agent=writer, role_description="Writes reports")
|
|
276
|
+
]
|
|
277
|
+
|
|
278
|
+
# Create multi-agent pattern
|
|
279
|
+
pattern = MultiAgentPattern(
|
|
280
|
+
agents=agent_roles,
|
|
281
|
+
coordinator_agent=coordinator,
|
|
282
|
+
config=PatternConfig(
|
|
283
|
+
name="collaboration",
|
|
284
|
+
pattern_type=PatternType.MULTI_AGENT
|
|
285
|
+
)
|
|
286
|
+
)
|
|
173
287
|
|
|
174
|
-
|
|
175
|
-
coordinator.add_agent("researcher", researcher_agent)
|
|
176
|
-
coordinator.add_agent("writer", writer_agent)
|
|
177
|
-
result = coordinator.execute("Create research report")
|
|
288
|
+
result = await pattern.execute("Create a report on AI in healthcare")
|
|
178
289
|
```
|
|
179
290
|
|
|
180
291
|
**Use Cases:**
|