Skip to content

Deprecate *SessionArguments in favor of pipecat-ai runner types#172

Draft
markbackman wants to merge 1 commit intomainfrom
mb/deprecate-session-args
Draft

Deprecate *SessionArguments in favor of pipecat-ai runner types#172
markbackman wants to merge 1 commit intomainfrom
mb/deprecate-session-args

Conversation

@markbackman
Copy link
Copy Markdown
Contributor

@markbackman markbackman commented Apr 29, 2026

Requires pipecat-ai 1.2.0 release first, which will include this change:
pipecat-ai/pipecat#4385

Summary

Collapse the *SessionArguments hierarchy to straight aliases of the corresponding *RunnerArguments from pipecat-ai. The session_id field that SessionArguments used to contribute via multiple inheritance now lives on pipecat.runner.types.RunnerArguments upstream, 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_id to RunnerArguments is on the pipecat-ai branch mb/runner-session-id.

Backwards compatibility

  • from pipecatcloud import DailySessionArguments still resolves.
  • Type annotations like async def bot(args: DailySessionArguments): still match, because the alias is literally the upstream class.
  • isinstance(args, DailySessionArguments) still returns True for the same reason.

Verified manually in both modes:

  • With pipecat-ai installed: aliases are the upstream classes; DailySessionArguments(session_id=..., room_url=..., token=..., body=...) constructs cleanly and args.session_id carries through.
  • Without pipecat-ai: aliases collapse to the local fallback dataclasses (which now include session_id), and the standalone-mode DeprecationWarning still fires on construction.

Release TODO

Before tagging this release, bump the constraint in pyproject.toml:

[project.optional-dependencies]
pipecat = ["pipecat-ai>=X.Y.Z"]

to the pipecat-ai version that contains the session_id field on RunnerArguments. Without that bump, callers can install pipecatcloud alongside an older pipecat-ai where DailySessionArguments(session_id=...) would fail with TypeError.

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 pytest
  • uv run ruff check . && uv run ruff format --check .
  • Manual: from pipecatcloud import DailySessionArguments; DailySessionArguments(session_id="x", room_url="y", token="z") works and args.session_id == "x".
  • Manual: deploy a bot signed async def bot(args: DailySessionArguments): and confirm args.session_id matches the x-daily-session-id header.

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.
Comment thread src/pipecatcloud/agent.py
Comment on lines +81 to +91
# 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
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.

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.

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.

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?

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.

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.

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.

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.

@markbackman markbackman marked this pull request as draft April 29, 2026 17:14
Copy link
Copy Markdown
Contributor

@filipi87 filipi87 left a comment

Choose a reason for hiding this comment

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

Leaving it pre-approved.

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