process-gpt-agent-sdk 0.4.4__tar.gz → 0.4.6__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.

Potentially problematic release.


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

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: process-gpt-agent-sdk
3
- Version: 0.4.4
3
+ Version: 0.4.6
4
4
  Summary: Supabase 기반 이벤트/작업 폴링으로 A2A AgentExecutor를 실행하는 SDK
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://github.com/your-org/process-gpt-agent-sdk
@@ -1,155 +1,155 @@
1
- # 📘 ProcessGPT Agent SDK – README
2
-
3
- ## 1. 이게 뭐하는 건가요?
4
- 이 SDK는 **ProcessGPT 에이전트 서버**를 만들 때 필요한 **공통 기능**을 제공합니다.
5
-
6
- - DB에서 **작업(todo) 폴링** → 처리할 일감 가져오기
7
- - **컨텍스트 준비** (사용자 정보, 폼 정의, MCP 설정 등 자동으로 조회)
8
- - 다양한 **에이전트 오케스트레이션(A2A)** 과 호환
9
- - **이벤트(Event) 전송 규격 통일화** → 결과를 DB에 안전하게 저장
10
-
11
- 👉 쉽게 말하면: **여러 종류의 AI 에이전트를 같은 규칙으로 실행/저장/호출할 수 있게 해주는 통합 SDK** 입니다.
12
-
13
- ---
14
-
15
- ## 2. 아키텍처 다이어그램
16
- ```mermaid
17
- flowchart TD
18
- subgraph DB[Postgres/Supabase]
19
- T[todolist]:::db
20
- E[events]:::db
21
- end
22
-
23
- subgraph SDK
24
- P[Polling\n(fetch_pending_task)] --> C[Context 준비\n(fetch_context_bundle 등)]
25
- C --> X[Executor\n(MinimalExecutor)]
26
- X -->|TaskStatusUpdateEvent| E
27
- X -->|TaskArtifactUpdateEvent| T
28
- end
29
-
30
- classDef db fill=#f2f2f2,stroke=#333,stroke-width=1px;
31
- ```
32
-
33
- - **todolist**: 각 작업(Task)의 진행 상태, 결과물 저장
34
- - **events**: 실행 중간에 발생한 이벤트 로그 저장
35
- - SDK는 두 테이블을 자동으로 연결해 줍니다.
36
-
37
- ---
38
-
39
- ## 3. A2A 타입과 이벤트 종류
40
-
41
- ### A2A 타입 (2가지)
42
- | A2A 타입 | 설명 | 매칭 테이블 |
43
- |----------|------|-------------|
44
- | **TaskStatusUpdateEvent** | 작업 상태 업데이트 | `events` 테이블 |
45
- | **TaskArtifactUpdateEvent** | 작업 결과물 업데이트 | `todolist` 테이블 |
46
-
47
- ### Event Type (4가지)
48
- | Event Type | Python 클래스 | 저장 테이블 | 설명 |
49
- |------------|---------------|-------------|------|
50
- | **task_started** | `TaskStatusUpdateEvent` | `events` | 작업 시작 상태 |
51
- | **task_working** | `TaskStatusUpdateEvent` | `events` | 작업 진행 중 상태 |
52
- | **task_completed** | `TaskArtifactUpdateEvent` | `todolist` | 작업 완료 및 결과물 저장 |
53
- | **task_error** | `TaskStatusUpdateEvent` | `events` | 작업 오류 발생 |
54
-
55
- 👉 **A2A 타입 2가지**가 핵심이며, 각각 `events`와 `todolist` 테이블에 매칭됩니다. **Event Type 4가지**로 세부 상태를 구분합니다.
56
-
57
- ---
58
-
59
- ## 4. 미니멀 예제 (기본 사용법)
60
-
61
- ### minimal_executor.py
62
- ```python
63
- class MinimalExecutor(AgentExecutor):
64
- async def execute(self, context: RequestContext, event_queue: EventQueue):
65
- # 1) 입력 가져오기
66
- query = context.get_user_input()
67
- print("User Query:", query)
68
-
69
- # 2) 상태 이벤트 (events 테이블 저장)
70
- payload = {"demo": "hello world"}
71
- event_queue.enqueue_event(
72
- TaskStatusUpdateEvent(
73
- status={
74
- "state": TaskState.working,
75
- "message": new_agent_text_message(
76
- json.dumps(payload, ensure_ascii=False), # ⚠️ str() 쓰지말고 반드시 json.dumps!
77
- context.get_context_data()["row"]["proc_inst_id"],
78
- context.get_context_data()["row"]["id"],
79
- ),
80
- },
81
- contextId=context.get_context_data()["row"]["proc_inst_id"],
82
- taskId=context.get_context_data()["row"]["id"],
83
- metadata={"crew_type": "action", "event_type": "task_started"},
84
- )
85
- )
86
-
87
- # 3) 최종 아티팩트 이벤트 (todolist 테이블 저장)
88
- artifact = new_text_artifact(
89
- name="result",
90
- description="Demo Result",
91
- text=json.dumps(payload, ensure_ascii=False), # ⚠️ 여기서도 str() 금지!
92
- )
93
- event_queue.enqueue_event(
94
- TaskArtifactUpdateEvent(
95
- artifact=artifact,
96
- lastChunk=True,
97
- contextId=context.get_context_data()["row"]["proc_inst_id"],
98
- taskId=context.get_context_data()["row"]["id"],
99
- )
100
- )
101
- ```
102
-
103
- ### minimal_server.py
104
- ```python
105
- async def main():
106
- load_dotenv()
107
- server = ProcessGPTAgentServer(
108
- agent_executor=MinimalExecutor(),
109
- agent_type="crewai-action" # 오케스트레이터 타입
110
- )
111
- await server.run()
112
- ```
113
-
114
- 👉 실행하면 SDK가 자동으로:
115
- 1. DB에서 작업 하나 가져오기 (`fetch_pending_task`)
116
- 2. 컨텍스트 준비 (폼/유저/MCP 조회)
117
- 3. Executor 실행 → 이벤트/결과 DB에 저장
118
-
119
- ---
120
-
121
- ## 5. ⚠️ JSON 직렬화 주의 (str() 절대 금지)
122
-
123
- 반드시 `json.dumps()`로 직렬화해야 합니다.
124
-
125
- - ❌ 이렇게 하면 안됨:
126
- ```python
127
- text = str({"key": "value"}) # Python dict string → JSON 아님
128
- ```
129
- DB에 `"'{key: value}'"` 꼴로 문자열 저장됨 → 파싱 실패
130
-
131
- - ✅ 이렇게 해야 함:
132
- ```python
133
- text = json.dumps({"key": "value"}, ensure_ascii=False)
134
- ```
135
- DB에 `{"key": "value"}` JSON 저장됨 → 파싱 성공
136
-
137
- 👉 **SDK는 내부에서 `json.loads`로 재파싱**하기 때문에, 표준 JSON 문자열이 아니면 무조건 문자열로만 남습니다.
138
-
139
- ---
140
-
141
- ## 6. 요약
142
- - 이 SDK는 **ProcessGPT Agent**를 표준 규격으로 실행/저장/호출하는 공통 레이어
143
- - 작업 → 컨텍스트 준비 → Executor 실행 → 이벤트 저장 전체를 자동화
144
- - **A2A 타입 2가지**: `TaskStatusUpdateEvent`, `TaskArtifactUpdateEvent`
145
- - **Event Type 4가지**: `task_started`, `task_working`, `task_completed`, `task_error`
146
- - **DB 매핑**:
147
- - `TaskStatusUpdateEvent` → `events` 테이블
148
- - `TaskArtifactUpdateEvent` → `todolist` 테이블
149
- - ⚠️ **str() 대신 무조건 `json.dumps` 사용!**
150
-
151
-
152
-
153
- ## 7. 버전업
154
- - ./release.sh 버전
1
+ # 📘 ProcessGPT Agent SDK – README
2
+
3
+ ## 1. 이게 뭐하는 건가요?
4
+ 이 SDK는 **ProcessGPT 에이전트 서버**를 만들 때 필요한 **공통 기능**을 제공합니다.
5
+
6
+ - DB에서 **작업(todo) 폴링** → 처리할 일감 가져오기
7
+ - **컨텍스트 준비** (사용자 정보, 폼 정의, MCP 설정 등 자동으로 조회)
8
+ - 다양한 **에이전트 오케스트레이션(A2A)** 과 호환
9
+ - **이벤트(Event) 전송 규격 통일화** → 결과를 DB에 안전하게 저장
10
+
11
+ 👉 쉽게 말하면: **여러 종류의 AI 에이전트를 같은 규칙으로 실행/저장/호출할 수 있게 해주는 통합 SDK** 입니다.
12
+
13
+ ---
14
+
15
+ ## 2. 아키텍처 다이어그램
16
+ ```mermaid
17
+ flowchart TD
18
+ subgraph DB[Postgres/Supabase]
19
+ T[todolist]:::db
20
+ E[events]:::db
21
+ end
22
+
23
+ subgraph SDK
24
+ P[Polling\n(fetch_pending_task)] --> C[Context 준비\n(fetch_context_bundle 등)]
25
+ C --> X[Executor\n(MinimalExecutor)]
26
+ X -->|TaskStatusUpdateEvent| E
27
+ X -->|TaskArtifactUpdateEvent| T
28
+ end
29
+
30
+ classDef db fill=#f2f2f2,stroke=#333,stroke-width=1px;
31
+ ```
32
+
33
+ - **todolist**: 각 작업(Task)의 진행 상태, 결과물 저장
34
+ - **events**: 실행 중간에 발생한 이벤트 로그 저장
35
+ - SDK는 두 테이블을 자동으로 연결해 줍니다.
36
+
37
+ ---
38
+
39
+ ## 3. A2A 타입과 이벤트 종류
40
+
41
+ ### A2A 타입 (2가지)
42
+ | A2A 타입 | 설명 | 매칭 테이블 |
43
+ |----------|------|-------------|
44
+ | **TaskStatusUpdateEvent** | 작업 상태 업데이트 | `events` 테이블 |
45
+ | **TaskArtifactUpdateEvent** | 작업 결과물 업데이트 | `todolist` 테이블 |
46
+
47
+ ### Event Type (4가지)
48
+ | Event Type | Python 클래스 | 저장 테이블 | 설명 |
49
+ |------------|---------------|-------------|------|
50
+ | **task_started** | `TaskStatusUpdateEvent` | `events` | 작업 시작 상태 |
51
+ | **task_working** | `TaskStatusUpdateEvent` | `events` | 작업 진행 중 상태 |
52
+ | **task_completed** | `TaskArtifactUpdateEvent` | `todolist` | 작업 완료 및 결과물 저장 |
53
+ | **task_error** | `TaskStatusUpdateEvent` | `events` | 작업 오류 발생 |
54
+
55
+ 👉 **A2A 타입 2가지**가 핵심이며, 각각 `events`와 `todolist` 테이블에 매칭됩니다. **Event Type 4가지**로 세부 상태를 구분합니다.
56
+
57
+ ---
58
+
59
+ ## 4. 미니멀 예제 (기본 사용법)
60
+
61
+ ### minimal_executor.py
62
+ ```python
63
+ class MinimalExecutor(AgentExecutor):
64
+ async def execute(self, context: RequestContext, event_queue: EventQueue):
65
+ # 1) 입력 가져오기
66
+ query = context.get_user_input()
67
+ print("User Query:", query)
68
+
69
+ # 2) 상태 이벤트 (events 테이블 저장)
70
+ payload = {"demo": "hello world"}
71
+ event_queue.enqueue_event(
72
+ TaskStatusUpdateEvent(
73
+ status={
74
+ "state": TaskState.working,
75
+ "message": new_agent_text_message(
76
+ json.dumps(payload, ensure_ascii=False), # ⚠️ str() 쓰지말고 반드시 json.dumps!
77
+ context.get_context_data()["row"]["proc_inst_id"],
78
+ context.get_context_data()["row"]["id"],
79
+ ),
80
+ },
81
+ contextId=context.get_context_data()["row"]["proc_inst_id"],
82
+ taskId=context.get_context_data()["row"]["id"],
83
+ metadata={"crew_type": "action", "event_type": "task_started"},
84
+ )
85
+ )
86
+
87
+ # 3) 최종 아티팩트 이벤트 (todolist 테이블 저장)
88
+ artifact = new_text_artifact(
89
+ name="result",
90
+ description="Demo Result",
91
+ text=json.dumps(payload, ensure_ascii=False), # ⚠️ 여기서도 str() 금지!
92
+ )
93
+ event_queue.enqueue_event(
94
+ TaskArtifactUpdateEvent(
95
+ artifact=artifact,
96
+ lastChunk=True,
97
+ contextId=context.get_context_data()["row"]["proc_inst_id"],
98
+ taskId=context.get_context_data()["row"]["id"],
99
+ )
100
+ )
101
+ ```
102
+
103
+ ### minimal_server.py
104
+ ```python
105
+ async def main():
106
+ load_dotenv()
107
+ server = ProcessGPTAgentServer(
108
+ agent_executor=MinimalExecutor(),
109
+ agent_type="crewai-action" # 오케스트레이터 타입
110
+ )
111
+ await server.run()
112
+ ```
113
+
114
+ 👉 실행하면 SDK가 자동으로:
115
+ 1. DB에서 작업 하나 가져오기 (`fetch_pending_task`)
116
+ 2. 컨텍스트 준비 (폼/유저/MCP 조회)
117
+ 3. Executor 실행 → 이벤트/결과 DB에 저장
118
+
119
+ ---
120
+
121
+ ## 5. ⚠️ JSON 직렬화 주의 (str() 절대 금지)
122
+
123
+ 반드시 `json.dumps()`로 직렬화해야 합니다.
124
+
125
+ - ❌ 이렇게 하면 안됨:
126
+ ```python
127
+ text = str({"key": "value"}) # Python dict string → JSON 아님
128
+ ```
129
+ DB에 `"'{key: value}'"` 꼴로 문자열 저장됨 → 파싱 실패
130
+
131
+ - ✅ 이렇게 해야 함:
132
+ ```python
133
+ text = json.dumps({"key": "value"}, ensure_ascii=False)
134
+ ```
135
+ DB에 `{"key": "value"}` JSON 저장됨 → 파싱 성공
136
+
137
+ 👉 **SDK는 내부에서 `json.loads`로 재파싱**하기 때문에, 표준 JSON 문자열이 아니면 무조건 문자열로만 남습니다.
138
+
139
+ ---
140
+
141
+ ## 6. 요약
142
+ - 이 SDK는 **ProcessGPT Agent**를 표준 규격으로 실행/저장/호출하는 공통 레이어
143
+ - 작업 → 컨텍스트 준비 → Executor 실행 → 이벤트 저장 전체를 자동화
144
+ - **A2A 타입 2가지**: `TaskStatusUpdateEvent`, `TaskArtifactUpdateEvent`
145
+ - **Event Type 4가지**: `task_started`, `task_working`, `task_completed`, `task_error`
146
+ - **DB 매핑**:
147
+ - `TaskStatusUpdateEvent` → `events` 테이블
148
+ - `TaskArtifactUpdateEvent` → `todolist` 테이블
149
+ - ⚠️ **str() 대신 무조건 `json.dumps` 사용!**
150
+
151
+
152
+
153
+ ## 7. 버전업
154
+ - ./release.sh 버전
155
155
  - 오류 발생시 : python -m ensurepip --upgrade
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: process-gpt-agent-sdk
3
- Version: 0.4.4
3
+ Version: 0.4.6
4
4
  Summary: Supabase 기반 이벤트/작업 폴링으로 A2A AgentExecutor를 실행하는 SDK
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://github.com/your-org/process-gpt-agent-sdk
@@ -1,45 +1,45 @@
1
- from .processgpt_agent_framework import (
2
- ProcessGPTAgentServer,
3
- ProcessGPTRequestContext,
4
- ProcessGPTEventQueue,
5
- ContextPreparationError,
6
- )
7
- from .database import (
8
- initialize_db,
9
- get_consumer_id,
10
- polling_pending_todos,
11
- record_event,
12
- record_events_bulk,
13
- save_task_result,
14
- update_task_error,
15
- fetch_form_def,
16
- fetch_users_grouped,
17
- fetch_email_users_by_proc_inst_id,
18
- fetch_tenant_mcp,
19
- )
20
- from .utils import (
21
- summarize_error_to_user,
22
- summarize_feedback,
23
- )
24
- from .single_run import run_single_todo_readonly
25
-
26
- __all__ = [
27
- "ProcessGPTAgentServer",
28
- "ProcessGPTRequestContext",
29
- "ProcessGPTEventQueue",
30
- "ContextPreparationError",
31
- "initialize_db",
32
- "get_consumer_id",
33
- "polling_pending_todos",
34
- "record_event",
35
- "record_events_bulk",
36
- "save_task_result",
37
- "update_task_error",
38
- "fetch_form_def",
39
- "fetch_users_grouped",
40
- "fetch_email_users_by_proc_inst_id",
41
- "fetch_tenant_mcp",
42
- "summarize_error_to_user",
43
- "summarize_feedback",
44
- "run_single_todo_readonly",
1
+ from .processgpt_agent_framework import (
2
+ ProcessGPTAgentServer,
3
+ ProcessGPTRequestContext,
4
+ ProcessGPTEventQueue,
5
+ ContextPreparationError,
6
+ )
7
+ from .database import (
8
+ initialize_db,
9
+ get_consumer_id,
10
+ polling_pending_todos,
11
+ record_event,
12
+ record_events_bulk,
13
+ save_task_result,
14
+ update_task_error,
15
+ fetch_form_def,
16
+ fetch_users_grouped,
17
+ fetch_email_users_by_proc_inst_id,
18
+ fetch_tenant_mcp,
19
+ )
20
+ from .utils import (
21
+ summarize_error_to_user,
22
+ summarize_feedback,
23
+ )
24
+ from .single_run import run_single_todo_readonly
25
+
26
+ __all__ = [
27
+ "ProcessGPTAgentServer",
28
+ "ProcessGPTRequestContext",
29
+ "ProcessGPTEventQueue",
30
+ "ContextPreparationError",
31
+ "initialize_db",
32
+ "get_consumer_id",
33
+ "polling_pending_todos",
34
+ "record_event",
35
+ "record_events_bulk",
36
+ "save_task_result",
37
+ "update_task_error",
38
+ "fetch_form_def",
39
+ "fetch_users_grouped",
40
+ "fetch_email_users_by_proc_inst_id",
41
+ "fetch_tenant_mcp",
42
+ "summarize_error_to_user",
43
+ "summarize_feedback",
44
+ "run_single_todo_readonly",
45
45
  ]