Skip to content

Conversation

@pgrayy
Copy link
Member

@pgrayy pgrayy commented Nov 7, 2025

Description

Moving InterruptState out of the agent subpackage and into the top level interrupt.py module as Graph and Swarm will also be needing it. Also officially making the class private.

Related Issues

#204

Documentation PR

Not necessary as this is an implementation detail.

Type of Change

Other (please describe): Code reorganization.

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: Updated the unit tests
  • I ran hatch test tests_integ/interrupts/*.py

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.

self._end_agent_trace_span(error=e)
raise

def _resume_interrupt(self, prompt: AgentInput) -> None:
Copy link
Member Author

@pgrayy pgrayy Nov 7, 2025

Choose a reason for hiding this comment

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

Made this a member method of InterruptState as Graph and Swarm will also need to run it. See copy and paste further down.

@@ -1,59 +0,0 @@
"""Track the state of interrupt events raised by the user for human-in-the-loop workflows."""
Copy link
Member Author

@pgrayy pgrayy Nov 7, 2025

Choose a reason for hiding this comment

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

Contents moved to ../interrupt.py. See further down.

@codecov
Copy link

codecov bot commented Nov 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!



@dataclass
class _InterruptState:
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a copy and paste from ./agent/interrupt.py. The resume method is a copy and paste from Agent._resume_interrupt.

Copy link
Member Author

@pgrayy pgrayy Nov 7, 2025

Choose a reason for hiding this comment

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

Customers have not been given any reason to instantiate this class directly and so I would not consider it a breaking change to move it and make it private.

Copy link
Member

Choose a reason for hiding this comment

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

We should be defaulting to private going forward and really scrutinizing this stuff going foward. Stuff like this isn't breaking from "our" perspective, but customers don't know that (AFAIK)

I would also argue this is a Python problem in general, but sigh

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes definitely agree.

@@ -1,61 +0,0 @@
import pytest
Copy link
Member Author

@pgrayy pgrayy Nov 7, 2025

Choose a reason for hiding this comment

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

Tests moved to ../test_interrupt.py. See further down below.

assert tru_dict == exp_dict


def test_interrupt_state_activate():
Copy link
Member Author

@pgrayy pgrayy Nov 7, 2025

Choose a reason for hiding this comment

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

These tests are a copy and paste from ./agent/test_interrupt.py

assert tru_state == exp_state


def test_interrupt_state_resume():
Copy link
Member Author

Choose a reason for hiding this comment

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

The resume tests are copied from ./agent/test_agent.py

@pgrayy pgrayy marked this pull request as ready for review November 7, 2025 05:30


@dataclass
class _InterruptState:
Copy link
Member

Choose a reason for hiding this comment

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

We should be defaulting to private going forward and really scrutinizing this stuff going foward. Stuff like this isn't breaking from "our" perspective, but customers don't know that (AFAIK)

I would also argue this is a Python problem in general, but sigh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants