Skip to content

implement union type support for streaming actions#813

Open
ThyTran1402 wants to merge 2 commits into
apache:mainfrom
ThyTran1402:fix/stream_type_support_union_type
Open

implement union type support for streaming actions#813
ThyTran1402 wants to merge 2 commits into
apache:mainfrom
ThyTran1402:fix/stream_type_support_union_type

Conversation

@ThyTran1402

@ThyTran1402 ThyTran1402 commented Jun 20, 2026

Copy link
Copy Markdown

Summary

Extends the @streaming_action.pydantic() decorator to accept union types like Model1 | Model2 or Union[Model1, Model2]) for the stream_type parameter. Previously, only single BaseModel types or dict were accepted, limiting flexibility for streaming actions that yield multiple result types.

Changes

  • burr/core/action.py
  • burr/integrations/pydantic.py
  • tests/integrations/test_streaming_union_types.py

How I tested this

Unit Tests: Created comprehensive test suite with 10 tests that all pass

Notes

Resolved: #607

Checklist

  • PR has an informative and human-readable title (this will be pulled into the release notes)
  • Changes are limited to a single goal (no scope creep)
  • Code passed the pre-commit check & code is left cleaner/nicer than when first encountered.
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future TODOs are captured in comments
  • Project documentation has been updated if adding/changing functionality.

@github-actions github-actions Bot added area/core Application, State, Graph, Actions area/integrations External integrations (LLMs, frameworks) area/typing Mypy, type hints, pydantic labels Jun 20, 2026
@ThyTran1402 ThyTran1402 changed the title phase III: implement union type support for streaming actions implement union type support for streaming actions Jun 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Application, State, Graph, Actions area/integrations External integrations (LLMs, frameworks) area/typing Mypy, type hints, pydantic

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Streaming Event type, type hint, should support union type

1 participant