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/durable_execution/prefect.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,7 +61,7 @@ Any agent can be wrapped in a [`PrefectAgent`][pydantic_ai.durable_exec.prefect.
61
61
* Wraps [tool calls](../tools.md) as Prefect tasks (configurable per-tool).
62
62
* Wraps [MCP communication](../mcp/client.md) as Prefect tasks.
63
63
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.
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)
65
65
66
66
The original agent, model, and MCP server can still be used as normal outside the Prefect flow.
"""Wrap an agent to enable it with Prefect durable flows, by automatically offloading model requests, tool calls, and MCP server communication to Prefect tasks.
55
59
@@ -63,6 +67,9 @@ def __init__(
63
67
model_task_config: The Prefect task config to use for model request tasks. If no config is provided, use the default settings of Prefect.
64
68
tool_task_config: The default Prefect task config to use for tool calls. If no config is provided, use the default settings of Prefect.
65
69
tool_task_config_by_name: Per-tool task configuration. Keys are tool names, values are TaskConfig or None (None disables task wrapping for that tool).
70
+
prefectify_toolset_func: Optional function to use to prepare toolsets for Prefect by wrapping them in a `PrefectWrapperToolset` that moves methods that require IO to Prefect tasks.
71
+
If not provided, only `FunctionToolset` and `MCPServer` will be prepared for Prefect.
72
+
The function takes the toolset, the task config, the tool-specific task config, and the tool-specific task config by name.
0 commit comments