ddd-agent 0.1.0__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.
Files changed (29) hide show
  1. ddd_agent-0.1.0/.gitignore +10 -0
  2. ddd_agent-0.1.0/LICENSE +21 -0
  3. ddd_agent-0.1.0/PKG-INFO +245 -0
  4. ddd_agent-0.1.0/README.md +201 -0
  5. ddd_agent-0.1.0/pyproject.toml +101 -0
  6. ddd_agent-0.1.0/src/domain_agent/__init__.py +12 -0
  7. ddd_agent-0.1.0/src/domain_agent/application/__init__.py +1 -0
  8. ddd_agent-0.1.0/src/domain_agent/application/dto.py +74 -0
  9. ddd_agent-0.1.0/src/domain_agent/application/ports.py +76 -0
  10. ddd_agent-0.1.0/src/domain_agent/application/services.py +75 -0
  11. ddd_agent-0.1.0/src/domain_agent/domain/__init__.py +31 -0
  12. ddd_agent-0.1.0/src/domain_agent/domain/models.py +325 -0
  13. ddd_agent-0.1.0/src/domain_agent/infrastructure/__init__.py +1 -0
  14. ddd_agent-0.1.0/src/domain_agent/infrastructure/adapters/__init__.py +25 -0
  15. ddd_agent-0.1.0/src/domain_agent/infrastructure/adapters/in_memory.py +192 -0
  16. ddd_agent-0.1.0/src/domain_agent/infrastructure/adapters/langchain.py +186 -0
  17. ddd_agent-0.1.0/src/domain_agent/interfaces/__init__.py +6 -0
  18. ddd_agent-0.1.0/src/domain_agent/interfaces/cli_approval.py +111 -0
  19. ddd_agent-0.1.0/src/domain_agent/interfaces/cli_demo.py +189 -0
  20. ddd_agent-0.1.0/src/domain_agent/interfaces/cli_graph.py +48 -0
  21. ddd_agent-0.1.0/src/domain_agent/workflow/__init__.py +1 -0
  22. ddd_agent-0.1.0/src/domain_agent/workflow/errors.py +5 -0
  23. ddd_agent-0.1.0/src/domain_agent/workflow/export.py +38 -0
  24. ddd_agent-0.1.0/src/domain_agent/workflow/graph.py +46 -0
  25. ddd_agent-0.1.0/src/domain_agent/workflow/nodes/__init__.py +10 -0
  26. ddd_agent-0.1.0/src/domain_agent/workflow/nodes/deterministic.py +138 -0
  27. ddd_agent-0.1.0/src/domain_agent/workflow/nodes/llm.py +29 -0
  28. ddd_agent-0.1.0/src/domain_agent/workflow/ports.py +17 -0
  29. ddd_agent-0.1.0/src/domain_agent/workflow/state.py +37 -0
