You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/development/README.md
+119Lines changed: 119 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -151,3 +151,122 @@ tox -e type
151
151
1.1 caveat here is wf will continue but you will not get the result.
152
152
2. every time i have a .run() or invoke new workflow via curl or pubsub then a new workflow instance id will be created. If there is an inflight workflow already then it will be resumed, and the new one will be created.
153
153
3. Trace ID = workflow ID and make the tracing pick up from where it left off.
154
+
155
+
156
+
## Contributing to Dapr Agents Quickstarts
157
+
158
+
### Add runnable README tests with Mechanical Markdown
159
+
160
+
We annotate README code blocks with lightweight metadata so they can be executed and validated automatically using [mechanical-markdown](https://github.com/dapr/mechanical-markdown).
161
+
162
+
-**Install**:
163
+
```bash
164
+
pip install mechanical-markdown
165
+
```
166
+
167
+
-**Annotate steps**: Wrap executable blocks with STEP markers (as in `01-hello-world/README.md`). Example:
168
+
```markdown
169
+
<!-- STEP
170
+
name: Run a simple workflow example
171
+
expected_stderr_lines:
172
+
- "Creating virtual environment"
173
+
expected_stdout_lines:
174
+
- "Result:"
175
+
output_match_mode: substring
176
+
-->
177
+
```
178
+
179
+
```bash
180
+
dapr run --app-id dapr-agent-wf -- python 04_chain_tasks.py
181
+
```
182
+
183
+
```markdown
184
+
<!-- END_STEP -->
185
+
```
186
+
187
+
-**Run locally**:
188
+
189
+
```bash
190
+
# cd to the directory you want to run mechanical markdown on
191
+
cd quickstarts/01-hello-world/
192
+
193
+
# run mechanical markdown on the README.md file
194
+
mm.py README.md
195
+
```
196
+
197
+
Tip: Use dry-run first to see which commands will execute:
198
+
```bash
199
+
mm.py --dry-run README.md
200
+
```
201
+
202
+
Before running, export your `.env` so keys are available to the shell used by `mm.py`:
203
+
```bash
204
+
# export the environment variables from the .env file if it is in the current directory
205
+
export$(grep -v '^#' .env | xargs)
206
+
```
207
+
208
+
-**Use the validate.sh script**:
209
+
This script will run the mechanical markdown script against the quickstarts directory you want to validate. It is a simpler wrapper around the mechanical markdown script.
210
+
211
+
```bash
212
+
# cd to the quickstarts directory
213
+
cd quickstarts
214
+
215
+
# run the validate.sh script against the quickstarts directory you want to validate
216
+
./validate.sh 01-hello-world
217
+
```
218
+
219
+
### Troubleshooting
220
+
221
+
- Remember to setup the virtual environment and install the dependencies before running the mechanical markdown script.
222
+
- You can also add the setup of the virtual environment and installation of the dependencies to the mechanical markdown script execution scope. For example:
223
+
```markdown
224
+
<!-- STEP
225
+
name: Setup virtual environment
226
+
expected_stderr_lines:
227
+
- "Creating virtual environment"
228
+
-->
229
+
```
230
+
```bash
231
+
python -m venv .venv
232
+
source .venv/bin/activate
233
+
pip install -r requirements.txt
234
+
```
235
+
Your script run:
236
+
```bash
237
+
source .venv/bin/activate
238
+
python my_script.py
239
+
```
240
+
241
+
```markdown
242
+
<!-- END_STEP -->
243
+
```
244
+
- If you have errors related to order of execution, you can use the `match_order` keyword to specify the order of execution. For example:
245
+
```markdown
246
+
<!-- STEP
247
+
name: Run my script
248
+
match_order: none
249
+
-->
250
+
```
251
+
- Remember that mechanical markdown is YAML so follow YAML syntax. One issue at times is with strings and quotes inside of strings. You can use single quotes inside of double quotes and vice versa. For example:
252
+
```markdown
253
+
<!-- STEP
254
+
name: Run my script
255
+
expected_stdout_lines:
256
+
- '"Hello, world!"'
257
+
-->
258
+
```
259
+
260
+
### Using the env-template resolver
261
+
262
+
For Dapr component files that reference environment variables (e.g., `{{OPENAI_API_KEY}}` or `${{OPENAI_API_KEY}}`), use the helper to render a temporary resources folder and pass it to Dapr:
263
+
```bash
264
+
dapr run --resources-path $(quickstarts/resolve_env_templates.py quickstarts/01-hello-world/components) -- python 03_durable_agent.py
265
+
```
266
+
267
+
The helper scans only `.yaml`/`.yml` files (non-recursive), replaces placeholders with matching env var values, writes processed files to a temp directory, and prints that directory path.
268
+
269
+
### CI note
270
+
271
+
Mechanical Markdown steps are not executed in CI yet due to the absence of a repository OpenAI API key. Please validate locally as shown above. Once CI secrets are provisioned, these steps can be enabled for automated verification.
Copy file name to clipboardExpand all lines: quickstarts/README.md
+3-52Lines changed: 3 additions & 52 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -187,57 +187,8 @@ This quickstart demonstrates how to build a database agent with memory and chat
187
187
188
188
[Go to Conversational Agent over Postgres with MCP](./08-data-agent-mcp-chainlit)
189
189
190
-
##Contributors
190
+
### Contributing to Dapr Agents Quickstarts
191
191
192
-
### Add runnable README tests with Mechanical Markdown
193
-
194
-
We annotate README code blocks with lightweight metadata so they can be executed and validated automatically using [mechanical-markdown](https://github.com/dapr/mechanical-markdown).
195
-
196
-
-**Install**:
197
-
```bash
198
-
pip install mechanical-markdown
199
-
```
200
-
201
-
-**Annotate steps**: Wrap executable blocks with STEP markers (as in `01-hello-world/README.md`). Example:
202
-
```markdown
203
-
<!-- STEP
204
-
name: Run a simple workflow example
205
-
expected_stdout_lines:
206
-
- "Result:"
207
-
output_match_mode: substring
208
-
-->
209
-
```
210
-
```bash
211
-
dapr run --app-id dapr-agent-wf -- python 04_chain_tasks.py
212
-
```
213
-
<!-- END_STEP -->
214
-
```
215
-
216
-
- **Run locally**:
217
-
```bash
218
-
mm.py quickstarts/01-hello-world/README.md
219
-
```
220
-
221
-
Tip: Use dry-run first to see which commands will execute:
Before running, export your `.env` so keys are available to the shell used by `mm.py`:
227
-
```bash
228
-
export$(grep -v '^#' .env | xargs)
229
-
```
230
-
231
-
### Using the env-template resolver
232
-
233
-
For Dapr component files that reference environment variables (e.g., `{{OPENAI_API_KEY}}` or `${{OPENAI_API_KEY}}`), use the helper to render a temporary resources folder and pass it to Dapr:
234
-
```bash
235
-
dapr run --resources-path $(quickstarts/resolve_env_templates.py quickstarts/01-hello-world/components) -- python 03_durable_agent.py
236
-
```
237
-
238
-
The helper scans only `.yaml`/`.yml` files (non-recursive), replaces placeholders with matching env var values, writes processed files to a temp directory, and prints that directory path.
239
-
240
-
### CI note
241
-
242
-
Mechanical Markdown steps are not executed in CI yet due to the absence of a repository OpenAI API key. Please validate locally as shown above. Once CI secrets are provisioned, these steps can be enabled for automated verification.
192
+
Please refer to our [Dapr Community Code of Conduct](https://github.com/dapr/community/blob/master/CODE-OF-CONDUCT.md)
243
193
194
+
For development setup and guidelines, see our [Development Guide](../docs/development/README.md#contributing-to-dapr-agents-quickstarts).
0 commit comments