refactor: remove agent termination graph specific handling#423
Merged
cotovanu-cristian merged 1 commit intomainfrom Jan 20, 2026
Merged
Conversation
e3666b4 to
854f8e7
Compare
854f8e7 to
82c3f59
Compare
Comment on lines
21
to
29
| @@ -28,6 +29,12 @@ | |||
| OutputType = dict[Literal["messages"], list[ToolMessage]] | Command[Any] | None | |||
Contributor
There was a problem hiding this comment.
we should actually use the ToolWrapperResult in the subsequent types
Comment on lines
+86
to
+111
| def _invoke_wrapper( | ||
| self, | ||
| wrapper: ToolWrapperType, | ||
| tool: BaseTool, | ||
| call: ToolCall, | ||
| state: AgentGraphState, | ||
| ) -> ToolWrapperResult: | ||
| """Invoke wrapper with or without state based on its signature.""" | ||
| if _wrapper_needs_state(wrapper): | ||
| filtered_state = self._filter_state(state, wrapper) | ||
| return wrapper(tool, call, filtered_state) | ||
| return wrapper(tool, call) | ||
|
|
||
| async def _invoke_wrapper_async( | ||
| self, | ||
| wrapper: AsyncToolWrapperType, | ||
| tool: BaseTool, | ||
| call: ToolCall, | ||
| state: AgentGraphState, | ||
| ) -> ToolWrapperResult: | ||
| """Invoke async wrapper with or without state based on its signature.""" | ||
| if _wrapper_needs_state(wrapper): | ||
| filtered_state = self._filter_state(state, wrapper) | ||
| return await wrapper(tool, call, filtered_state) | ||
| return await wrapper(tool, call) | ||
|
|
Contributor
There was a problem hiding this comment.
Could we not replace these with a prepare_wrapper_input -> Sequence(Any)
and then invoke wrapper/wrapper with (**inputs)?
8e0690d to
ef19584
Compare
…ion with exception
ef19584 to
9f06e1e
Compare
cristipufu
approved these changes
Jan 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed?