feat: purpose interface change to bidi#11
Closed
JackYPCOnline wants to merge 2 commits into
Closed
Conversation
mehtarac
reviewed
Oct 23, 2025
| logger = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| class BidirectionalModelSession(abc.ABC): |
Owner
There was a problem hiding this comment.
I think we should move away from the name Session as to not confuse with our SessionManager. Suggest "Connection"
mehtarac
reviewed
Oct 24, 2025
| metadata: Optional[Dict[str, Any]] | ||
|
|
||
|
|
||
| class ToolResultInputEvent(TypedDict): |
Owner
There was a problem hiding this comment.
I think we can use the existing ToolResult?
Collaborator
Author
There was a problem hiding this comment.
remove this class.
JackYPCOnline
commented
Oct 24, 2025
| pass | ||
|
|
||
| @abc.abstractmethod | ||
| def _format_tools_for_provider(self, tool_specs: list[ToolSpec]) -> Any: |
Collaborator
Author
There was a problem hiding this comment.
remove private function
JackYPCOnline
commented
Oct 24, 2025
JackYPCOnline
commented
Oct 24, 2025
pgrayy
reviewed
Oct 28, 2025
zastrowm
reviewed
Oct 28, 2025
Unshure
reviewed
Oct 28, 2025
mkmeral
reviewed
Oct 28, 2025
zastrowm
reviewed
Oct 28, 2025
JackYPCOnline
commented
Oct 28, 2025
JackYPCOnline
commented
Oct 28, 2025
85e362f to
410be67
Compare
7 tasks
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR refactors the bidirectional streaming interface to provide a cleaner, more generic API that aligns with industry patterns (Google Gemini, OpenAI) while maintaining strong typing and provider flexibility.
This PR should also kickoff the bar-raise dicsussion. We should agree on the interface before making any code changes to model providers.
What have changed?
1. Unified Send Interface
Before:
After:
Need to discuss: if we want to sperate static(image, text, etc) content vs realtime(audio for now, maybe video in future) content?
2. New Typed Events
2.1 Enhanced
ImageInputEventSupports OpenAI/Gemini realtime API patterns:
Let' discuss the interface from below dimensions:
sendfunctions3. Model/Session Separation Clarified OR Combined
Model (Stateless):
Session (Stateful):
Pros:
Multiple Concurrent Sessions
Cons:
Unified:
User should only need implement one interface per model, provide similar user experience like general agent does:
Pros:
Cons:
Recommdation:
Use Unified Interface with Internal Separation
Related Issues
Documentation PR
Type of Change
Bug fix
New feature
Breaking change
Documentation update
Other (please describe):
Testing
How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli
hatch run prepareChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.