dlab-cli 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 (46) hide show
  1. dlab_cli-0.1.0/LICENSE +201 -0
  2. dlab_cli-0.1.0/PKG-INFO +237 -0
  3. dlab_cli-0.1.0/README.md +212 -0
  4. dlab_cli-0.1.0/dlab/__init__.py +6 -0
  5. dlab_cli-0.1.0/dlab/cli.py +1075 -0
  6. dlab_cli-0.1.0/dlab/config.py +190 -0
  7. dlab_cli-0.1.0/dlab/create_dpack.py +1096 -0
  8. dlab_cli-0.1.0/dlab/create_dpack_wizard.py +1471 -0
  9. dlab_cli-0.1.0/dlab/create_parallel_agent_wizard.py +582 -0
  10. dlab_cli-0.1.0/dlab/data/__init__.py +0 -0
  11. dlab_cli-0.1.0/dlab/data/models.json +1793 -0
  12. dlab_cli-0.1.0/dlab/docker.py +591 -0
  13. dlab_cli-0.1.0/dlab/local.py +269 -0
  14. dlab_cli-0.1.0/dlab/model_fallback.py +360 -0
  15. dlab_cli-0.1.0/dlab/parallel_tool.py +18 -0
  16. dlab_cli-0.1.0/dlab/session.py +389 -0
  17. dlab_cli-0.1.0/dlab/timeline.py +684 -0
  18. dlab_cli-0.1.0/dlab/tui/__init__.py +9 -0
  19. dlab_cli-0.1.0/dlab/tui/app.py +664 -0
  20. dlab_cli-0.1.0/dlab/tui/log_watcher.py +208 -0
  21. dlab_cli-0.1.0/dlab/tui/models.py +438 -0
  22. dlab_cli-0.1.0/dlab/tui/widgets/__init__.py +18 -0
  23. dlab_cli-0.1.0/dlab/tui/widgets/agent_list.py +170 -0
  24. dlab_cli-0.1.0/dlab/tui/widgets/artifacts_pane.py +618 -0
  25. dlab_cli-0.1.0/dlab/tui/widgets/log_view.py +505 -0
  26. dlab_cli-0.1.0/dlab/tui/widgets/search_popup.py +151 -0
  27. dlab_cli-0.1.0/dlab/tui/widgets/status_bar.py +106 -0
  28. dlab_cli-0.1.0/dlab_cli.egg-info/PKG-INFO +237 -0
  29. dlab_cli-0.1.0/dlab_cli.egg-info/SOURCES.txt +44 -0
  30. dlab_cli-0.1.0/dlab_cli.egg-info/dependency_links.txt +1 -0
  31. dlab_cli-0.1.0/dlab_cli.egg-info/entry_points.txt +2 -0
  32. dlab_cli-0.1.0/dlab_cli.egg-info/requires.txt +9 -0
  33. dlab_cli-0.1.0/dlab_cli.egg-info/top_level.txt +1 -0
  34. dlab_cli-0.1.0/pyproject.toml +45 -0
  35. dlab_cli-0.1.0/setup.cfg +4 -0
  36. dlab_cli-0.1.0/tests/test_cli.py +579 -0
  37. dlab_cli-0.1.0/tests/test_config.py +218 -0
  38. dlab_cli-0.1.0/tests/test_create_dpack.py +941 -0
  39. dlab_cli-0.1.0/tests/test_create_dpack_wizard.py +175 -0
  40. dlab_cli-0.1.0/tests/test_create_parallel_agent_wizard.py +231 -0
  41. dlab_cli-0.1.0/tests/test_docker.py +346 -0
  42. dlab_cli-0.1.0/tests/test_generate_dpack_integration.py +232 -0
  43. dlab_cli-0.1.0/tests/test_integration.py +388 -0
  44. dlab_cli-0.1.0/tests/test_model_fallback.py +403 -0
  45. dlab_cli-0.1.0/tests/test_parallel_tool.py +32 -0
  46. dlab_cli-0.1.0/tests/test_session.py +530 -0
dlab_cli-0.1.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://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
+ http://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.
@@ -0,0 +1,237 @@
1
+ Metadata-Version: 2.4
2
+ Name: dlab-cli
3
+ Version: 0.1.0
4
+ Summary: A harness for agentic data science — run coding agents with domain skills, parallel subagents, and frozen Docker environments
5
+ Author: DecisionAI
6
+ License: Apache-2.0
7
+ Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: License :: OSI Approved :: Apache Software License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Requires-Python: >=3.11
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: httpx>=0.27
17
+ Requires-Dist: pyyaml>=6.0
18
+ Requires-Dist: textual>=2.0
19
+ Requires-Dist: modal>=0.70
20
+ Requires-Dist: dhub-cli>=0.10
21
+ Provides-Extra: dev
22
+ Requires-Dist: pytest>=7.0; extra == "dev"
23
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
24
+ Dynamic: license-file
25
+
26
+ <img src="docs/_static/dai.png" alt="decision-lab logo" width="200">
27
+
28
+ # decision-lab
29
+
30
+ A harness for agentic data science.
31
+
32
+ Coding agents write good code. They make bad analytical decisions. decision-lab gives you the tools to fix the second part.
33
+
34
+ decision-lab runs your analysis multiple ways — different models, different assumptions — and checks whether they converge. If they converge on the same answer, you can trust it. If they don't, it tells you what it doesn't know and what experiments would resolve the uncertainty. You package the prompts, domain skills, and environment into a **decision-pack**, point it at your data, and get back reports, figures, and recommendations that hold up to scrutiny.
35
+
36
+ <!-- demo gif here -->
37
+
38
+ <!-- TODO: Architecture diagram — orchestrator → parallel subagents → consolidator.
39
+ Show: (1) single prompt + dataset enter the orchestrator,
40
+ (2) fan-out to N parallel subagents, each with a different modeling approach,
41
+ (3) consolidator compares results, produces one report with convergence/divergence assessment.
42
+ Three stages, left to right. Keep it minimal. -->
43
+
44
+ ## Why
45
+
46
+ There are many ways to analyze a dataset. Most of them are wrong. An unsupervised agent picks one path through the analytical space and commits to it. If that path happens to be wrong, you get a nice-looking report with bad conclusions. Nobody notices for months.
47
+
48
+ We [tested this on marketing mix modeling](https://www.youtube.com/watch?v=ess4qV8JKQc). We gave vanilla Claude Code and our [MMM agent](decision-packs/mmm/) the same adversarial dataset where no valid inference was possible. Claude Code fit a model and recommended budget reallocations. Our agent tried 11 approaches, found that none of the models converged, said so, and recommended experiments to collect better data.
49
+
50
+ decision-lab (`dlab`) is the framework we built to make agents behave like that.
51
+
52
+ <img src="docs/forking-paths-blog.svg" alt="Forking paths diagram">
53
+
54
+ ## How it works
55
+
56
+ You package everything an agent needs into a **decision-pack**: agent prompts, domain skills, tools, and a locked environment. The agent explores multiple approaches instead of committing to the first one that runs, and consolidates the results into a report.
57
+
58
+ **Skills** constrain the agent to methodologically sound paths — mandatory diagnostics, preferred model structures, sensible defaults. Browse and install validated data science skills from [Decision Hub](https://github.com/pymc-labs/decision-hub).
59
+
60
+ **Parallel subagents** fan out with different approaches to the same problem (different data prep, different model structures). If results converge across approaches, you have evidence the conclusions are robust. If they diverge, the agent flags the disagreement and identifies what drives it. Supports running compute-heavy tasks on [Modal](https://modal.com).
61
+
62
+ **Locked environments.** Reproducibility matters. Library APIs change constantly, LLMs are trained on old versions, and skills are tuned to specific packages. decision-packs lock dependencies so the agent codes against the right API every time. By default, sessions run in a Docker container with pinned dependencies. Don't want Docker? The agent will set up the environment locally before running.
63
+
64
+ Domain expertise is loaded through **decision-packs** — pluggable configurations that specialize the agent for a specific analytical domain. The first decision-pack targets [Bayesian marketing mix modeling](decision-packs/mmm/). Finance, forecasting, and other domains can be added by writing a new pack.
65
+
66
+ ## Install
67
+
68
+ **Requires [Docker](https://docs.docker.com/get-docker/)** and Python 3.10+
69
+
70
+ ```bash
71
+ pip install dlab-cli
72
+ ```
73
+
74
+ ## Quick start
75
+
76
+ ```bash
77
+ echo "ANTHROPIC_API_KEY=your-key-here" >> .env
78
+
79
+ # Run the MMM decision-pack on the included example dataset
80
+ dlab --dpack decision-packs/mmm \
81
+ --data decision-packs/mmm/example-data/example_dataset.csv \
82
+ --env-file .env \
83
+ --work-dir ./mmm-run \
84
+ --prompt "Analyze our marketing spend and recommend budget allocation"
85
+
86
+ # Watch it work
87
+ dlab connect ./mmm-run
88
+ ```
89
+
90
+ Or build your own decision-pack. Ask Claude to scaffold one for you:
91
+
92
+ ```bash
93
+ dhub install pymc-labs/decision-lab
94
+ claude
95
+ # > "Create a decision-pack for time series forecasting with statsforecast"
96
+ ```
97
+
98
+ ## What's a decision-pack?
99
+
100
+ A directory with everything an agent needs: system prompts, domain skills, tools, a locked environment, and permissions.
101
+
102
+ ```
103
+ my-dpack/
104
+ config.yaml # Name, model, hooks
105
+ docker/
106
+ Dockerfile # Locked environment
107
+ requirements.txt # Pinned dependencies
108
+ opencode/
109
+ opencode.json # Permissions
110
+ agents/
111
+ orchestrator.md # Main agent system prompt
112
+ tools/ # Custom tools
113
+ skills/ # Domain knowledge
114
+ parallel_agents/ # Fan-out configs
115
+ ```
116
+
117
+ See the [poem decision-pack](decision-packs/poem/) for a fully annotated example showing how all the pieces connect. Here's what happens when you run it:
118
+
119
+ ```bash
120
+ dlab --dpack decision-packs/poem --env-file .env --prompt "Write me a poem about the ocean"
121
+ ```
122
+
123
+ 1. dlab builds the Docker image from [`docker/Dockerfile`](decision-packs/poem/docker/Dockerfile) (cached after first run)
124
+ 2. The pre-run hook [`say_hi.sh`](decision-packs/poem/say_hi.sh) runs inside the container
125
+ 3. The orchestrator ([`literary-agent.md`](decision-packs/poem/opencode/agents/literary-agent.md)) starts and calls the terrible poet ([`popo-poet.md`](decision-packs/poem/opencode/agents/popo-poet.md)) via the `task` tool
126
+ 4. The orchestrator reads the terrible poet's attempt, decides it's bad, and spawns 3 parallel poet instances ([`poet.md`](decision-packs/poem/opencode/agents/poet.md)) with different styles via the `parallel-agents` tool
127
+ 5. Each instance writes `summary.md`. A consolidator (auto-generated from [`poet.yaml`](decision-packs/poem/opencode/parallel_agents/poet.yaml)) compares them
128
+ 6. The orchestrator picks the best poem and writes `final_poem.md`
129
+ 7. The post-run hook [`print_result.sh`](decision-packs/poem/print_result.sh) prints it to the terminal
130
+
131
+ The session directory ends up with parallel instance outputs, logs, and the final poem — all browsable with `dlab connect` or `dlab timeline`.
132
+
133
+ ## Features
134
+
135
+ ### Run sessions
136
+
137
+ ```bash
138
+ dlab --dpack PATH --data PATH --prompt TEXT --env-file .env
139
+ ```
140
+
141
+ Builds the Docker image (cached between runs), starts the container, runs pre-run hooks, launches the agent, runs post-run hooks, fixes file ownership, and stops the container. Without `--work-dir`, sessions are auto-numbered by dpack name (`dlab-mmm-workdir-001`, `dlab-mmm-workdir-002`, ...) and can be resumed with `--continue-dir`.
142
+
143
+ ### Live monitoring
144
+
145
+ ```bash
146
+ dlab connect ./mmm-run
147
+ ```
148
+
149
+ A Textual TUI that shows live log events, agent status, cost tracking, and artifacts as the session runs. Browse between the orchestrator, parallel instances, and consolidator. Works with both running and completed sessions.
150
+
151
+
152
+ https://github.com/user-attachments/assets/24976838-3427-4cab-9351-2fc0b28e8f29
153
+
154
+
155
+ ### Execution timeline
156
+
157
+ ```bash
158
+ dlab timeline ./mmm-run
159
+ ```
160
+
161
+ Displays a Gantt chart of the session with timing, cost breakdown per agent, and idle periods. Shows the orchestrator, all parallel instances, and consolidators on a single timeline.
162
+
163
+ <!-- ![dlab timeline Gantt chart](docs/assets/timeline-gantt.png) -->
164
+
165
+ ### Creation wizards
166
+
167
+ ```bash
168
+ dlab create-dpack # Interactive wizard to scaffold a new decision-pack
169
+ dlab create-parallel-agent # Wizard to add parallel agent configs to an existing decision-pack
170
+ ```
171
+
172
+ The decision-pack wizard walks through 8 screens: name, container setup (package manager + base image), features (Decision Hub, Modal, Python library), model selection, permissions, directory skeletons, skill search, and review. Supports conda, pip, uv, and pixi.
173
+
174
+
175
+ https://github.com/user-attachments/assets/58c566f6-1d98-4825-aa7a-47dfd93bb2dc
176
+
177
+
178
+ ### Install as shortcut
179
+
180
+ ```bash
181
+ dlab install ./my-dpack
182
+ # Now run directly:
183
+ my-dpack --data ./data --prompt "..."
184
+ ```
185
+
186
+ Creates a wrapper script in `~/.local/bin/` so you can run a decision-pack by name instead of passing `--dpack` every time.
187
+
188
+ ### Decision Hub integration
189
+
190
+ decision-packs work with [Decision Hub](https://github.com/pymc-labs/decision-hub) ([hub.decision.ai](https://hub.decision.ai)), a registry of validated skills for data science and AI. Agents can search and install skills from the hub at runtime, giving them access to domain knowledge they weren't originally packaged with.
191
+
192
+ ```bash
193
+ # Install the Decision Hub CLI as a skill in your decision-pack
194
+ dhub install pymc-labs/dhub-cli --agent opencode
195
+ ```
196
+
197
+ The hub has 2,200+ skills from 38 organizations with automated evals that verify skills actually improve agent performance.
198
+
199
+ ### Environment variable forwarding
200
+
201
+ All environment variables starting with `DLAB_` are automatically forwarded from the host to the Docker container. decision-packs use these for runtime configuration:
202
+
203
+ ```bash
204
+ # MMM decision-pack: fit models locally instead of on Modal
205
+ DLAB_FIT_MODEL_LOCALLY=1 dlab --dpack mmm --data ./data --prompt "..."
206
+ ```
207
+
208
+ ## CLI reference
209
+
210
+ ```bash
211
+ dlab --dpack PATH --data PATH --prompt TEXT # Run a session
212
+ dlab connect WORK_DIR # Live TUI monitor
213
+ dlab timeline [WORK_DIR] # Execution Gantt chart
214
+ dlab create-dpack [OUTPUT_DIR] # Interactive wizard
215
+ dlab create-parallel-agent [DPACK_DIR] # Parallel agent wizard
216
+ dlab install DPACK_PATH # Create shortcut command
217
+ ```
218
+
219
+ ## Docs
220
+
221
+ | Guide | What it covers |
222
+ |-------|---------------|
223
+ | [CLI Reference](docs/cli-reference.md) | All commands, flags, env var forwarding |
224
+ | [decision-packs](docs/decision-packs.md) | Config format, hooks, permissions, Modal integration |
225
+ | [Parallel Agents](docs/parallel-agents.md) | Fan-out architecture, YAML config, consolidator |
226
+ | [Docker](docs/docker.md) | Image building, container lifecycle, volume mounts |
227
+ | [Sessions](docs/sessions.md) | Work directories, state management, resuming runs |
228
+ | [Log Processing](docs/log-processing.md) | NDJSON log format, event types, TUI/timeline parsing |
229
+ | [Installation](docs/installation.md) | Setup, prerequisites, development install |
230
+
231
+ ## Built by PyMC Labs
232
+
233
+ dlab is developed by [PyMC Labs](https://www.pymc-labs.com), the team behind [PyMC](https://github.com/pymc-devs/pymc) and [pymc-marketing](https://github.com/pymc-labs/pymc-marketing).
234
+
235
+ ## License
236
+
237
+ Apache 2.0
@@ -0,0 +1,212 @@
1
+ <img src="docs/_static/dai.png" alt="decision-lab logo" width="200">
2
+
3
+ # decision-lab
4
+
5
+ A harness for agentic data science.
6
+
7
+ Coding agents write good code. They make bad analytical decisions. decision-lab gives you the tools to fix the second part.
8
+
9
+ decision-lab runs your analysis multiple ways — different models, different assumptions — and checks whether they converge. If they converge on the same answer, you can trust it. If they don't, it tells you what it doesn't know and what experiments would resolve the uncertainty. You package the prompts, domain skills, and environment into a **decision-pack**, point it at your data, and get back reports, figures, and recommendations that hold up to scrutiny.
10
+
11
+ <!-- demo gif here -->
12
+
13
+ <!-- TODO: Architecture diagram — orchestrator → parallel subagents → consolidator.
14
+ Show: (1) single prompt + dataset enter the orchestrator,
15
+ (2) fan-out to N parallel subagents, each with a different modeling approach,
16
+ (3) consolidator compares results, produces one report with convergence/divergence assessment.
17
+ Three stages, left to right. Keep it minimal. -->
18
+
19
+ ## Why
20
+
21
+ There are many ways to analyze a dataset. Most of them are wrong. An unsupervised agent picks one path through the analytical space and commits to it. If that path happens to be wrong, you get a nice-looking report with bad conclusions. Nobody notices for months.
22
+
23
+ We [tested this on marketing mix modeling](https://www.youtube.com/watch?v=ess4qV8JKQc). We gave vanilla Claude Code and our [MMM agent](decision-packs/mmm/) the same adversarial dataset where no valid inference was possible. Claude Code fit a model and recommended budget reallocations. Our agent tried 11 approaches, found that none of the models converged, said so, and recommended experiments to collect better data.
24
+
25
+ decision-lab (`dlab`) is the framework we built to make agents behave like that.
26
+
27
+ <img src="docs/forking-paths-blog.svg" alt="Forking paths diagram">
28
+
29
+ ## How it works
30
+
31
+ You package everything an agent needs into a **decision-pack**: agent prompts, domain skills, tools, and a locked environment. The agent explores multiple approaches instead of committing to the first one that runs, and consolidates the results into a report.
32
+
33
+ **Skills** constrain the agent to methodologically sound paths — mandatory diagnostics, preferred model structures, sensible defaults. Browse and install validated data science skills from [Decision Hub](https://github.com/pymc-labs/decision-hub).
34
+
35
+ **Parallel subagents** fan out with different approaches to the same problem (different data prep, different model structures). If results converge across approaches, you have evidence the conclusions are robust. If they diverge, the agent flags the disagreement and identifies what drives it. Supports running compute-heavy tasks on [Modal](https://modal.com).
36
+
37
+ **Locked environments.** Reproducibility matters. Library APIs change constantly, LLMs are trained on old versions, and skills are tuned to specific packages. decision-packs lock dependencies so the agent codes against the right API every time. By default, sessions run in a Docker container with pinned dependencies. Don't want Docker? The agent will set up the environment locally before running.
38
+
39
+ Domain expertise is loaded through **decision-packs** — pluggable configurations that specialize the agent for a specific analytical domain. The first decision-pack targets [Bayesian marketing mix modeling](decision-packs/mmm/). Finance, forecasting, and other domains can be added by writing a new pack.
40
+
41
+ ## Install
42
+
43
+ **Requires [Docker](https://docs.docker.com/get-docker/)** and Python 3.10+
44
+
45
+ ```bash
46
+ pip install dlab-cli
47
+ ```
48
+
49
+ ## Quick start
50
+
51
+ ```bash
52
+ echo "ANTHROPIC_API_KEY=your-key-here" >> .env
53
+
54
+ # Run the MMM decision-pack on the included example dataset
55
+ dlab --dpack decision-packs/mmm \
56
+ --data decision-packs/mmm/example-data/example_dataset.csv \
57
+ --env-file .env \
58
+ --work-dir ./mmm-run \
59
+ --prompt "Analyze our marketing spend and recommend budget allocation"
60
+
61
+ # Watch it work
62
+ dlab connect ./mmm-run
63
+ ```
64
+
65
+ Or build your own decision-pack. Ask Claude to scaffold one for you:
66
+
67
+ ```bash
68
+ dhub install pymc-labs/decision-lab
69
+ claude
70
+ # > "Create a decision-pack for time series forecasting with statsforecast"
71
+ ```
72
+
73
+ ## What's a decision-pack?
74
+
75
+ A directory with everything an agent needs: system prompts, domain skills, tools, a locked environment, and permissions.
76
+
77
+ ```
78
+ my-dpack/
79
+ config.yaml # Name, model, hooks
80
+ docker/
81
+ Dockerfile # Locked environment
82
+ requirements.txt # Pinned dependencies
83
+ opencode/
84
+ opencode.json # Permissions
85
+ agents/
86
+ orchestrator.md # Main agent system prompt
87
+ tools/ # Custom tools
88
+ skills/ # Domain knowledge
89
+ parallel_agents/ # Fan-out configs
90
+ ```
91
+
92
+ See the [poem decision-pack](decision-packs/poem/) for a fully annotated example showing how all the pieces connect. Here's what happens when you run it:
93
+
94
+ ```bash
95
+ dlab --dpack decision-packs/poem --env-file .env --prompt "Write me a poem about the ocean"
96
+ ```
97
+
98
+ 1. dlab builds the Docker image from [`docker/Dockerfile`](decision-packs/poem/docker/Dockerfile) (cached after first run)
99
+ 2. The pre-run hook [`say_hi.sh`](decision-packs/poem/say_hi.sh) runs inside the container
100
+ 3. The orchestrator ([`literary-agent.md`](decision-packs/poem/opencode/agents/literary-agent.md)) starts and calls the terrible poet ([`popo-poet.md`](decision-packs/poem/opencode/agents/popo-poet.md)) via the `task` tool
101
+ 4. The orchestrator reads the terrible poet's attempt, decides it's bad, and spawns 3 parallel poet instances ([`poet.md`](decision-packs/poem/opencode/agents/poet.md)) with different styles via the `parallel-agents` tool
102
+ 5. Each instance writes `summary.md`. A consolidator (auto-generated from [`poet.yaml`](decision-packs/poem/opencode/parallel_agents/poet.yaml)) compares them
103
+ 6. The orchestrator picks the best poem and writes `final_poem.md`
104
+ 7. The post-run hook [`print_result.sh`](decision-packs/poem/print_result.sh) prints it to the terminal
105
+
106
+ The session directory ends up with parallel instance outputs, logs, and the final poem — all browsable with `dlab connect` or `dlab timeline`.
107
+
108
+ ## Features
109
+
110
+ ### Run sessions
111
+
112
+ ```bash
113
+ dlab --dpack PATH --data PATH --prompt TEXT --env-file .env
114
+ ```
115
+
116
+ Builds the Docker image (cached between runs), starts the container, runs pre-run hooks, launches the agent, runs post-run hooks, fixes file ownership, and stops the container. Without `--work-dir`, sessions are auto-numbered by dpack name (`dlab-mmm-workdir-001`, `dlab-mmm-workdir-002`, ...) and can be resumed with `--continue-dir`.
117
+
118
+ ### Live monitoring
119
+
120
+ ```bash
121
+ dlab connect ./mmm-run
122
+ ```
123
+
124
+ A Textual TUI that shows live log events, agent status, cost tracking, and artifacts as the session runs. Browse between the orchestrator, parallel instances, and consolidator. Works with both running and completed sessions.
125
+
126
+
127
+ https://github.com/user-attachments/assets/24976838-3427-4cab-9351-2fc0b28e8f29
128
+
129
+
130
+ ### Execution timeline
131
+
132
+ ```bash
133
+ dlab timeline ./mmm-run
134
+ ```
135
+
136
+ Displays a Gantt chart of the session with timing, cost breakdown per agent, and idle periods. Shows the orchestrator, all parallel instances, and consolidators on a single timeline.
137
+
138
+ <!-- ![dlab timeline Gantt chart](docs/assets/timeline-gantt.png) -->
139
+
140
+ ### Creation wizards
141
+
142
+ ```bash
143
+ dlab create-dpack # Interactive wizard to scaffold a new decision-pack
144
+ dlab create-parallel-agent # Wizard to add parallel agent configs to an existing decision-pack
145
+ ```
146
+
147
+ The decision-pack wizard walks through 8 screens: name, container setup (package manager + base image), features (Decision Hub, Modal, Python library), model selection, permissions, directory skeletons, skill search, and review. Supports conda, pip, uv, and pixi.
148
+
149
+
150
+ https://github.com/user-attachments/assets/58c566f6-1d98-4825-aa7a-47dfd93bb2dc
151
+
152
+
153
+ ### Install as shortcut
154
+
155
+ ```bash
156
+ dlab install ./my-dpack
157
+ # Now run directly:
158
+ my-dpack --data ./data --prompt "..."
159
+ ```
160
+
161
+ Creates a wrapper script in `~/.local/bin/` so you can run a decision-pack by name instead of passing `--dpack` every time.
162
+
163
+ ### Decision Hub integration
164
+
165
+ decision-packs work with [Decision Hub](https://github.com/pymc-labs/decision-hub) ([hub.decision.ai](https://hub.decision.ai)), a registry of validated skills for data science and AI. Agents can search and install skills from the hub at runtime, giving them access to domain knowledge they weren't originally packaged with.
166
+
167
+ ```bash
168
+ # Install the Decision Hub CLI as a skill in your decision-pack
169
+ dhub install pymc-labs/dhub-cli --agent opencode
170
+ ```
171
+
172
+ The hub has 2,200+ skills from 38 organizations with automated evals that verify skills actually improve agent performance.
173
+
174
+ ### Environment variable forwarding
175
+
176
+ All environment variables starting with `DLAB_` are automatically forwarded from the host to the Docker container. decision-packs use these for runtime configuration:
177
+
178
+ ```bash
179
+ # MMM decision-pack: fit models locally instead of on Modal
180
+ DLAB_FIT_MODEL_LOCALLY=1 dlab --dpack mmm --data ./data --prompt "..."
181
+ ```
182
+
183
+ ## CLI reference
184
+
185
+ ```bash
186
+ dlab --dpack PATH --data PATH --prompt TEXT # Run a session
187
+ dlab connect WORK_DIR # Live TUI monitor
188
+ dlab timeline [WORK_DIR] # Execution Gantt chart
189
+ dlab create-dpack [OUTPUT_DIR] # Interactive wizard
190
+ dlab create-parallel-agent [DPACK_DIR] # Parallel agent wizard
191
+ dlab install DPACK_PATH # Create shortcut command
192
+ ```
193
+
194
+ ## Docs
195
+
196
+ | Guide | What it covers |
197
+ |-------|---------------|
198
+ | [CLI Reference](docs/cli-reference.md) | All commands, flags, env var forwarding |
199
+ | [decision-packs](docs/decision-packs.md) | Config format, hooks, permissions, Modal integration |
200
+ | [Parallel Agents](docs/parallel-agents.md) | Fan-out architecture, YAML config, consolidator |
201
+ | [Docker](docs/docker.md) | Image building, container lifecycle, volume mounts |
202
+ | [Sessions](docs/sessions.md) | Work directories, state management, resuming runs |
203
+ | [Log Processing](docs/log-processing.md) | NDJSON log format, event types, TUI/timeline parsing |
204
+ | [Installation](docs/installation.md) | Setup, prerequisites, development install |
205
+
206
+ ## Built by PyMC Labs
207
+
208
+ dlab is developed by [PyMC Labs](https://www.pymc-labs.com), the team behind [PyMC](https://github.com/pymc-devs/pymc) and [pymc-marketing](https://github.com/pymc-labs/pymc-marketing).
209
+
210
+ ## License
211
+
212
+ Apache 2.0
@@ -0,0 +1,6 @@
1
+ """
2
+ dlab: CLI wrapper that runs opencode in automated mode, sandboxed with Docker,
3
+ and with parallel-agent capability.
4
+ """
5
+
6
+ __version__ = "0.1.0"