diff --git a/daprdocs/content/en/developing-applications/dapr-agents/dapr-agents-core-concepts.md b/daprdocs/content/en/developing-applications/dapr-agents/dapr-agents-core-concepts.md index 9af9edc6456..9ffb1237f4a 100644 --- a/daprdocs/content/en/developing-applications/dapr-agents/dapr-agents-core-concepts.md +++ b/daprdocs/content/en/developing-applications/dapr-agents/dapr-agents-core-concepts.md @@ -69,7 +69,6 @@ async def main(): ) ) - travel_planner.start() runner = AgentRunner() try: @@ -79,8 +78,7 @@ async def main(): ) print(itinerary) finally: - travel_planner.stop() - runner.shutdown() + runner.shutdown(travel_planner) ``` 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. @@ -267,7 +265,6 @@ travel_planner = DurableAgent( ], tools=[search_flights], ) -travel_planner.start() runner = AgentRunner() ``` @@ -275,7 +272,7 @@ The snippets below reuse this `travel_planner` instance to illustrate each mode. #### 1. Ad-hoc execution with `runner.run(...)` -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. +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. ```python result = await runner.run( @@ -520,7 +517,6 @@ frodo = DurableAgent( ) ), ) -frodo.start() async def main(): runner = AgentRunner() @@ -528,8 +524,7 @@ async def main(): runner.subscribe(frodo) await wait_for_shutdown() finally: - runner.shutdown() - frodo.stop() + runner.shutdown(frodo) asyncio.run(main()) ``` @@ -570,7 +565,6 @@ llm_orchestrator = LLMOrchestrator( execution=AgentExecutionConfig(max_iterations=3), runtime=wf.WorkflowRuntime(), ) -llm_orchestrator.start() runner = AgentRunner() runner.serve(llm_orchestrator, port=8004) diff --git a/daprdocs/content/en/developing-applications/dapr-agents/dapr-agents-patterns.md b/daprdocs/content/en/developing-applications/dapr-agents/dapr-agents-patterns.md index 001a17fcf50..b5219a9df40 100644 --- a/daprdocs/content/en/developing-applications/dapr-agents/dapr-agents-patterns.md +++ b/daprdocs/content/en/developing-applications/dapr-agents/dapr-agents-patterns.md @@ -408,7 +408,6 @@ travel_planner = DurableAgent( ) async def main(): - travel_planner.start() runner = AgentRunner() try: result = await runner.run( @@ -417,8 +416,7 @@ async def main(): ) print(result) finally: - runner.shutdown() - travel_planner.stop() + runner.shutdown(travel_planner) asyncio.run(main()) ```