-
Notifications
You must be signed in to change notification settings - Fork 463
share interrupt state #1148
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
base: main
Are you sure you want to change the base?
share interrupt state #1148
Conversation
| self._end_agent_trace_span(error=e) | ||
| raise | ||
|
|
||
| def _resume_interrupt(self, prompt: AgentInput) -> None: |
There was a problem hiding this comment.
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.""" | |||
There was a problem hiding this comment.
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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
|
||
|
|
||
| @dataclass | ||
| class _InterruptState: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 | |||
There was a problem hiding this comment.
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(): |
There was a problem hiding this comment.
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(): |
There was a problem hiding this comment.
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
|
|
||
|
|
||
| @dataclass | ||
| class _InterruptState: |
There was a problem hiding this comment.
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
Description
Moving
InterruptStateout of the agent subpackage and into the top levelinterrupt.pymodule asGraphandSwarmwill 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
hatch run prepare: Updated the unit testshatch test tests_integ/interrupts/*.pyChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.