Skip to content

Conversation

@zastrowm
Copy link
Member

@zastrowm zastrowm commented Jul 3, 2025

Description

Motivation: As I started adding new hook events, it started to become difficult to identify hook-based tests from general-purpose agent tests. To simplify things, I split out hook-related tests into test_agent_hooks.

Also updated the hook tests verify each hook-event individually to be more readable/easier to debug.

The intention of the following format is to make it easier to understand as we add new hook-events:

    events = hook_provider.get_events()
    assert len(events) == 2

    assert events.popleft() == StartRequestEvent(agent=agent)
    assert events.popleft() == EndRequestEvent(agent=agent)

when adding a new event, we sould increment the count but still keep the other events as-is:

    events = hook_provider.get_events()
    assert len(events) == 3

    assert events.popleft() == StartRequestEvent(agent=agent)
    assert events.popleft() == SomeMiddleEvent(agent=agent)
    assert events.popleft() == EndRequestEvent(agent=agent)

Related Issues

#231

Documentation PR

N/A

Type of Change

Other: 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.

Rather than keeping agent hook tests in the test_agent file, extract them out to a separate file for readability/better-separation-of-concerns.

Also updated the hook tests verify each hook-event individually to be more readable/easier to debug.
@zastrowm zastrowm merged commit 5190645 into strands-agents:main Jul 3, 2025
12 checks passed
jsamuel1 pushed a commit to jsamuel1/sdk-python that referenced this pull request Jul 9, 2025
Rather than keeping agent hook tests in the test_agent file, extract them out to a separate file for readability/better-separation-of-concerns.

Also updated the hook tests verify each hook-event individually to be more readable/easier to debug.
dbschmigelski pushed a commit to Ketansuhaas/sdk-python that referenced this pull request Jul 24, 2025
Rather than keeping agent hook tests in the test_agent file, extract them out to a separate file for readability/better-separation-of-concerns.

Also updated the hook tests verify each hook-event individually to be more readable/easier to debug.
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