Deprecate *SessionArguments in favor of pipecat-ai runner types#172
Deprecate *SessionArguments in favor of pipecat-ai runner types#172markbackman wants to merge 1 commit intomainfrom
Conversation
The `session_id` field added to `pipecat.runner.types.RunnerArguments` in pipecat-ai now provides what `SessionArguments` used to add via multiple inheritance. Collapse the five `*SessionArguments` classes (`SessionArguments`, `PipecatSessionArguments`, `DailySessionArguments`, `WebSocketSessionArguments`, `SmallWebRTCSessionArguments`) to straight aliases of their `*RunnerArguments` counterparts so the same class object is reachable under either name. Existing user code keeps working unchanged: `from pipecatcloud import DailySessionArguments` resolves, type annotations resolve, and `isinstance` checks pass because each alias is the same class object as its target. The standalone fallback path (used when `pipecatcloud[pipecat]` is not installed) gains a `session_id` field on its `RunnerArguments` for parity with the upstream type. Before tagging the next release, bump the `pipecat-ai>=...` constraint in the `[project.optional-dependencies] pipecat` extra to require the release containing the new field.
| # Deprecated session-argument aliases. The runner types now carry the | ||
| # ``session_id`` field directly, so the legacy ``*SessionArguments`` classes | ||
| # collapse to straight aliases. Existing imports keep working unchanged | ||
| # (``isinstance`` and type annotations both resolve identically because each | ||
| # alias is the same class object as its target). New code should import the | ||
| # canonical names from :mod:`pipecat.runner.types`. | ||
| SessionArguments = RunnerArguments | ||
| PipecatSessionArguments = RunnerArguments | ||
| DailySessionArguments = DailyRunnerArguments | ||
| WebSocketSessionArguments = WebSocketRunnerArguments | ||
| SmallWebRTCSessionArguments = SmallWebRTCRunnerArguments |
There was a problem hiding this comment.
What if they are using an older Pipecat version? In that case, the runner types won’t include session_id. I guess we need to check whether they’re using a Pipecat version that allows this.
There was a problem hiding this comment.
Oh, I saw you added a release TODO in the PR description mentioning that we’d need to bump the Pipecat version.
Maybe it’s worth keeping this PR open until we release a version with this feature?
There was a problem hiding this comment.
Yes, the idea is that pipecat-ai will have the types available if you're using 1.2.0 or newer. If not, then pipecatcloud falls back to the included types.
There was a problem hiding this comment.
I'll mark this as draft so that it's clear that we shouldn't merge. But, I wanted to post now, so that it's clear what the path forward is.
filipi87
left a comment
There was a problem hiding this comment.
Leaving it pre-approved.
Requires pipecat-ai 1.2.0 release first, which will include this change:
pipecat-ai/pipecat#4385
Summary
Collapse the
*SessionArgumentshierarchy to straight aliases of the corresponding*RunnerArgumentsfrom pipecat-ai. Thesession_idfield thatSessionArgumentsused to contribute via multiple inheritance now lives onpipecat.runner.types.RunnerArgumentsupstream, so the cloud-side wrappers no longer add anything.This is the second step in unifying bot argument types under pipecat-ai. The companion change to add
session_idtoRunnerArgumentsis on the pipecat-ai branchmb/runner-session-id.Backwards compatibility
from pipecatcloud import DailySessionArgumentsstill resolves.async def bot(args: DailySessionArguments):still match, because the alias is literally the upstream class.isinstance(args, DailySessionArguments)still returnsTruefor the same reason.Verified manually in both modes:
DailySessionArguments(session_id=..., room_url=..., token=..., body=...)constructs cleanly andargs.session_idcarries through.session_id), and the standalone-modeDeprecationWarningstill fires on construction.Release TODO
Before tagging this release, bump the constraint in
pyproject.toml:to the pipecat-ai version that contains the
session_idfield onRunnerArguments. Without that bump, callers can install pipecatcloud alongside an older pipecat-ai whereDailySessionArguments(session_id=...)would fail withTypeError.Follow-up
Once base image releases include the new pipecatcloud, the alias surface can be removed entirely in a later major release. Tracked separately as part of the broader runner-type unification.
Test plan
uv run pytestuv run ruff check . && uv run ruff format --check .from pipecatcloud import DailySessionArguments; DailySessionArguments(session_id="x", room_url="y", token="z")works andargs.session_id == "x".async def bot(args: DailySessionArguments):and confirmargs.session_idmatches thex-daily-session-idheader.