Skip to content

Commit 625a12f

Browse files
committed
Fix documentation for Prefect agent
1 parent cc41464 commit 625a12f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

docs/durable_execution/prefect.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Any agent can be wrapped in a [`PrefectAgent`][pydantic_ai.durable_exec.prefect.
6161
* Wraps [tool calls](../tools.md) as Prefect tasks (configurable per-tool).
6262
* Wraps [MCP communication](../mcp/client.md) as Prefect tasks.
6363

64-
Event stream handlers are **not automatically wrapped** by Prefect. If they involve I/O or non-deterministic behavior, you can explicitly decorate them with `@task` from Prefect. For examples, see the [streaming docs](../agents.md#streaming-all-events)
64+
Event stream handlers are **automatically wrapped** by Prefect when running inside a Prefect flow. Each event from the stream is processed in a separate Prefect task for durability. You can customize the task behavior using the `event_stream_handler_task_config` parameter when creating the `PrefectAgent`. Do **not** manually decorate event stream handlers with `@task`. For examples, see the [streaming docs](../agents.md#streaming-all-events)
6565

6666
The original agent, model, and MCP server can still be used as normal outside the Prefect flow.
6767

@@ -164,6 +164,7 @@ You can customize Prefect task behavior, such as retries and timeouts, by passin
164164
- `model_task_config`: Configuration for model request tasks
165165
- `tool_task_config`: Default configuration for all tool calls
166166
- `tool_task_config_by_name`: Per-tool task configuration (overrides `tool_task_config`)
167+
- `event_stream_handler_task_config`: Configuration for event stream handler tasks (applies when running inside a Prefect flow)
167168

168169
Available `TaskConfig` options:
169170

0 commit comments

Comments
 (0)