Skip to content
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

Add Optional Control for Participant Auto-Linking in MultimodalAgent #971

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

dsgolman
Copy link

Overview

This PR introduces a new feature to control the automatic linking of participants to the MultimodalAgent when they join a room or when the agent starts. By default, the agent automatically links the first participant it encounters, but this behavior may not always be desirable for certain use cases, such as when developers want to manage which participant is linked manually. The change is designed to maintain backward compatibility while providing additional flexibility.

Key Changes

  1. auto_link_on_connect Flag:

    • Introduced an auto_link_on_connect flag (default: True) to allow developers to enable or disable the automatic linking of participants when they connect to a room.

    • If auto_link_on_connect is set to False, the agent will only link participants when explicitly requested via the _link_participant method.

    • The flag is respected in both the start method (during agent initialization) and in the _on_participant_connected method (when a new participant joins the room).

  2. Modifications in start Method:The start method now checks the auto_link_on_connect flag before automatically linking participants upon agent startup. If the flag is disabled, the agent will log that auto-linking is disabled but will not automatically link any participant.

  3. Modifications in _on_participant_connected: The participant connection handler (_on_participant_connected) now respects the auto_link_on_connect flag. If the flag is disabled, the method will not link the participant and will log this action for debugging purposes.

Backward Compatibility

By default, the auto_link_on_connect flag is set to True, preserving the original functionality for existing users of the SDK who rely on automatic participant linking.
The new flag only impacts users who explicitly set auto_link_on_connect=False, providing them with greater control over when participants are linked.

Use Cases

This feature is useful in scenarios where an application needs more granular control over which participants the agent listens to and when this linking happens (e.g., for moderation purposes or custom workflows that require selective participant listening).
Testing:

Verified that the agent behaves as expected when auto_link_on_connect is True (default behavior).

Verified that participants are not automatically linked when auto_link_on_connect=False and that manual linking via _link_participant still works as intended.

Conclusion

This PR enhances the flexibility of the MultimodalAgent by allowing developers to decide when participants should be linked, without disrupting the original automatic behavior that other users rely on.

Copy link

changeset-bot bot commented Oct 22, 2024

⚠️ No Changeset found

Latest commit: aa036fa

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@CLAassistant
Copy link

CLAassistant commented Oct 22, 2024

CLA assistant check
All committers have signed the CLA.

…is breaks OO paradigms but it was accessible
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