dagent-ai 0.2.1__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.
- dagent_ai-0.2.1/LICENSE +201 -0
- dagent_ai-0.2.1/PKG-INFO +421 -0
- dagent_ai-0.2.1/README.md +399 -0
- dagent_ai-0.2.1/dagent/__init__.py +90 -0
- dagent_ai-0.2.1/dagent/agent.py +89 -0
- dagent_ai-0.2.1/dagent/capabilities/__init__.py +42 -0
- dagent_ai-0.2.1/dagent/capabilities/bootstrap.py +28 -0
- dagent_ai-0.2.1/dagent/capabilities/boundaries.py +32 -0
- dagent_ai-0.2.1/dagent/capabilities/catalog.py +131 -0
- dagent_ai-0.2.1/dagent/capabilities/decorator.py +207 -0
- dagent_ai-0.2.1/dagent/capabilities/mcp/__init__.py +103 -0
- dagent_ai-0.2.1/dagent/capabilities/mcp/config.py +53 -0
- dagent_ai-0.2.1/dagent/capabilities/mcp/errors.py +27 -0
- dagent_ai-0.2.1/dagent/capabilities/mcp/handlers.py +100 -0
- dagent_ai-0.2.1/dagent/capabilities/mcp/manager.py +115 -0
- dagent_ai-0.2.1/dagent/capabilities/mcp/schema.py +86 -0
- dagent_ai-0.2.1/dagent/capabilities/mcp/server_task.py +96 -0
- dagent_ai-0.2.1/dagent/capabilities/providers.py +431 -0
- dagent_ai-0.2.1/dagent/capabilities/skills.py +700 -0
- dagent_ai-0.2.1/dagent/capabilities/tools/__init__.py +6 -0
- dagent_ai-0.2.1/dagent/capabilities/tools/boundary.py +147 -0
- dagent_ai-0.2.1/dagent/capabilities/tools/command_tools.py +74 -0
- dagent_ai-0.2.1/dagent/capabilities/tools/file_tools.py +110 -0
- dagent_ai-0.2.1/dagent/capabilities/tools/registry.py +65 -0
- dagent_ai-0.2.1/dagent/capabilities/toolsets.py +233 -0
- dagent_ai-0.2.1/dagent/capabilities/workspace.py +27 -0
- dagent_ai-0.2.1/dagent/config.py +82 -0
- dagent_ai-0.2.1/dagent/dag_builder.py +375 -0
- dagent_ai-0.2.1/dagent/harness_runtime/__init__.py +60 -0
- dagent_ai-0.2.1/dagent/harness_runtime/artifacts.py +187 -0
- dagent_ai-0.2.1/dagent/harness_runtime/capability_executor.py +82 -0
- dagent_ai-0.2.1/dagent/harness_runtime/capability_scope.py +16 -0
- dagent_ai-0.2.1/dagent/harness_runtime/dag_agent.py +1257 -0
- dagent_ai-0.2.1/dagent/harness_runtime/dag_builder.py +544 -0
- dagent_ai-0.2.1/dagent/harness_runtime/dag_executor.py +615 -0
- dagent_ai-0.2.1/dagent/harness_runtime/feedback_learner.py +39 -0
- dagent_ai-0.2.1/dagent/harness_runtime/profiled_agent.py +74 -0
- dagent_ai-0.2.1/dagent/harness_runtime/runtime.py +585 -0
- dagent_ai-0.2.1/dagent/harness_runtime/runtime_events.py +100 -0
- dagent_ai-0.2.1/dagent/harness_runtime/runtime_session.py +123 -0
- dagent_ai-0.2.1/dagent/harness_runtime/task_record.py +131 -0
- dagent_ai-0.2.1/dagent/harness_runtime/tool_agent.py +699 -0
- dagent_ai-0.2.1/dagent/harness_runtime/validator_agent.py +95 -0
- dagent_ai-0.2.1/dagent/profiles.py +90 -0
- dagent_ai-0.2.1/dagent/providers/__init__.py +15 -0
- dagent_ai-0.2.1/dagent/providers/base.py +43 -0
- dagent_ai-0.2.1/dagent/providers/mock.py +37 -0
- dagent_ai-0.2.1/dagent/providers/openai_compatible.py +161 -0
- dagent_ai-0.2.1/dagent/resources/__init__.py +1 -0
- dagent_ai-0.2.1/dagent/resources/profiles/__init__.py +1 -0
- dagent_ai-0.2.1/dagent/resources/profiles/conversation.md +23 -0
- dagent_ai-0.2.1/dagent/resources/profiles/dag_agent.md +107 -0
- dagent_ai-0.2.1/dagent/resources/profiles/feedback_learner.md +10 -0
- dagent_ai-0.2.1/dagent/resources/profiles/validator_agent.md +43 -0
- dagent_ai-0.2.1/dagent/result.py +353 -0
- dagent_ai-0.2.1/dagent/review.py +91 -0
- dagent_ai-0.2.1/dagent/runner.py +1161 -0
- dagent_ai-0.2.1/dagent/schemas/__init__.py +71 -0
- dagent_ai-0.2.1/dagent/schemas/artifact.py +30 -0
- dagent_ai-0.2.1/dagent/schemas/capability.py +106 -0
- dagent_ai-0.2.1/dagent/schemas/common.py +38 -0
- dagent_ai-0.2.1/dagent/schemas/dag.py +88 -0
- dagent_ai-0.2.1/dagent/schemas/edge.py +12 -0
- dagent_ai-0.2.1/dagent/schemas/feedback.py +22 -0
- dagent_ai-0.2.1/dagent/schemas/node.py +50 -0
- dagent_ai-0.2.1/dagent/schemas/results.py +62 -0
- dagent_ai-0.2.1/dagent/schemas/run_trace.py +176 -0
- dagent_ai-0.2.1/dagent/schemas/value.py +105 -0
- dagent_ai-0.2.1/dagent/state/__init__.py +6 -0
- dagent_ai-0.2.1/dagent/state/prompt_builder.py +64 -0
- dagent_ai-0.2.1/dagent_ai.egg-info/PKG-INFO +421 -0
- dagent_ai-0.2.1/dagent_ai.egg-info/SOURCES.txt +103 -0
- dagent_ai-0.2.1/dagent_ai.egg-info/dependency_links.txt +1 -0
- dagent_ai-0.2.1/dagent_ai.egg-info/requires.txt +14 -0
- dagent_ai-0.2.1/dagent_ai.egg-info/top_level.txt +1 -0
- dagent_ai-0.2.1/pyproject.toml +40 -0
- dagent_ai-0.2.1/setup.cfg +4 -0
- dagent_ai-0.2.1/tests/test_agent_sdk_public_api.py +654 -0
- dagent_ai-0.2.1/tests/test_api.py +1225 -0
- dagent_ai-0.2.1/tests/test_architecture_boundaries.py +145 -0
- dagent_ai-0.2.1/tests/test_capabilities.py +169 -0
- dagent_ai-0.2.1/tests/test_capability_bootstrap.py +91 -0
- dagent_ai-0.2.1/tests/test_capability_providers.py +346 -0
- dagent_ai-0.2.1/tests/test_config.py +60 -0
- dagent_ai-0.2.1/tests/test_dag_artifacts.py +727 -0
- dagent_ai-0.2.1/tests/test_dag_builder_sdk.py +582 -0
- dagent_ai-0.2.1/tests/test_dag_executor.py +609 -0
- dagent_ai-0.2.1/tests/test_dag_validation.py +460 -0
- dagent_ai-0.2.1/tests/test_harness_flow.py +917 -0
- dagent_ai-0.2.1/tests/test_harness_runtime.py +1084 -0
- dagent_ai-0.2.1/tests/test_mcp_provider.py +223 -0
- dagent_ai-0.2.1/tests/test_mcp_schema.py +47 -0
- dagent_ai-0.2.1/tests/test_minimax_integration.py +50 -0
- dagent_ai-0.2.1/tests/test_openai_compatible_provider.py +132 -0
- dagent_ai-0.2.1/tests/test_profiled_agent.py +16 -0
- dagent_ai-0.2.1/tests/test_profiled_agents.py +92 -0
- dagent_ai-0.2.1/tests/test_profiles.py +49 -0
- dagent_ai-0.2.1/tests/test_prompt_builder.py +71 -0
- dagent_ai-0.2.1/tests/test_run_trace.py +198 -0
- dagent_ai-0.2.1/tests/test_runner_capability_registration.py +307 -0
- dagent_ai-0.2.1/tests/test_runtime_task_record.py +58 -0
- dagent_ai-0.2.1/tests/test_sdk_capability.py +139 -0
- dagent_ai-0.2.1/tests/test_skill_provider.py +300 -0
- dagent_ai-0.2.1/tests/test_tool_agent.py +474 -0
- dagent_ai-0.2.1/tests/test_tools.py +280 -0
dagent_ai-0.2.1/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
https://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
dagent_ai-0.2.1/PKG-INFO
ADDED
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dagent-ai
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Human-reviewed Agent DAG framework
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Requires-Python: >=3.11
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: openai>=1.0
|
|
10
|
+
Requires-Dist: pydantic>=2.0
|
|
11
|
+
Requires-Dist: pyyaml>=6.0
|
|
12
|
+
Provides-Extra: dev
|
|
13
|
+
Requires-Dist: fastapi>=0.115; extra == "dev"
|
|
14
|
+
Requires-Dist: httpx[socks]>=0.28.1; extra == "dev"
|
|
15
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
|
|
16
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
17
|
+
Requires-Dist: python-multipart>=0.0.20; extra == "dev"
|
|
18
|
+
Requires-Dist: uvicorn[standard]>=0.32; extra == "dev"
|
|
19
|
+
Provides-Extra: mcp
|
|
20
|
+
Requires-Dist: mcp<2,>=1; extra == "mcp"
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# dagent
|
|
24
|
+
|
|
25
|
+
> **Plan globally. Re-plan locally.**
|
|
26
|
+
|
|
27
|
+
**dagent** is a *Dynamic DAG Agent* framework. It can automatically route a
|
|
28
|
+
request, run it through a bounded tool-using agent, or use a planner that creates
|
|
29
|
+
and executes a reviewable capability-node DAG. Each public agent object is
|
|
30
|
+
declarative configuration, while `Runner` owns the runtime session, capability
|
|
31
|
+
catalog, review continuations, and execution state.
|
|
32
|
+
|
|
33
|
+
Traditional agent frameworks choose one of two extremes: a free-running ReAct loop with
|
|
34
|
+
no structure, or a rigid static pipeline with no adaptability. dagent rejects both. Every
|
|
35
|
+
task that needs orchestration gets a reviewable, auditable plan up front. That plan
|
|
36
|
+
can evolve from DAG observations as execution proceeds, while completed tool results
|
|
37
|
+
remain structured execution records.
|
|
38
|
+
|
|
39
|
+
> **Design origin:** The self-planning dynamic DAG agent loop - capability-node DAG with
|
|
40
|
+
> three-level incremental re-planning, Trace DB as the long-term context boundary,
|
|
41
|
+
> human review checkpoints, DAG-vs-tool task routing, and resumable execution - was
|
|
42
|
+
> conceived and first implemented by the author of this repository. First committed:
|
|
43
|
+
> **2026-05-01**.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Core Ideas
|
|
48
|
+
|
|
49
|
+
**1. Reviewable plans, not opaque loops.**
|
|
50
|
+
Tasks that need orchestration become capability-node DAGs before execution. The
|
|
51
|
+
plan is typed, inspectable, and can pause for human review before risky work runs.
|
|
52
|
+
|
|
53
|
+
**2. Typed nodes with direct capability calls.**
|
|
54
|
+
Every DAG node has a typed `payload`. Capability nodes wrap a
|
|
55
|
+
`CapabilityInvocation`; start nodes are explicit and do not carry fake tool
|
|
56
|
+
calls. The runtime executes capabilities through a shared `CapabilityExecutor`.
|
|
57
|
+
|
|
58
|
+
**3. Structured parameter passing between nodes.**
|
|
59
|
+
Static DAG arguments can reference graph input, upstream node results, and
|
|
60
|
+
artifact paths. These references are structured `$expr` bindings in `DAGSpec`,
|
|
61
|
+
resolved immediately before a capability call. A node that reads another node's
|
|
62
|
+
output must explicitly depend on it.
|
|
63
|
+
|
|
64
|
+
**4. Re-planning stays local.**
|
|
65
|
+
After each executable DAG layer, the planner receives a DAG observation and can
|
|
66
|
+
return `NO_CHANGE`, a revised PlanSpec, or a final answer. Completed node results
|
|
67
|
+
stay as structured execution records instead of being rediscovered from chat
|
|
68
|
+
history.
|
|
69
|
+
|
|
70
|
+
**5. Runner owns runtime state.**
|
|
71
|
+
Public `AutoAgent`, `ToolAgent`, `DagAgent`, and `Dag` objects are declarative
|
|
72
|
+
configuration. `Runner` owns the provider, capability catalog, session state,
|
|
73
|
+
review continuations, and execution dispatch.
|
|
74
|
+
|
|
75
|
+
**6. Safety is part of execution, not prompting.**
|
|
76
|
+
The DAG planner proposes work, but capability handlers enforce boundaries before
|
|
77
|
+
side effects. Medium/high-risk work can require review; disabled or unknown
|
|
78
|
+
capabilities fail closed; file boundaries reject path escape.
|
|
79
|
+
|
|
80
|
+
## Quick Start
|
|
81
|
+
|
|
82
|
+
Install the PyPI package as `dagent-ai`; import it in Python as `dagent`:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pip install dagent-ai
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Pass SDK configuration explicitly to the runner:
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
import dagent
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
@dagent.tool
|
|
95
|
+
def search(q: str) -> str:
|
|
96
|
+
return f"found:{q}"
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
provider = dagent.Provider(
|
|
100
|
+
base_url="https://api.openai.com/v1",
|
|
101
|
+
model="your-model",
|
|
102
|
+
api_key_env="OPENAI_API_KEY",
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
runner = dagent.Runner(
|
|
106
|
+
workspace=".",
|
|
107
|
+
provider=provider,
|
|
108
|
+
capabilities=[search],
|
|
109
|
+
mcp_servers={
|
|
110
|
+
"fs": {
|
|
111
|
+
"command": "npx",
|
|
112
|
+
"args": ["-y", "@modelcontextprotocol/server-filesystem", "."],
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
skill_roots=["team-skills"],
|
|
116
|
+
profile_root="profiles",
|
|
117
|
+
)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Use `Runner.from_config(...)` when provider settings, MCP servers, validation,
|
|
121
|
+
or profile directories should come from a config file:
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
runner = dagent.Runner.from_config("config.yaml", workspace=".", capabilities=[search])
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The same capability types can be added after runner construction:
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
@dagent.tool
|
|
131
|
+
def summarize(text: str) -> str:
|
|
132
|
+
return text.split(".")[0]
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
runner = dagent.Runner(provider=provider, workspace=".")
|
|
136
|
+
runner.add_tool(summarize)
|
|
137
|
+
runner.add_mcp_server(
|
|
138
|
+
"fs",
|
|
139
|
+
{
|
|
140
|
+
"command": "npx",
|
|
141
|
+
"args": ["-y", "@modelcontextprotocol/server-filesystem", "."],
|
|
142
|
+
},
|
|
143
|
+
)
|
|
144
|
+
runner.add_skill_root("more-skills")
|
|
145
|
+
runner.skill_store.install(
|
|
146
|
+
"Keep every answer compact.",
|
|
147
|
+
name="terse",
|
|
148
|
+
description="Compact response style.",
|
|
149
|
+
category="writing",
|
|
150
|
+
)
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Runtime MCP registrations can be replaced or removed without touching agent
|
|
154
|
+
configuration:
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
runner.replace_mcp_server(
|
|
158
|
+
"fs",
|
|
159
|
+
{
|
|
160
|
+
"command": "npx",
|
|
161
|
+
"args": ["-y", "@modelcontextprotocol/server-filesystem", "docs"],
|
|
162
|
+
},
|
|
163
|
+
)
|
|
164
|
+
runner.remove_mcp_server("fs")
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Python tools are exposed as `tool.<name>` capabilities. MCP stdio server tools
|
|
168
|
+
are exposed as `mcp.<server>.<tool>` and require the MCP optional extra. Skill
|
|
169
|
+
roots are available through the built-in `skill.list` and `skill.view`
|
|
170
|
+
capabilities. Agents use `skills=[...]` to limit which concrete skills those
|
|
171
|
+
accessors can see.
|
|
172
|
+
|
|
173
|
+
Built-in profiles are packaged resources. Use them by name on agents, or read
|
|
174
|
+
them directly when you need to inspect the prompt:
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
agent = dagent.ToolAgent(profile="conversation")
|
|
178
|
+
profile = dagent.load_builtin_profile("conversation")
|
|
179
|
+
available = dagent.list_builtin_profiles()
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Run an `AutoAgent` when the runtime should choose direct tool use or a dynamic
|
|
183
|
+
DAG per request:
|
|
184
|
+
|
|
185
|
+
```python
|
|
186
|
+
import asyncio
|
|
187
|
+
|
|
188
|
+
import dagent
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
@dagent.tool
|
|
192
|
+
def search(q: str) -> str:
|
|
193
|
+
return f"found:{q}"
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
async def main():
|
|
197
|
+
runner = dagent.Runner(provider=provider, workspace=".", capabilities=[search])
|
|
198
|
+
agent = dagent.AutoAgent(capabilities=["tool.search"], skills=["writing/terse"])
|
|
199
|
+
|
|
200
|
+
result = await runner.run(agent, "Answer directly or plan if orchestration helps.")
|
|
201
|
+
print(result.kind)
|
|
202
|
+
print(result.output_text)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
asyncio.run(main())
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Run a `ToolAgent` for bounded tool-loop work:
|
|
209
|
+
|
|
210
|
+
```python
|
|
211
|
+
import asyncio
|
|
212
|
+
|
|
213
|
+
import dagent
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
@dagent.tool
|
|
217
|
+
def echo(text: str) -> str:
|
|
218
|
+
return f"echo:{text}"
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
async def main():
|
|
222
|
+
runner = dagent.Runner(provider=provider, workspace=".", capabilities=[echo])
|
|
223
|
+
agent = dagent.ToolAgent(
|
|
224
|
+
profile="conversation",
|
|
225
|
+
capabilities=["tool.echo"],
|
|
226
|
+
skills=["writing/terse"],
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
result = await runner.run(agent, "Use echo to respond with hello.")
|
|
230
|
+
print(result.output_text)
|
|
231
|
+
print(result.model_dump(mode="json"))
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
asyncio.run(main())
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Run a `DagAgent` when the model should plan a reviewable DAG:
|
|
238
|
+
|
|
239
|
+
```python
|
|
240
|
+
import asyncio
|
|
241
|
+
|
|
242
|
+
import dagent
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
@dagent.tool
|
|
246
|
+
def search(q: str) -> str:
|
|
247
|
+
return f"found:{q}"
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
async def main():
|
|
251
|
+
runner = dagent.Runner(provider=provider, workspace=".", capabilities=[search])
|
|
252
|
+
agent = dagent.DagAgent(capabilities=["tool.search"], review="careful")
|
|
253
|
+
|
|
254
|
+
result = await runner.run(agent, "Research dagent and write a short note.")
|
|
255
|
+
if result.requires_review and result.review is not None:
|
|
256
|
+
result = await runner.resume(result.review.approve())
|
|
257
|
+
|
|
258
|
+
print(result.output_text)
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
asyncio.run(main())
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
Build a static `Dag` when the graph shape belongs in code:
|
|
265
|
+
|
|
266
|
+
```python
|
|
267
|
+
import asyncio
|
|
268
|
+
|
|
269
|
+
from pydantic import BaseModel
|
|
270
|
+
|
|
271
|
+
import dagent
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
class ResearchInput(BaseModel):
|
|
275
|
+
query: str
|
|
276
|
+
audience: str = "engineers"
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
class SearchResult(BaseModel):
|
|
280
|
+
title: str
|
|
281
|
+
url: str
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
@dagent.tool
|
|
285
|
+
def search(q: str) -> SearchResult:
|
|
286
|
+
return SearchResult(title=f"found:{q}", url="https://example.test")
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
@dagent.tool
|
|
290
|
+
def render(title: str, url: str, audience: str) -> str:
|
|
291
|
+
return f"{title} for {audience}: {url}"
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
async def main():
|
|
295
|
+
dag = dagent.Dag("research", input=ResearchInput)
|
|
296
|
+
found = dagent.Node("search", target=search, inputs={"q": dag.input.query})
|
|
297
|
+
rendered = dagent.Node(
|
|
298
|
+
"render",
|
|
299
|
+
target=render,
|
|
300
|
+
inputs={
|
|
301
|
+
"title": found.output.title,
|
|
302
|
+
"url": found.output.url,
|
|
303
|
+
"audience": dag.input.audience,
|
|
304
|
+
},
|
|
305
|
+
)
|
|
306
|
+
dag.add_node(found)
|
|
307
|
+
dag.add_node(rendered)
|
|
308
|
+
dag.add_edge(found, rendered)
|
|
309
|
+
|
|
310
|
+
dagent.validate_dag_spec(dag.to_dag_spec())
|
|
311
|
+
|
|
312
|
+
runner = dagent.Runner(provider=provider, workspace=".")
|
|
313
|
+
result = await runner.run(dag, input=ResearchInput(query="dagent"))
|
|
314
|
+
print(result.status)
|
|
315
|
+
print(result.node_output("render"))
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
asyncio.run(main())
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
`Runner.run(...)` always returns `RunResult`, including static `Dag` and
|
|
322
|
+
`DAGSpec` runs. Customize static DAGs with Pydantic graph inputs, typed tool
|
|
323
|
+
return values, explicit `dag.add_edge(...)` dependencies, artifact references, and
|
|
324
|
+
per-node boundaries. See the [Python SDK guide](docs/python-sdk.md) for the full
|
|
325
|
+
SDK.
|
|
326
|
+
|
|
327
|
+
Run examples:
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
uv run python -m examples.tool_agent
|
|
331
|
+
uv run python -m examples.auto_agent
|
|
332
|
+
uv run python -m examples.dynamic_dag_agent
|
|
333
|
+
uv run python -m examples.static_dag
|
|
334
|
+
uv run python -m examples.streaming
|
|
335
|
+
uv run python -m examples.runtime_registration_and_skills
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
Run the test suite:
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
uv run --extra dev pytest
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
Detailed SDK docs live in the [Python SDK guide](docs/python-sdk.md).
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
## Architecture
|
|
349
|
+
|
|
350
|
+
```mermaid
|
|
351
|
+
flowchart TD
|
|
352
|
+
U["User / SDK"] --> RUN["Runner"]
|
|
353
|
+
RUN --> HR["HarnessRuntime"]
|
|
354
|
+
HR -->|"AutoAgent routes to tool"| TA["ToolAgent"]
|
|
355
|
+
HR -->|"ToolAgent target"| TA
|
|
356
|
+
HR -->|"AutoAgent routes to DAG"| DA["DAGAgent"]
|
|
357
|
+
HR -->|"DagAgent target"| DA
|
|
358
|
+
HR -->|"Dag / DAGSpec target"| DS["DAGSpec"]
|
|
359
|
+
|
|
360
|
+
TA --> TAL["ToolAgentLoop"]
|
|
361
|
+
TAL -->|"capability call"| CE["CapabilityExecutor"]
|
|
362
|
+
|
|
363
|
+
DA --> DAL["DAGAgentLoop"]
|
|
364
|
+
DAL -->|"PlanSpec DSL"| DAG["DAG"]
|
|
365
|
+
DS -->|"compile"| DAG
|
|
366
|
+
DAG --> RG["Review Gate"]
|
|
367
|
+
RG --> DE["DAGExecutor"]
|
|
368
|
+
DE -->|"ready layer"| CE
|
|
369
|
+
CE --> CAT["Capability Catalog"]
|
|
370
|
+
CE --> RT["RunTrace + Artifacts"]
|
|
371
|
+
RT --> OBS["DAG Observation"]
|
|
372
|
+
OBS --> DAL
|
|
373
|
+
HR --> RR["RunResult"]
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
`Runner` is the public SDK entrypoint and owns the configured runtime, session,
|
|
377
|
+
and capability catalog. `HarnessRuntime` is the lower-level control layer for
|
|
378
|
+
routing, review continuations, optional result validation, and final response
|
|
379
|
+
delivery.
|
|
380
|
+
|
|
381
|
+
`AutoAgent` lets the runtime route each request to direct tool use or dynamic
|
|
382
|
+
DAG planning. `ToolAgent` delegates bounded tool-loop work to `ToolAgentLoop`.
|
|
383
|
+
`DAGAgent` delegates dynamic planning and fixed `DAGSpec` execution to
|
|
384
|
+
`DAGAgentLoop`. Both paths share `CapabilityExecutor`, so Python tools, MCP
|
|
385
|
+
tools, skill accessors, shell commands, file tools, memory, and agent
|
|
386
|
+
capabilities go through the same catalog and boundary enforcement.
|
|
387
|
+
|
|
388
|
+
`DAGExecutor` validates graph structure, resolves structured value expressions,
|
|
389
|
+
executes ready layers, updates artifact state, and returns a cumulative
|
|
390
|
+
`RunTrace`.
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
394
|
+
## Project Layout
|
|
395
|
+
|
|
396
|
+
```text
|
|
397
|
+
api/ local FastAPI backend for the WebUI
|
|
398
|
+
dagent/
|
|
399
|
+
capabilities/ capability catalog, providers, adapters, and built-in handlers
|
|
400
|
+
harness_runtime/ runtime orchestration, agent loops, validation, session state,
|
|
401
|
+
event adapters, DAG execution
|
|
402
|
+
providers/ OpenAI-compatible and mock chat providers
|
|
403
|
+
resources/ packaged default Markdown profiles
|
|
404
|
+
schemas/ DAG, node, edge, trace, feedback, result/outcome contracts
|
|
405
|
+
state/ prompt assembly
|
|
406
|
+
web/ React + Vite frontend
|
|
407
|
+
tests/ pytest suite
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
Key runtime contracts such as `RunTrace`, `LoopOutcome`, `RuntimeResponse`,
|
|
411
|
+
`PendingReview`, and validation result types live in `dagent/schemas`.
|
|
412
|
+
`harness_runtime` owns behavior; `schemas` owns shared data contracts.
|
|
413
|
+
|
|
414
|
+
## Documentation
|
|
415
|
+
|
|
416
|
+
- [Python SDK guide](docs/python-sdk.md)
|
|
417
|
+
- [Runnable examples](examples/README.md)
|
|
418
|
+
|
|
419
|
+
## License
|
|
420
|
+
|
|
421
|
+
Apache License 2.0. See [LICENSE](LICENSE).
|