Skip to content

refactor: remove agent termination graph specific handling#423

Merged
cotovanu-cristian merged 1 commit intomainfrom
refactor/remove-agent-termination-handling
Jan 20, 2026
Merged

refactor: remove agent termination graph specific handling#423
cotovanu-cristian merged 1 commit intomainfrom
refactor/remove-agent-termination-handling

Conversation

@cotovanu-cristian
Copy link
Copy Markdown
Collaborator

@cotovanu-cristian cotovanu-cristian commented Jan 16, 2026

What changed?

  • remove agent termination from state and propagation from escalation_tool
  • refactor wrappers to not enforce state in the contract if not needed

@cotovanu-cristian cotovanu-cristian force-pushed the refactor/remove-agent-termination-handling branch 3 times, most recently from e3666b4 to 854f8e7 Compare January 20, 2026 11:33
@cotovanu-cristian cotovanu-cristian marked this pull request as ready for review January 20, 2026 11:33
@cotovanu-cristian cotovanu-cristian force-pushed the refactor/remove-agent-termination-handling branch from 854f8e7 to 82c3f59 Compare January 20, 2026 11:35
Comment on lines 21 to 29
@@ -28,6 +29,12 @@
OutputType = dict[Literal["messages"], list[ToolMessage]] | Command[Any] | None
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we not replace these with a prepare_wrapper_input -> Sequence(Any)
and then invoke wrapper/wrapper with (**inputs)?

@cotovanu-cristian cotovanu-cristian force-pushed the refactor/remove-agent-termination-handling branch 6 times, most recently from 8e0690d to ef19584 Compare January 20, 2026 17:48
@cotovanu-cristian cotovanu-cristian force-pushed the refactor/remove-agent-termination-handling branch from ef19584 to 9f06e1e Compare January 20, 2026 17:49
@cotovanu-cristian cotovanu-cristian merged commit 1a609a5 into main Jan 20, 2026
81 of 83 checks passed
@cotovanu-cristian cotovanu-cristian deleted the refactor/remove-agent-termination-handling branch January 20, 2026 18:02
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.

3 participants