Skip to content

Conversation

@ya-hn
Copy link
Contributor

@ya-hn ya-hn commented Dec 16, 2025

Also reverts previous changes made to conversation histories by storing error messages separately from the agent memory.

Reverts previous changes by storing error messages separately from the
agent memory.
@ya-hn ya-hn requested a review from a team as a code owner December 16, 2025 15:02
if self.error_handling == ErrorHandlingMode.FAIL.name:
ctx.set_warning(str(e))
else:
errors.append(str(e))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

With this, validation errors for mode "FAIL" are displayed as warnings and validation errors for mode "ERROR COLUMN" are included as errors in the error column and not shown as warnings. This makes sense to me but we could also show these as warning in both modes.

default_value=False,
since_version="5.10.0",
is_advanced=True,
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could also add a rule to only show this if re-execution trigger is set, because otherwise the node does not create output data. But the output table schema is independent from the other parameter so I think it makes more sense without a rule.

)

def _fill_memory_with_messages(
self, agent, view_data, data_registry, tool_converter
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we could use

from __future__ import annotations
from typing import TYPE_CHECKING

to have typehints without performance issues due to the imports. I didn't do it yet because I was not sure if there are any drawbacks.

"configurable": {"thread_id": "1"},
}
previous_messages = []
error_messages = {}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fill these by passing them into the functions below. I could see how this is bad style because it is not obvious outside of the functions, but I am not sure about it.

history_df = history_table[self.conversation_column].to_pandas()

for msg in history_df[self.conversation_column]:
if msg:
Copy link
Contributor Author

@ya-hn ya-hn Dec 16, 2025

Choose a reason for hiding this comment

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

This changes the behavior of the Agent Prompter slightly because now missing values are simply ignored (in both error handling modes). But I don't think this creates any problems. And it makes sense to me because a conversation table with error column might contain missing values in the conversation column but should still be a valid input for an Agent Prompter that uses mode "FAIL".

Copy link
Contributor

@AtR1an AtR1an left a comment

Choose a reason for hiding this comment

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

I didn't review all the code but from the parts I saw it's clear to me that we reached the point where we need to refactor in order to manage the complexity and improve readability. We probably should've done that already but now I feel that it's crucial to keep this maintainable and extendable.

default_value="Conversation",
).rule(knext.DialogContextCondition(has_conversation_table), knext.Effect.HIDE)

error_handling = knext.EnumParameter(
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be possible to extract the error handling related parameters in to a parameter group?

else:
return knext.Schema.from_columns(
[
knext.Column(_message_type(), self.conversation_column),
Copy link
Contributor

Choose a reason for hiding this comment

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

the line for the conversation column exists multiple times. That makes the logic look way harder than it actually is. There is always a conversation column and if we want to output the error column, there is also an error column.

f"An error occurred while executing the agent: {e}"
)
error_message = f"An error occurred while executing the agent: {e}"
if self.error_handling == ErrorHandlingMode.FAIL.name:
Copy link
Contributor

Choose a reason for hiding this comment

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

All of the if self.error_handling switches could be abstracted into a separate class that encapsulates the error handling logic and makes the node's logic simpler. It could also be easily unit tested.

output_column,
messages,
history_table,
history_df,
Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't history_table and history_df referring to the same thing?

]
}
conversation_table = self._create_conversation_table(
output_column_name,
Copy link
Contributor

Choose a reason for hiding this comment

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

The ´output_column_name´ can be constructed inside self._create_conversation_table.

history_table,
history_df,
errors,
num_messages_before,
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't that the number of rows of history_df / history_table?

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