Skip to content

Commit 78c5e4c

Browse files
CasperGNmsfussell
andauthored
chore: align docs with dapr/dapr-agents#283 (#4955)
* chore: align docs with dapr/dapr-agents#283 Signed-off-by: Casper Nielsen <casper@diagrid.io> * fix: remove optional waits and clarify Signed-off-by: Casper Nielsen <casper@diagrid.io> --------- Signed-off-by: Casper Nielsen <casper@diagrid.io> Co-authored-by: Mark Fussell <markfussell@gmail.com>
1 parent aaa9625 commit 78c5e4c

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

daprdocs/content/en/developing-applications/dapr-agents/dapr-agents-core-concepts.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ async def main():
6969
)
7070
)
7171

72-
travel_planner.start()
7372
runner = AgentRunner()
7473

7574
try:
@@ -79,8 +78,7 @@ async def main():
7978
)
8079
print(itinerary)
8180
finally:
82-
travel_planner.stop()
83-
runner.shutdown()
81+
runner.shutdown(travel_planner)
8482

8583
```
8684
This example demonstrates creating a workflow-backed agent that runs autonomously in the background. The `AgentRunner` schedules the workflow for you, waits for completion, and ensures the agent can be triggered once yet continue execution across restarts.
@@ -268,15 +266,14 @@ travel_planner = DurableAgent(
268266
],
269267
tools=[search_flights],
270268
)
271-
travel_planner.start()
272269
runner = AgentRunner()
273270
```
274271

275272
The snippets below reuse this `travel_planner` instance to illustrate each mode.
276273

277274
#### 1. Ad-hoc execution with `runner.run(...)`
278275

279-
Use `run` when you want to trigger a durable workflow directly from Python code (tests, CLIs, notebooks, etc.). The runner locates the agent's `@workflow_entry`, schedules it, and optionally waits for completion. Call `travel_planner.start()` first so the workflow runtime is registered.
276+
Use `run` when you want to trigger a durable workflow directly from Python code (tests, CLIs, notebooks, etc.). The runner locates the agent's `@workflow_entry`, and schedules it. The `.run()` command is a blocking call that triggers the agent and and waits for its completion.
280277

281278
```python
282279
result = await runner.run(
@@ -521,16 +518,14 @@ frodo = DurableAgent(
521518
)
522519
),
523520
)
524-
frodo.start()
525521

526522
async def main():
527523
runner = AgentRunner()
528524
try:
529525
runner.subscribe(frodo)
530526
await wait_for_shutdown()
531527
finally:
532-
runner.shutdown()
533-
frodo.stop()
528+
runner.shutdown(frodo)
534529

535530
asyncio.run(main())
536531
```
@@ -571,7 +566,6 @@ llm_orchestrator = LLMOrchestrator(
571566
execution=AgentExecutionConfig(max_iterations=3),
572567
runtime=wf.WorkflowRuntime(),
573568
)
574-
llm_orchestrator.start()
575569

576570
runner = AgentRunner()
577571
runner.serve(llm_orchestrator, port=8004)

daprdocs/content/en/developing-applications/dapr-agents/dapr-agents-patterns.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,6 @@ travel_planner = DurableAgent(
408408
)
409409

410410
async def main():
411-
travel_planner.start()
412411
runner = AgentRunner()
413412
try:
414413
result = await runner.run(
@@ -417,8 +416,7 @@ async def main():
417416
)
418417
print(result)
419418
finally:
420-
runner.shutdown()
421-
travel_planner.stop()
419+
runner.shutdown(travel_planner)
422420

423421
asyncio.run(main())
424422
```

0 commit comments

Comments
 (0)