process-gpt-agent-sdk 0.2.7__py3-none-any.whl → 0.2.9__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.

Potentially problematic release.


This version of process-gpt-agent-sdk might be problematic. Click here for more details.

@@ -1,378 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: process-gpt-agent-sdk
3
- Version: 0.2.7
4
- Summary: Supabase 기반 이벤트/작업 폴링으로 A2A AgentExecutor를 실행하는 SDK
5
- License: MIT
6
- Project-URL: Homepage, https://github.com/your-org/process-gpt-agent-sdk
7
- Project-URL: Issues, https://github.com/your-org/process-gpt-agent-sdk/issues
8
- Keywords: agent,a2a,supabase,workflow,sdk,processgpt
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: Programming Language :: Python :: 3 :: Only
11
- Classifier: License :: OSI Approved :: MIT License
12
- Classifier: Operating System :: OS Independent
13
- Requires-Python: >=3.9
14
- Description-Content-Type: text/markdown
15
- Requires-Dist: supabase>=2.0.0
16
- Requires-Dist: python-dotenv>=1.0.0
17
- Requires-Dist: click>=8.0.0
18
- Requires-Dist: asyncio-mqtt>=0.13.0
19
- Requires-Dist: jsonschema>=4.0.0
20
- Requires-Dist: structlog>=23.0.0
21
- Requires-Dist: typing-extensions>=4.0.0
22
- Requires-Dist: python-dateutil>=2.8.0
23
- Requires-Dist: openai>=1.40.0
24
- Requires-Dist: a2a-sdk==0.2.4
25
- Requires-Dist: requests>=2.31.0
26
- Requires-Dist: anyio>=4.4.0
27
- Requires-Dist: pydantic>=2.7.0
28
- Requires-Dist: crewai>=0.51.0
29
- Requires-Dist: crewai-tools>=0.8.2
30
- Requires-Dist: mem0ai>=0.1.0
31
- Requires-Dist: mcp>=1.0.0
32
-
33
- # ProcessGPT Agent Framework
34
-
35
- Google A2A SDK의 인터페이스를 활용하면서 웹소켓 대신 Supabase 실시간 DB를 사용하는 에이전트 실행 프레임워크입니다.
36
-
37
- ## 🏗️ 아키텍처 개요
38
-
39
- 이 프레임워크는 기존의 Google A2A SDK의 `AgentExecutor`와 `RequestContext` 인터페이스를 그대로 활용하되, 웹소켓 기반 통신 대신 Supabase 데이터베이스를 중간 매개체로 사용합니다.
40
-
41
- ### 핵심 구성 요소
42
-
43
- 1. **Supabase Database Tables**
44
- - `todolist`: 에이전트가 처리해야 할 작업들을 저장
45
- - `events`: 각 태스크의 실행 상태와 진행 과정을 추적
46
-
47
- 2. **ProcessGPT Server**
48
- - Supabase `todolist` 테이블을 폴링하여 대기 중인 작업을 감지
49
- - Google A2A SDK의 `AgentExecutor.execute()` 메서드를 호출
50
- - 커스터마이즈된 `EventQueue`를 통해 이벤트를 Supabase에 저장
51
-
52
- 3. **Custom Classes**
53
- - `ProcessGPTRequestContext`: todolist 데이터를 기반으로 한 RequestContext 구현
54
- - `ProcessGPTEventQueue`: Supabase events 테이블에 이벤트를 저장하는 EventQueue 구현
55
-
56
- ## 📊 데이터베이스 스키마
57
-
58
- ### TodoList Table
59
- ```sql
60
- CREATE TABLE todolist (
61
- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
62
- agent_type VARCHAR(100) NOT NULL, -- 에이전트 타입 식별자
63
- prompt TEXT NOT NULL, -- 에이전트가 실행할 프롬프트
64
- input_data JSONB, -- 추가 입력 데이터
65
- agent_status VARCHAR(50) DEFAULT 'pending', -- 실행 상태
66
- agent_output JSONB, -- 실행 결과
67
- priority INTEGER DEFAULT 0, -- 우선순위
68
- created_at TIMESTAMPTZ DEFAULT NOW(),
69
- updated_at TIMESTAMPTZ DEFAULT NOW(),
70
- started_at TIMESTAMPTZ,
71
- completed_at TIMESTAMPTZ
72
- );
73
- ```
74
-
75
- ### Events Table
76
- ```sql
77
- CREATE TABLE events (
78
- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
79
- todolist_id UUID NOT NULL REFERENCES todolist(id),
80
- event_type VARCHAR(50) NOT NULL, -- 이벤트 타입
81
- event_data JSONB NOT NULL, -- 이벤트 상세 데이터
82
- context_id VARCHAR(255), -- A2A 컨텍스트 ID
83
- task_id VARCHAR(255), -- A2A 태스크 ID
84
- message TEXT, -- 이벤트 메시지
85
- created_at TIMESTAMPTZ DEFAULT NOW()
86
- );
87
- ```
88
-
89
- ## 🚀 사용법
90
-
91
- ### 1. 환경 설정
92
-
93
- ```bash
94
- # 의존성 설치
95
- pip install -r requirements.txt
96
-
97
- # 환경변수 설정 (.env 파일 생성)
98
- cp env.example .env
99
- # .env 파일에서 Supabase 설정을 입력하세요
100
- ```
101
-
102
- ### 2. 데이터베이스 설정
103
-
104
- ```sql
105
- -- database_schema.sql의 내용을 Supabase에서 실행
106
- ```
107
-
108
- ### 3. 서버 실행
109
-
110
- ```bash
111
- # CrewAI Deep Research Agent 서버 실행
112
- cd sample_server
113
- python crew_ai_dr_agent_server.py --agent-type crew-ai-dr --polling-interval 5
114
- ```
115
-
116
- ### 4. 태스크 제출
117
-
118
- ```python
119
- from supabase import create_client
120
- from processgpt_utils import ProcessGPTClient
121
- import asyncio
122
-
123
- # Supabase 클라이언트 초기화
124
- supabase = create_client(
125
- "https://your-project.supabase.co",
126
- "your-anon-key"
127
- )
128
-
129
- # ProcessGPT 클라이언트 생성
130
- client = ProcessGPTClient(supabase)
131
-
132
- async def submit_task_example():
133
- # 태스크 제출
134
- todolist_id = await client.submit_task(
135
- agent_type="crew-ai-dr",
136
- prompt="Deep research on renewable energy trends",
137
- input_data={"domain": "energy", "depth": "comprehensive"}
138
- )
139
-
140
- print(f"Task submitted: {todolist_id}")
141
-
142
- # 완료까지 대기
143
- result = await client.wait_for_completion(todolist_id)
144
- print(f"Task completed: {result}")
145
-
146
- # 실행
147
- asyncio.run(submit_task_example())
148
- ```
149
-
150
- ## 🔄 워크플로우
151
-
152
- ### 시퀀스 다이어그램
153
-
154
- ```mermaid
155
- sequenceDiagram
156
- participant Client as Client Application
157
- participant DB as Supabase Database
158
- participant TodoTable as TodoList Table
159
- participant EventTable as Events Table
160
- participant Server as ProcessGPT Agent Server
161
- participant Executor as Agent Executor
162
- participant AI as CrewAI/Langgraph/OpenAI
163
-
164
- Note over Client, AI: ProcessGPT Agent Framework Workflow
165
-
166
- %% Task Submission
167
- Client->>DB: Submit new task
168
- Client->>TodoTable: INSERT INTO todolist<br/>(agent_type, prompt, input_data, status='pending')
169
- TodoTable-->>Client: Return todolist_id
170
-
171
- %% Server Polling Loop
172
- loop Every 5 seconds (configurable)
173
- Server->>TodoTable: SELECT * FROM todolist<br/>WHERE agent_status='pending'<br/>AND agent_type='{configured_type}'
174
- TodoTable-->>Server: Return pending tasks
175
-
176
- alt Tasks found
177
- Server->>TodoTable: UPDATE todolist<br/>SET agent_status='in_progress',<br/>started_at=NOW()<br/>WHERE id='{todolist_id}'
178
-
179
- %% Event Logging - Task Started
180
- Server->>EventTable: INSERT INTO events<br/>(todolist_id, event_type='task_started',<br/>event_data, message)
181
-
182
- %% Create Request Context
183
- Server->>Server: Create ProcessGPTRequestContext<br/>from todolist data
184
-
185
- %% Create Event Queue
186
- Server->>Server: Create ProcessGPTEventQueue<br/>with Supabase connection
187
-
188
- %% Execute Agent
189
- Server->>Executor: execute(context, event_queue)
190
-
191
- %% Agent Processing with AI Frameworks
192
- Executor->>AI: Use AI frameworks<br/>(CrewAI, Langgraph, OpenAI)<br/>with A2A interfaces
193
-
194
- loop During Agent Execution
195
- AI->>Executor: Progress events/status updates
196
- Executor->>Server: Forward events to ProcessGPTEventQueue
197
- Server->>EventTable: INSERT INTO events<br/>(todolist_id, event_type, event_data)
198
- end
199
-
200
- alt Agent Success
201
- AI-->>Executor: Task completed successfully
202
- Executor-->>Server: Task completion
203
- Server->>EventTable: INSERT INTO events<br/>(event_type='task_completed')
204
- Server->>TodoTable: UPDATE todolist<br/>SET agent_status='completed',<br/>agent_output='{result}',<br/>completed_at=NOW()
205
- else Agent Failure
206
- AI-->>Executor: Task failed with error
207
- Executor-->>Server: Task failure
208
- Server->>EventTable: INSERT INTO events<br/>(event_type='task_failed', error)
209
- Server->>TodoTable: UPDATE todolist<br/>SET agent_status='failed',<br/>agent_output='{error}',<br/>completed_at=NOW()
210
- end
211
- else No tasks
212
- Note over Server: Wait for next polling cycle
213
- end
214
- end
215
-
216
- %% Client Status Monitoring
217
- loop Client Monitoring
218
- Client->>TodoTable: SELECT * FROM todolist<br/>WHERE id='{todolist_id}'
219
- TodoTable-->>Client: Return task status
220
-
221
- Client->>EventTable: SELECT * FROM events<br/>WHERE todolist_id='{todolist_id}'<br/>ORDER BY created_at
222
- EventTable-->>Client: Return event history
223
-
224
- alt Task Completed
225
- Note over Client: Process final result
226
- else Task Still Running
227
- Note over Client: Continue monitoring
228
- end
229
- end
230
- ```
231
-
232
- ### 워크플로우 단계
233
-
234
- 1. **태스크 제출**: 클라이언트가 `todolist` 테이블에 새로운 작업을 INSERT
235
- 2. **폴링**: ProcessGPT Agent Server가 주기적으로 `pending` 상태의 작업들을 조회
236
- 3. **상태 업데이트**: 발견된 작업의 상태를 `in_progress`로 변경
237
- 4. **컨텍스트 생성**: todolist 데이터를 기반으로 `ProcessGPTRequestContext` 생성
238
- 5. **이벤트 큐 생성**: Supabase 연동 `ProcessGPTEventQueue` 생성
239
- 6. **에이전트 실행**: Google A2A SDK 인터페이스를 통해 AI 프레임워크(CrewAI, Langgraph, OpenAI) 호출
240
- 7. **이벤트 로깅**: 실행 과정의 모든 이벤트가 `events` 테이블에 저장
241
- 8. **완료 처리**: 최종 결과가 `todolist`의 `agent_output`에 저장
242
-
243
- ## 🛠️ 커스터마이제이션
244
-
245
- ### 새로운 에이전트 타입 추가
246
-
247
- 1. `AgentExecutor`를 상속받는 새로운 클래스 생성:
248
-
249
- ```python
250
- from a2a.server.agent_execution import AgentExecutor, RequestContext
251
- from a2a.server.events import EventQueue
252
-
253
- class MyCustomAgentExecutor(AgentExecutor):
254
- async def execute(self, context: RequestContext, event_queue: EventQueue) -> None:
255
- # 에이전트 로직 구현
256
- pass
257
-
258
- async def cancel(self, context: RequestContext, event_queue: EventQueue) -> None:
259
- # 취소 로직 구현
260
- pass
261
- ```
262
-
263
- 2. 새로운 서버 스크립트 생성:
264
-
265
- ```python
266
- from processgpt_agent_framework import ProcessGPTAgentServer
267
- from my_custom_agent_executor import MyCustomAgentExecutor
268
-
269
- agent_executor = MyCustomAgentExecutor()
270
- server = ProcessGPTAgentServer(
271
- agent_executor=agent_executor,
272
- agent_type="my-custom-agent"
273
- )
274
-
275
- asyncio.run(server.run())
276
- ```
277
-
278
- ### RequestContext 확장
279
-
280
- 기본 `ProcessGPTRequestContext`를 상속받아 추가 기능을 구현할 수 있습니다:
281
-
282
- ```python
283
- class ExtendedRequestContext(ProcessGPTRequestContext):
284
- def __init__(self, todolist_item: TodoListItem):
285
- super().__init__(todolist_item)
286
- # 추가 초기화 로직
287
-
288
- def get_custom_data(self):
289
- # 커스텀 데이터 반환 로직
290
- return self.todolist_item.input_data.get('custom_field')
291
- ```
292
-
293
- ## 📊 모니터링
294
-
295
- 시스템 상태를 모니터링하기 위한 유틸리티:
296
-
297
- ```python
298
- from processgpt_utils import ProcessGPTMonitor
299
-
300
- monitor = ProcessGPTMonitor(supabase)
301
-
302
- # 시스템 통계 조회
303
- stats = await monitor.get_system_stats()
304
- print(f"Total tasks: {stats['total_tasks']}")
305
- print(f"Pending: {stats['pending_tasks']}")
306
- print(f"Completed: {stats['completed_tasks']}")
307
-
308
- # 최근 이벤트 조회
309
- recent_events = await monitor.get_recent_events(limit=10)
310
- ```
311
-
312
- ## 🔧 설정 옵션
313
-
314
- ### 환경변수
315
-
316
- ```bash
317
- # Supabase 설정
318
- SUPABASE_URL=https://your-project.supabase.co
319
- SUPABASE_ANON_KEY=your-anon-key-here
320
-
321
- # 에이전트 설정
322
- DEFAULT_AGENT_TYPE=crew-ai-dr
323
- DEFAULT_POLLING_INTERVAL=5
324
-
325
- # 로깅
326
- LOG_LEVEL=INFO
327
- ```
328
-
329
- ### 서버 옵션
330
-
331
- ```bash
332
- # 폴링 간격 설정 (초)
333
- python server.py --polling-interval 10
334
-
335
- # 특정 에이전트 타입만 처리
336
- python server.py --agent-type my-custom-agent
337
- ```
338
-
339
- ## 🐛 트러블슈팅
340
-
341
- ### 일반적인 문제들
342
-
343
- 1. **Supabase 연결 실패**
344
- - 환경변수 `SUPABASE_URL`과 `SUPABASE_ANON_KEY` 확인
345
- - 네트워크 연결 상태 확인
346
-
347
- 2. **폴링이 작동하지 않음**
348
- - 데이터베이스 테이블이 올바르게 생성되었는지 확인
349
- - `agent_type`이 정확히 매칭되는지 확인
350
-
351
- 3. **이벤트가 저장되지 않음**
352
- - Supabase RLS (Row Level Security) 정책 확인
353
- - 테이블 권한 설정 확인
354
-
355
- ### 로그 확인
356
-
357
- ```bash
358
- # 디버그 모드로 실행
359
- LOG_LEVEL=DEBUG python server.py
360
- ```
361
-
362
- ## 🤝 기여
363
-
364
- 1. Fork the repository
365
- 2. Create a feature branch
366
- 3. Commit your changes
367
- 4. Push to the branch
368
- 5. Create a Pull Request
369
-
370
- ## 📄 라이선스
371
-
372
- MIT License - 자세한 내용은 LICENSE 파일을 참조하세요.
373
-
374
- ## 🔗 관련 링크
375
-
376
- - [Google A2A SDK Documentation](https://developers.google.com/a2a)
377
- - [Supabase Documentation](https://supabase.com/docs)
378
- - [ProcessGPT Framework Issues](https://github.com/your-repo/issues)
@@ -1,18 +0,0 @@
1
- processgpt_agent_sdk/__init__.py,sha256=IvAL5WBZhI83LYQogRP6-i04bxZkhmkgmES4FRQY888,185
2
- processgpt_agent_sdk/server.py,sha256=4_uifUFuZCGy1HEBpVAilhjlti25iQ0bjbmeFVrFakU,11366
3
- processgpt_agent_sdk/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- processgpt_agent_sdk/core/database.py,sha256=_xZTeMVEz2bvOjLh59zJ8QgiuM8WznLQ9lKk8Trhymk,16370
5
- processgpt_agent_sdk/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- processgpt_agent_sdk/tools/human_query_tool.py,sha256=I4Q5AS5YRem0pkIz5_bhMnS5NGlGhKky4_HE22UOdmE,10871
7
- processgpt_agent_sdk/tools/knowledge_tools.py,sha256=AOtxvLypu343877ZzzELGq3At-E_2NiAqEw0Njlephg,8937
8
- processgpt_agent_sdk/tools/safe_tool_loader.py,sha256=18aT1M9FqCecu-JJvKxikYpl7nH3in09z7qZG1u9k-U,7663
9
- processgpt_agent_sdk/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
- processgpt_agent_sdk/utils/context_manager.py,sha256=efNUGxMMJi8Nxy5bOpfYAk2AIjgWoXS0tz6zkROZKrs,1804
11
- processgpt_agent_sdk/utils/crewai_event_listener.py,sha256=MwIMtRjw7L1uV8QRvlNV1agxRzjL3hC5EYBQIsMX2XA,9155
12
- processgpt_agent_sdk/utils/event_handler.py,sha256=meyxMaiGH7VvKQJRhlHKRbWhSzxyEzoHGAEGVIxNocA,2879
13
- processgpt_agent_sdk/utils/logger.py,sha256=d6Chvwx6qLAyirXRFg4bARzEovo1UYaRgLTaknHad9E,1271
14
- processgpt_agent_sdk/utils/summarizer.py,sha256=h2OBfVYq1JB0A2rLqSdYObEDlN54DzsHTmqnStis4XI,5743
15
- process_gpt_agent_sdk-0.2.7.dist-info/METADATA,sha256=_7Nj1fi-dNq0RLDtV_2MT3i73vUg35s9Z2q2BdlJKKA,12898
16
- process_gpt_agent_sdk-0.2.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
17
- process_gpt_agent_sdk-0.2.7.dist-info/top_level.txt,sha256=Xe6zrj3_3Vv7d0pl5RRtenVUckwOVBVLQn2P03j5REo,21
18
- process_gpt_agent_sdk-0.2.7.dist-info/RECORD,,