@@ -0,0 +1,10 @@
1
+ .venv/
2
+ __pycache__/
3
+ .pytest_cache/
4
+ .mypy_cache/
5
+ .ruff_cache/
6
+ dist/
7
+ build/
8
+ site/
9
+ *.egg-info/
10
+ .DS_Store
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Seungbae Ji
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,245 @@
1
+ Metadata-Version: 2.4
2
+ Name: ddd-agent
3
+ Version: 0.1.0
4
+ Summary: DDD-friendly Python agent template for LangGraph and LangChain applications.
5
+ Project-URL: Homepage, https://github.com/seungbaeji/domain-agent-template
6
+ Project-URL: Repository, https://github.com/seungbaeji/domain-agent-template
7
+ Project-URL: Issues, https://github.com/seungbaeji/domain-agent-template/issues
8
+ Author: Seungbae Ji
9
+ License: MIT License
10
+
11
+ Copyright (c) 2026 Seungbae Ji
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+ License-File: LICENSE
31
+ Keywords: agent,ddd,langchain,langgraph,workflow
32
+ Classifier: Development Status :: 3 - Alpha
33
+ Classifier: Intended Audience :: Developers
34
+ Classifier: License :: OSI Approved :: MIT License
35
+ Classifier: Programming Language :: Python :: 3
36
+ Classifier: Programming Language :: Python :: 3.11
37
+ Classifier: Programming Language :: Python :: 3.12
38
+ Classifier: Programming Language :: Python :: 3.13
39
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
40
+ Requires-Python: >=3.11
41
+ Requires-Dist: langchain-core>=1.0.0
42
+ Requires-Dist: langgraph>=0.2.0
43
+ Description-Content-Type: text/markdown
44
+
45
+ # ddd-agent
46
+
47
+ LangGraph와 LangChain을 적용하기 쉬운 DDD-friendly Python agent 템플릿입니다.
48
+
49
+ 이 저장소는 "LangGraph를 쓰는 샘플"이 아니라, 다음을 분리해서 유지하는 reusable core를 목표로 합니다.
50
+
51
+ - 도메인 규칙
52
+ - review packet과 review result 같은 사람 개입 모델
53
+ - `AgentEngine` 포트를 통한 agent reasoning 결과 생성
54
+ - LangGraph workflow orchestration
55
+ - LangChain LCEL 기반 `AgentEngine` adapter
56
+ - CLI 기반 human review 데모
57
+ - 외부 example app
58
+
59
+ ## 핵심 포인트
60
+
61
+ - 패키지 이름: `ddd-agent`
62
+ - import 패키지: `domain_agent`
63
+ - Python: `3.11+`
64
+ - 패키징: `uv`
65
+ - workflow orchestration: `LangGraph`
66
+ - 현재 사람 개입 흐름: `optional human review`
67
+ - 포함된 CLI:
68
+ - `domain-agent-demo`
69
+ - `domain-agent-graph`
70
+
71
+ ## 빠른 실행
72
+
73
+ ```bash
74
+ uv sync
75
+ uv run domain-agent-demo
76
+ ```
77
+
78
+ workflow graph 확인:
79
+
80
+ ```bash
81
+ uv run domain-agent-graph --format mermaid
82
+ ```
83
+
84
+ 패키지 빌드:
85
+
86
+ ```bash
87
+ uv build
88
+ ```
89
+
90
+ PyPI 배포:
91
+
92
+ - GitHub Release를 `published` 상태로 만들면 `.github/workflows/release.yml`이 실행됩니다.
93
+ - workflow는 `uv build` 후 Trusted Publishing으로 `ddd-agent`를 PyPI에 업로드합니다.
94
+ - PyPI 쪽 publisher 설정의 project name은 반드시 `ddd-agent`여야 합니다.
95
+
96
+ ## 문서
97
+
98
+ 현재 구조를 이해할 때는 아래 문서를 먼저 보는 편이 좋습니다.
99
+
100
+ - [Overview](docs/index.md)
101
+ - [Architecture](docs/architecture.md)
102
+ - [Domain Model](docs/domain-model.md)
103
+ - [Package Map](docs/package-map.md)
104
+ - [Runtime Flow](docs/runtime-flow.md)
105
+ - [Extension Guide](docs/extension-guide.md)
106
+
107
+ 읽기 순서 추천:
108
+
109
+ 1. `src/domain_agent/domain/models.py`
110
+ 2. `docs/domain-model.md`
111
+ 3. `src/domain_agent/application/dto.py`
112
+ 4. `src/domain_agent/application/ports.py`
113
+ 5. `src/domain_agent/workflow/graph.py`
114
+ 6. `src/domain_agent/workflow/nodes/deterministic.py`
115
+ 7. `src/domain_agent/application/services.py`
116
+ 8. `src/domain_agent/interfaces/cli_demo.py`
117
+
118
+ ## 현재 구조 요약
119
+
120
+ generic core:
121
+ - `src/domain_agent`
122
+
123
+ example apps:
124
+ - `examples/autonomous_digest`
125
+ - `examples/operational_change`
126
+ - `examples/mock_api`
127
+
128
+ 현재 human-in-the-loop 메커니즘은 LangGraph interrupt/resume에 위임되어 있습니다.
129
+ 기본 workflow는 human review를 켜거나 끌 수 있고, review가 필요한 경우에만 `ReviewPacket`으로 pause합니다. review를 끄면 같은 lifecycle을 자동 review result로 통과합니다.
130
+
131
+ 현재 core workflow는 아래 단계를 가집니다.
132
+
133
+ - `validate_request`
134
+ - `collect_context`
135
+ - `prepare_agent_work`
136
+ - `resolve_review`
137
+ - `execute_action`
138
+ - `close_request`
139
+
140
+ ## 도메인 모델
141
+
142
+ 현재 도메인 모델의 중심은 `Request` aggregate입니다.
143
+
144
+ 핵심 타입:
145
+
146
+ - `Request`
147
+ - `RequestStatus`
148
+ - `RiskLevel`
149
+ - `Proposal`
150
+ - `AgentPlan`
151
+ - `PlannedAction`
152
+ - `ReviewDecision`
153
+ - `ActionReviewDecision`
154
+ - `PlanReviewResult`
155
+
156
+ 의미:
157
+
158
+ - `Request`는 lifecycle과 review 결과를 소유하는 aggregate root입니다.
159
+ - `Proposal`은 review 대상인 human-readable summary입니다.
160
+ - `AgentPlan`은 실행 가능한 action plan입니다.
161
+ - `PlanReviewResult`는 plan-level 결과와 action-level 결과를 함께 묶습니다.
162
+
163
+ 주요 invariants:
164
+
165
+ - `PROPOSED` 이후 상태는 반드시 `Proposal`이 있어야 함
166
+ - `APPROVED`, `REJECTED`, `EXECUTED`는 반드시 `ReviewDecision`이 있어야 함
167
+ - action review는 planned action 전체를 정확히 덮어야 함
168
+ - reject된 request는 실행할 수 없음
169
+ - execute는 positive review 이후에만 가능
170
+
171
+ 상세 설명은 [Domain Model](docs/domain-model.md) 문서를 참고하면 됩니다.
172
+
173
+ ## 테스트
174
+
175
+ generic package:
176
+
177
+ ```bash
178
+ uv run pytest -q tests
179
+ ```
180
+
181
+ example apps:
182
+
183
+ ```bash
184
+ uv run pytest -q examples/autonomous_digest/tests
185
+ uv run pytest -q examples/operational_change/tests
186
+ uv run pytest -q examples/mock_api/tests
187
+ ```
188
+
189
+ ## Example Variants
190
+
191
+ | Example | Human review | Purpose |
192
+ | --- | --- | --- |
193
+ | `examples/autonomous_digest` | disabled | show the same core in autonomous mode |
194
+ | `examples/operational_change` | enabled | show a review-heavy operational workflow |
195
+ | `examples/mock_api` | enabled | show a reviewable flow with a fake external API |
196
+
197
+ 정적 검사:
198
+
199
+ ```bash
200
+ uv run ruff check src tests examples/operational_change examples/mock_api
201
+ uv run mypy src
202
+ ```
203
+
204
+ ## 문서 사이트
205
+
206
+ Python 생태계 쪽 도구를 그대로 쓰기 위해 `MkDocs + mkdocstrings` 구성을 추가했습니다.
207
+
208
+ 설치:
209
+
210
+ ```bash
211
+ make docs-sync
212
+ ```
213
+
214
+ 실행:
215
+
216
+ ```bash
217
+ make docs
218
+ ```
219
+
220
+ 정적 빌드:
221
+
222
+ ```bash
223
+ make docs-build
224
+ ```
225
+
226
+ 설정 파일:
227
+ - `mkdocs.yml`
228
+
229
+ ## 배포 자동화
230
+
231
+ PyPI 배포 workflow:
232
+ - `.github/workflows/release.yml`
233
+
234
+ 동작 방식:
235
+
236
+ 1. GitHub Release publish
237
+ 2. `.python-version` 기준 Python setup 후 `uv build`
238
+ 3. `pypa/gh-action-pypi-publish`로 PyPI 업로드
239
+
240
+ 전제 조건:
241
+
242
+ - PyPI Trusted Publisher 등록
243
+ - project name: `ddd-agent`
244
+ - repository: `seungbaeji/domain-agent-template`
245
+ - workflow filename: `release.yml`
@@ -0,0 +1,201 @@
1
+ # ddd-agent
2
+
3
+ LangGraph와 LangChain을 적용하기 쉬운 DDD-friendly Python agent 템플릿입니다.
4
+
5
+ 이 저장소는 "LangGraph를 쓰는 샘플"이 아니라, 다음을 분리해서 유지하는 reusable core를 목표로 합니다.
6
+
7
+ - 도메인 규칙
8
+ - review packet과 review result 같은 사람 개입 모델
9
+ - `AgentEngine` 포트를 통한 agent reasoning 결과 생성
10
+ - LangGraph workflow orchestration
11
+ - LangChain LCEL 기반 `AgentEngine` adapter
12
+ - CLI 기반 human review 데모
13
+ - 외부 example app
14
+
15
+ ## 핵심 포인트
16
+
17
+ - 패키지 이름: `ddd-agent`
18
+ - import 패키지: `domain_agent`
19
+ - Python: `3.11+`
20
+ - 패키징: `uv`
21
+ - workflow orchestration: `LangGraph`
22
+ - 현재 사람 개입 흐름: `optional human review`
23
+ - 포함된 CLI:
24
+ - `domain-agent-demo`
25
+ - `domain-agent-graph`
26
+
27
+ ## 빠른 실행
28
+
29
+ ```bash
30
+ uv sync
31
+ uv run domain-agent-demo
32
+ ```
33
+
34
+ workflow graph 확인:
35
+
36
+ ```bash
37
+ uv run domain-agent-graph --format mermaid
38
+ ```
39
+
40
+ 패키지 빌드:
41
+
42
+ ```bash
43
+ uv build
44
+ ```
45
+
46
+ PyPI 배포:
47
+
48
+ - GitHub Release를 `published` 상태로 만들면 `.github/workflows/release.yml`이 실행됩니다.
49
+ - workflow는 `uv build` 후 Trusted Publishing으로 `ddd-agent`를 PyPI에 업로드합니다.
50
+ - PyPI 쪽 publisher 설정의 project name은 반드시 `ddd-agent`여야 합니다.
51
+
52
+ ## 문서
53
+
54
+ 현재 구조를 이해할 때는 아래 문서를 먼저 보는 편이 좋습니다.
55
+
56
+ - [Overview](docs/index.md)
57
+ - [Architecture](docs/architecture.md)
58
+ - [Domain Model](docs/domain-model.md)
59
+ - [Package Map](docs/package-map.md)
60
+ - [Runtime Flow](docs/runtime-flow.md)
61
+ - [Extension Guide](docs/extension-guide.md)
62
+
63
+ 읽기 순서 추천:
64
+
65
+ 1. `src/domain_agent/domain/models.py`
66
+ 2. `docs/domain-model.md`
67
+ 3. `src/domain_agent/application/dto.py`
68
+ 4. `src/domain_agent/application/ports.py`
69
+ 5. `src/domain_agent/workflow/graph.py`
70
+ 6. `src/domain_agent/workflow/nodes/deterministic.py`
71
+ 7. `src/domain_agent/application/services.py`
72
+ 8. `src/domain_agent/interfaces/cli_demo.py`
73
+
74
+ ## 현재 구조 요약
75
+
76
+ generic core:
77
+ - `src/domain_agent`
78
+
79
+ example apps:
80
+ - `examples/autonomous_digest`
81
+ - `examples/operational_change`
82
+ - `examples/mock_api`
83
+
84
+ 현재 human-in-the-loop 메커니즘은 LangGraph interrupt/resume에 위임되어 있습니다.
85
+ 기본 workflow는 human review를 켜거나 끌 수 있고, review가 필요한 경우에만 `ReviewPacket`으로 pause합니다. review를 끄면 같은 lifecycle을 자동 review result로 통과합니다.
86
+
87
+ 현재 core workflow는 아래 단계를 가집니다.
88
+
89
+ - `validate_request`
90
+ - `collect_context`
91
+ - `prepare_agent_work`
92
+ - `resolve_review`
93
+ - `execute_action`
94
+ - `close_request`
95
+
96
+ ## 도메인 모델
97
+
98
+ 현재 도메인 모델의 중심은 `Request` aggregate입니다.
99
+
100
+ 핵심 타입:
101
+
102
+ - `Request`
103
+ - `RequestStatus`
104
+ - `RiskLevel`
105
+ - `Proposal`
106
+ - `AgentPlan`
107
+ - `PlannedAction`
108
+ - `ReviewDecision`
109
+ - `ActionReviewDecision`
110
+ - `PlanReviewResult`
111
+
112
+ 의미:
113
+
114
+ - `Request`는 lifecycle과 review 결과를 소유하는 aggregate root입니다.
115
+ - `Proposal`은 review 대상인 human-readable summary입니다.
116
+ - `AgentPlan`은 실행 가능한 action plan입니다.
117
+ - `PlanReviewResult`는 plan-level 결과와 action-level 결과를 함께 묶습니다.
118
+
119
+ 주요 invariants:
120
+
121
+ - `PROPOSED` 이후 상태는 반드시 `Proposal`이 있어야 함
122
+ - `APPROVED`, `REJECTED`, `EXECUTED`는 반드시 `ReviewDecision`이 있어야 함
123
+ - action review는 planned action 전체를 정확히 덮어야 함
124
+ - reject된 request는 실행할 수 없음
125
+ - execute는 positive review 이후에만 가능
126
+
127
+ 상세 설명은 [Domain Model](docs/domain-model.md) 문서를 참고하면 됩니다.
128
+
129
+ ## 테스트
130
+
131
+ generic package:
132
+
133
+ ```bash
134
+ uv run pytest -q tests
135
+ ```
136
+
137
+ example apps:
138
+
139
+ ```bash
140
+ uv run pytest -q examples/autonomous_digest/tests
141
+ uv run pytest -q examples/operational_change/tests
142
+ uv run pytest -q examples/mock_api/tests
143
+ ```
144
+
145
+ ## Example Variants
146
+
147
+ | Example | Human review | Purpose |
148
+ | --- | --- | --- |
149
+ | `examples/autonomous_digest` | disabled | show the same core in autonomous mode |
150
+ | `examples/operational_change` | enabled | show a review-heavy operational workflow |
151
+ | `examples/mock_api` | enabled | show a reviewable flow with a fake external API |
152
+
153
+ 정적 검사:
154
+
155
+ ```bash
156
+ uv run ruff check src tests examples/operational_change examples/mock_api
157
+ uv run mypy src
158
+ ```
159
+
160
+ ## 문서 사이트
161
+
162
+ Python 생태계 쪽 도구를 그대로 쓰기 위해 `MkDocs + mkdocstrings` 구성을 추가했습니다.
163
+
164
+ 설치:
165
+
166
+ ```bash
167
+ make docs-sync
168
+ ```
169
+
170
+ 실행:
171
+
172
+ ```bash
173
+ make docs
174
+ ```
175
+
176
+ 정적 빌드:
177
+
178
+ ```bash
179
+ make docs-build
180
+ ```
181
+
182
+ 설정 파일:
183
+ - `mkdocs.yml`
184
+
185
+ ## 배포 자동화
186
+
187
+ PyPI 배포 workflow:
188
+ - `.github/workflows/release.yml`
189
+
190
+ 동작 방식:
191
+
192
+ 1. GitHub Release publish
193
+ 2. `.python-version` 기준 Python setup 후 `uv build`
194
+ 3. `pypa/gh-action-pypi-publish`로 PyPI 업로드
195
+
196
+ 전제 조건:
197
+
198
+ - PyPI Trusted Publisher 등록
199
+ - project name: `ddd-agent`
200
+ - repository: `seungbaeji/domain-agent-template`
201
+ - workflow filename: `release.yml`
@@ -0,0 +1,101 @@
1
+ [project]
2
+ name = "ddd-agent"
3
+ version = "0.1.0"
4
+ description = "DDD-friendly Python agent template for LangGraph and LangChain applications."
5
+ readme = "README.md"
6
+ requires-python = ">=3.11"
7
+ license = { file = "LICENSE" }
8
+ authors = [
9
+ { name = "Seungbae Ji" },
10
+ ]
11
+ keywords = ["agent", "langgraph", "langchain", "ddd", "workflow"]
12
+ classifiers = [
13
+ "Development Status :: 3 - Alpha",
14
+ "Intended Audience :: Developers",
15
+ "License :: OSI Approved :: MIT License",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3.11",
18
+ "Programming Language :: Python :: 3.12",
19
+ "Programming Language :: Python :: 3.13",
20
+ "Topic :: Software Development :: Libraries :: Python Modules",
21
+ ]
22
+ dependencies = [
23
+ "langchain-core>=1.0.0",
24
+ "langgraph>=0.2.0",
25
+ ]
26
+
27
+ [project.urls]
28
+ Homepage = "https://github.com/seungbaeji/domain-agent-template"
29
+ Repository = "https://github.com/seungbaeji/domain-agent-template"
30
+ Issues = "https://github.com/seungbaeji/domain-agent-template/issues"
31
+
32
+ [project.scripts]
33
+ domain-agent-demo = "domain_agent.interfaces.cli_demo:main"
34
+ domain-agent-graph = "domain_agent.interfaces.cli_graph:main"
35
+
36
+ [dependency-groups]
37
+ dev = [
38
+ "build>=1.2.2",
39
+ "mypy>=1.11.0",
40
+ "pytest>=8.3.0",
41
+ "ruff>=0.6.0",
42
+ ]
43
+ docs = [
44
+ "mkdocs>=1.6.0",
45
+ "mkdocs-material>=9.5.0",
46
+ "mkdocs-mermaid2-plugin>=1.2.1",
47
+ "mkdocstrings[python]>=0.26.0",
48
+ ]
49
+
50
+ [build-system]
51
+ requires = ["hatchling>=1.25.0"]
52
+ build-backend = "hatchling.build"
53
+
54
+ [tool.hatch.build.targets.wheel]
55
+ packages = ["src/domain_agent"]
56
+
57
+ [tool.hatch.build.targets.sdist]
58
+ include = [
59
+ "/LICENSE",
60
+ "/README.md",
61
+ "/pyproject.toml",
62
+ "/src/domain_agent",
63
+ ]
64
+
65
+ [tool.pytest.ini_options]
66
+ minversion = "8.0"
67
+ testpaths = ["tests"]
68
+ pythonpath = ["src"]
69
+ addopts = [
70
+ "-ra",
71
+ "--strict-config",
72
+ "--strict-markers",
73
+ ]
74
+
75
+ [tool.ruff]
76
+ target-version = "py311"
77
+ line-length = 100
78
+ src = ["src", "tests"]
79
+
80
+ [tool.ruff.lint]
81
+ select = [
82
+ "E",
83
+ "F",
84
+ "I",
85
+ "B",
86
+ "UP",
87
+ ]
88
+
89
+ [tool.ruff.format]
90
+ quote-style = "double"
91
+ indent-style = "space"
92
+
93
+ [tool.mypy]
94
+ python_version = "3.11"
95
+ mypy_path = "src"
96
+ packages = ["domain_agent"]
97
+ strict = true
98
+ warn_unused_configs = true
99
+
100
+ [tool.uv]
101
+ package = true
@@ -0,0 +1,12 @@
1
+ """DDD-friendly agent template package."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from importlib.metadata import PackageNotFoundError, version
6
+
7
+ try:
8
+ __version__ = version("ddd-agent")
9
+ except PackageNotFoundError:
10
+ __version__ = "0.0.0"
11
+
12
+ __all__ = ["__version__"]
@@ -0,0 +1 @@
1
+ """Application layer package."""
@@ -0,0 +1,74 @@
1
+ """Application-layer data structures."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from dataclasses import dataclass
6
+
7
+ from domain_agent.domain import (
8
+ ActionReviewDecision,
9
+ AgentPlan,
10
+ PlannedAction,
11
+ Proposal,
12
+ Request,
13
+ RiskLevel,
14
+ )
15
+
16
+
17
+ @dataclass(frozen=True)
18
+ class AnalysisResult:
19
+ """Structured analysis output used to build a proposal."""
20
+
21
+ summary: str
22
+ rationale: str
23
+ execution_steps: tuple[str, ...]
24
+ risk_level: RiskLevel
25
+
26
+
27
+ @dataclass(frozen=True)
28
+ class AgentWorkResult:
29
+ """Structured output returned by an agent engine."""
30
+
31
+ analysis: AnalysisResult
32
+ proposal: Proposal
33
+ agent_plan: AgentPlan | None = None
34
+
35
+
36
+ @dataclass(frozen=True)
37
+ class ReviewPacket:
38
+ """Structured payload presented to a human reviewer."""
39
+
40
+ request_id: str
41
+ requester_id: str
42
+ request_summary: str
43
+ proposal_summary: str
44
+ rationale: str
45
+ risk_level: RiskLevel
46
+ execution_steps: tuple[str, ...]
47
+ planned_actions: tuple[PlannedAction, ...]
48
+ action_decisions: tuple[ActionReviewDecision, ...] = ()
49
+
50
+
51
+ def build_review_packet(request: Request, proposal: Proposal) -> ReviewPacket:
52
+ """Create a structured review packet from the request and proposal."""
53
+ planned_actions: tuple[PlannedAction, ...]
54
+ if proposal.agent_plan is not None:
55
+ planned_actions = proposal.agent_plan.actions
56
+ else:
57
+ planned_actions = (
58
+ PlannedAction(
59
+ action_id="plan-review",
60
+ tool_name="plan_review",
61
+ description="Review the overall proposal as a single action.",
62
+ ),
63
+ )
64
+
65
+ return ReviewPacket(
66
+ request_id=request.request_id,
67
+ requester_id=request.requester_id,
68
+ request_summary=request.summary,
69
+ proposal_summary=proposal.summary,
70
+ rationale=proposal.rationale,
71
+ risk_level=proposal.risk_level,
72
+ execution_steps=proposal.execution_steps,
73
+ planned_actions=planned_actions,
74
+ )