Skip to content

feat: implement parallel streaming output rails execution #1263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: fix/streaming-outputrails
Choose a base branch
from

Conversation

Pouyanpi
Copy link
Collaborator

@Pouyanpi Pouyanpi commented Jul 4, 2025

This PR implements streaming for parallel output rails execution

  • Add _run_output_rails_in_parallel_streaming method to run output rails concurrently
  • Use asyncio tasks to execute multiple rails simultaneously during streaming
  • Implement early termination when any rail blocks content to optimize performance
  • Register the new action in the runtime dispatcher
  • Add proper error handling and cancellation for robust parallel execution
  • Avoid full flow state management issues that can occur with hide_prev_turn logic during streaming
  • Add comprehensive tests for parallel streaming functionality

- Add _run_output_rails_in_parallel_streaming method to run output rails concurrently
- Use asyncio tasks to execute multiple rails simultaneously during streaming
- Implement early termination when any rail blocks content to optimize performance
- Register the new action in the runtime dispatcher
- Add proper error handling and cancellation for robust parallel execution
- Avoid full flow state management issues that can occur with hide_prev_turn logic during streaming
- Add comprehensive tests for parallel streaming functionality
@Pouyanpi Pouyanpi self-assigned this Jul 4, 2025
@Pouyanpi Pouyanpi added this to the v0.15.0 milestone Jul 4, 2025
@Pouyanpi Pouyanpi added the enhancement New feature or request label Jul 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant