Skip to content

Conversation

@danielftapiar
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings August 10, 2025 17:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR appears to be a work-in-progress API iteration that introduces significant debugging output and a new decorator-based API for defining workflows and nodes. The changes include extensive print statements for debugging event flow and message processing, along with a comprehensive new decorator system for workflow definition.

  • Addition of extensive debugging print statements throughout the workflow execution pipeline
  • Implementation of a new decorator-based API system for defining workflows, nodes, and their relationships
  • Addition of traceback printing for better error debugging in workflow execution

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
grafi/workflows/impl/event_driven_workflow.py Adds debug print statements and traceback output for workflow event processing
grafi/nodes/node.py Adds debug print statement in node invocation
grafi/common/models/command.py Adds debug print statement for command message yielding
grafi/common/decorators/record_workflow_a_invoke.py Adds debug print statements for workflow invocation decorator
grafi/common/decorators/record_node_a_invoke.py Adds debug print statements for node invocation decorator
grafi/api/decorators.py Introduces new comprehensive decorator-based API for workflow and node definition

) -> MsgsAGen:
if self._a_invoke_impl is None:
raise NotImplementedError("Must provide `_a__invoke_impl` Callable.")
yield self._a_invoke_impl(self, invoke_context, input_data)
Copy link

Copilot AI Aug 10, 2025

Choose a reason for hiding this comment

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

The method _a_invoke_impl is being called with self as the first parameter, but it's defined as a Callable that expects (InvokeContext, List[Message]). This will cause a TypeError as the callable doesn't expect a self parameter.

Suggested change
yield self._a_invoke_impl(self, invoke_context, input_data)
yield self._a_invoke_impl(invoke_context, input_data)

Copilot uses AI. Check for mistakes.

all_subscibed_topics = {topic.name: False for topic in self.subscribed_topics}
available_topics = all_subscibed_topics | {topic.name: True for topic in topic_with_messahes}
return eval(self._node_condiiton, __builtins__ ={}, globals=None, locals=available_topics)
Copy link

Copilot AI Aug 10, 2025

Choose a reason for hiding this comment

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

There's a typo in the variable name _node_condiiton - it should be _node_condition to match the attribute defined in the constructor.

Suggested change
return eval(self._node_condiiton, __builtins__ ={}, globals=None, locals=available_topics)
return eval(self._node_condition, __builtins__ ={}, globals=None, locals=available_topics)

Copilot uses AI. Check for mistakes.

all_subscibed_topics = {topic.name: False for topic in self.subscribed_topics}
available_topics = all_subscibed_topics | {topic.name: True for topic in topic_with_messahes}
return eval(self._node_condiiton, __builtins__ ={}, globals=None, locals=available_topics)
Copy link

Copilot AI Aug 10, 2025

Choose a reason for hiding this comment

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

Using eval() with user-provided input is a security risk. Consider using a safer expression evaluation library like ast.literal_eval() or a dedicated expression parser to prevent code injection attacks.

Copilot uses AI. Check for mistakes.
consumed_events=consumed_events,
)
)
print("NDOE OUTPUT")
Copy link

Copilot AI Aug 10, 2025

Choose a reason for hiding this comment

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

Typo in debug message: 'NDOE' should be 'NODE'.

Suggested change
print("NDOE OUTPUT")
print("NODE OUTPUT")

Copilot uses AI. Check for mistakes.
_a_invoke_impl: Callable[[InvokeContext, List[Message]], MsgsAGen] = None

def __init__(self, tool_invoke: Callable[[InvokeContext, Messages], MsgsAGen], **kwargs):
super().__init__(name = "CallableTool", oi_span_type=OpenInferenceSpanKindValues.TOOL, type="CallableTool", **kwargs)
Copy link

Copilot AI Aug 10, 2025

Choose a reason for hiding this comment

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

[nitpick] Inconsistent spacing around the = operator. Should be consistent with Python PEP 8 style guide (no spaces around = in keyword arguments).

Suggested change
super().__init__(name = "CallableTool", oi_span_type=OpenInferenceSpanKindValues.TOOL, type="CallableTool", **kwargs)
super().__init__(name="CallableTool", oi_span_type=OpenInferenceSpanKindValues.TOOL, type="CallableTool", **kwargs)

Copilot uses AI. Check for mistakes.
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