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

feat!: Add message context to signature of intervention handler, add more to docs #4882

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

Conversation

jackgerrits
Copy link
Member

@jackgerrits jackgerrits commented Jan 2, 2025

Breaking:

  • This changes the signature of the on_publish and on_send method in the InterventionHandler class to include a message_context parameter instead of an AgentId parameter.

Closes #4003
Related #4349

Copy link

codecov bot commented Jan 2, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 5 lines in your changes missing coverage. Please review.

Project coverage is 68.18%. Comparing base (e8797a2) to head (2c87579).

Files with missing lines Patch % Lines
...ges/autogen-core/src/autogen_core/_intervention.py 72.72% 3 Missing ⚠️
...src/autogen_core/_single_threaded_agent_runtime.py 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4882      +/-   ##
==========================================
- Coverage   68.21%   68.18%   -0.03%     
==========================================
  Files         158      158              
  Lines        9960     9967       +7     
==========================================
+ Hits         6794     6796       +2     
- Misses       3166     3171       +5     
Flag Coverage Δ
unittests 68.18% <66.66%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jackgerrits jackgerrits requested a review from Copilot January 2, 2025 20:58

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 7 changed files in this pull request and generated no comments.

Files not reviewed (2)
  • python/packages/autogen-core/docs/src/user-guide/core-user-guide/cookbook/termination-with-intervention.ipynb: Evaluated as low risk
  • python/packages/autogen-core/docs/src/user-guide/core-user-guide/cookbook/tool-use-with-intervention.ipynb: Evaluated as low risk
@jackgerrits jackgerrits changed the title Add message context to signature of intervention handler, add more to docs feat!: Add message context to signature of intervention handler, add more to docs Jan 3, 2025
@@ -506,7 +515,14 @@ async def _process_next(self) -> None:
"intercept", handler.__class__.__name__, parent=message_envelope.metadata
):
try:
temp_message = await handler.on_publish(message, sender=sender)
message_context = MessageContext(
Copy link
Collaborator

@ekzhu ekzhu Jan 4, 2025

Choose a reason for hiding this comment

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

Looks like some missing tests to make sure the runtime actually invokes the intervention handlers?

Copy link
Collaborator

Choose a reason for hiding this comment

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

The publish_message code path is missing test.

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.

Documentation for intervention handler
2 participants