Skip to content

Conversation

zastrowm
Copy link
Member

@zastrowm zastrowm commented Aug 26, 2025

Description

This is step 1/N of implementing typed-events - this first PR just preserve the existing behaviors with no changes to the public api by switching call-sites to passing typed classes instead of dictionaries.

A follow-up change will update how we invoke callbacks and pass invocation_state around, while this one just adds typed classes for events internally. It also adds/updates tests to ensure that backwards compatibility is maintained and that typed events are not being emitted to callers out of the agent or the callback_handler

Follow Up PRs will:

  • Remove callback keys/nesting to burn down tech debt
  • Update invocation state so that it's passed consistently to events
  • Wrap tool results in typed events

Per discussions with team, we've decided that events will not be part of the public api at this point, so there will not be a pr for releasing these events. For that reason, I'm not overly concerned about:

  • Nitpicking the names of the events

Related Issues

#242

Documentation PR

N/A - will document after typed events are implemented throughout the code

Type of Change

Other (please describe): Internal refactor

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

  • I ran hatch run prepare

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@zastrowm zastrowm marked this pull request as ready for review August 26, 2025 13:58
@zastrowm zastrowm requested review from Unshure and pgrayy and removed request for Unshure August 26, 2025 14:08
Step 1/N for implementing typed-events; first just preserve the existing behaviors with no changes to the public api.

A follow-up change will update how we invoke callbacks and pass invocation_state around, while this one just adds typed classes for events internally.
@zastrowm zastrowm merged commit aa03b3d into strands-agents:main Aug 27, 2025
12 checks passed
dbschmigelski pushed a commit to dbavro19/sdk-python that referenced this pull request Aug 28, 2025
Step 1/N for implementing typed-events; first just preserve the existing behaviors with no changes to the public api.

A follow-up change will update how we invoke callbacks and pass invocation_state around, while this one just adds typed classes for events internally.

---------

Co-authored-by: Mackenzie Zastrow <[email protected]>
@zastrowm zastrowm mentioned this pull request Aug 28, 2025
7 tasks
Ratish1 pushed a commit to Ratish1/sdk-python that referenced this pull request Aug 30, 2025
Step 1/N for implementing typed-events; first just preserve the existing behaviors with no changes to the public api.

A follow-up change will update how we invoke callbacks and pass invocation_state around, while this one just adds typed classes for events internally.

---------

Co-authored-by: Mackenzie Zastrow <[email protected]>
This was referenced Sep 17, 2025
Unshure pushed a commit to Unshure/sdk-python that referenced this pull request Sep 24, 2025
Step 1/N for implementing typed-events; first just preserve the existing behaviors with no changes to the public api.

A follow-up change will update how we invoke callbacks and pass invocation_state around, while this one just adds typed classes for events internally.

---------

Co-authored-by: Mackenzie Zastrow <[email protected]>
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