Skip to content

Rename @flows_direct_function to @flows_tool_options#282

Merged
markbackman merged 2 commits into
mainfrom
mb/update-flows-direct-function
Jun 17, 2026
Merged

Rename @flows_direct_function to @flows_tool_options#282
markbackman merged 2 commits into
mainfrom
mb/update-flows-direct-function

Conversation

@markbackman

Copy link
Copy Markdown
Contributor

Summary

  • Added @flows_tool_options(cancel_on_interruption=..., timeout_secs=...) as the primary decorator for configuring a Flows direct function's call options. It is the Flows-flavored counterpart to Pipecat's @tool_options and is built on it, so the metadata now lives under the _pipecat_* attributes the wrapper reads.
  • Deprecated @flows_direct_function — it is now an alias of @flows_tool_options that emits a DeprecationWarning and delegates to it. The alias will be removed in a future version.
  • Bumped the minimum pipecat-ai to 1.4.0 (core dependency and the examples extra), where @tool_options and the timeout_secs naming land.

The point of the rename is naming alignment: matching Pipecat's @tool_options makes it clearer that the decorator configures a direct function's call options, rather than implying it's what makes a function a "direct function."

⚠️ Blocked on Pipecat 1.4.0

@tool_options and the timeout_secs decorator argument only exist on Pipecat's main (unreleased). This PR cannot pass CI or be merged until pipecat-ai 1.4.0 is published to PyPI — CI installs the released pipecat-ai, which still lacks tool_options. Verified locally against the Pipecat checkout via PYTHONPATH.

Breaking Changes

  • None at runtime. @flows_direct_function keeps working (with a deprecation warning). The minimum pipecat-ai requirement rises to 1.4.0.

Testing

uv run pytest tests/test_flows_direct_functions.py tests/test_manager.py

(Run against a Pipecat 1.4.0+ environment.) Includes a new test that @flows_direct_function warns but still attaches the options, and that @flows_tool_options does not warn.

🤖 Generated with Claude Code

Align the decorator name with Pipecat 1.4.0's @tool_options, making
clearer that it configures a direct function's call options. The new
@flows_tool_options is built on Pipecat's @tool_options (so the metadata
now lives under the _pipecat_* attributes the wrapper reads).

@flows_direct_function becomes a deprecated alias that warns and
delegates. Bumps the minimum pipecat-ai to 1.4.0, where @tool_options
and the timeout_secs naming land.
Comment thread changelog/282.added.md Outdated
@@ -0,0 +1 @@
- Added the `@flows_tool_options(cancel_on_interruption=..., timeout_secs=...)` decorator for configuring a Flows direct function's call options. It is the Flows-flavored counterpart to Pipecat's `@tool_options` (and is built on it), replacing `@flows_direct_function` with a name that makes clearer that it configures call options. Requires `pipecat-ai>=1.4.0`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: does it matter to the reader here that it requires a newer version of Pipecat? They'll know, upon bumping their version of Pipecat Flows, that the newer Pipecat is required.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

"""Decorator to attach additional metadata to a Pipecat direct function.
"""Configure a Flows direct function's call options.

This decorator is optional; use it to override the defaults for a Flows

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: everything after "use it to override the defaults for a Flows direct function" feels like it might be TMI to the reader.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

"""Test that cancel_on_interruption can be set to False via decorator."""

@flows_direct_function(cancel_on_interruption=False)
@flows_tool_options(cancel_on_interruption=False)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reads much better!

@markbackman markbackman merged commit 0e8fc3a into main Jun 17, 2026
2 of 4 checks passed
@markbackman markbackman deleted the mb/update-flows-direct-function branch June 17, 2026 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants