Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
bb9d06b
Adding design documents and data flow descriptions for sub-workflows
alliscode Aug 15, 2025
c1d50b1
Updating docs.
alliscode Aug 15, 2025
bd23068
Sub-workflow implementation #1. Stuck because of singleton RequestInf…
alliscode Aug 19, 2025
5955c9a
Removed the singleton restriction on RequestInfoExecutor so enable su…
alliscode Aug 19, 2025
eb8723b
Scenarios seem to be working.
alliscode Aug 19, 2025
09d5da6
Sample improved.
alliscode Aug 20, 2025
64383d7
going to have intern add generic response wrappers.
alliscode Aug 20, 2025
2d02fc2
Wrapped responses working.
alliscode Aug 20, 2025
89d2bc5
Non-hardcoded routing is working.
alliscode Aug 20, 2025
7fee8ba
Sample showing external approved and not approved.
alliscode Aug 20, 2025
ecd3e5e
Cleaning up.
alliscode Aug 20, 2025
bb02c82
Updating some samples and user guide.
alliscode Aug 20, 2025
78cebba
Removing old design doc.
alliscode Aug 20, 2025
be677ee
Cleaning up.
alliscode Aug 20, 2025
e9fd564
Merging from main
alliscode Aug 20, 2025
e267374
Adding python-package-setup.md back.
alliscode Aug 20, 2025
f466a0e
Update python/packages/workflow/agent_framework_workflow/_executor.py
alliscode Aug 20, 2025
51aebb8
Update python/packages/workflow/agent_framework_workflow/_validation.py
alliscode Aug 20, 2025
f54c1e8
Removing prints.
alliscode Aug 20, 2025
dd84e38
Fixing lint and type issues.
alliscode Aug 21, 2025
ff09a5c
Fixing lint and type issues.
alliscode Aug 21, 2025
2210550
Merging from updates in main.
alliscode Aug 21, 2025
3ee8f93
Update python/packages/workflow/agent_framework_workflow/_executor.py
alliscode Aug 21, 2025
cc21378
Adding type hints to intercepts decorator.
alliscode Aug 21, 2025
73f7887
Adding type hints to intercepts decorator.
alliscode Aug 21, 2025
3eb8a8e
Removing unused files.
alliscode Aug 21, 2025
1f9fc0f
Fixing issue with sample 5 groupchat with hil.
alliscode Aug 21, 2025
367b188
Removing redundent samples.
alliscode Aug 21, 2025
39edc97
Merge branch 'main' into bentho/sub-workflows
alliscode Aug 21, 2025
9958add
Updates to ensure no conflicting request interceptors and to support …
alliscode Aug 22, 2025
e85a692
Merge branch 'main' into bentho/sub-workflows
alliscode Aug 22, 2025
2c1c531
Fixing pypi errors.
alliscode Aug 22, 2025
cef4cab
Merge branch 'main' into bentho/sub-workflows
ekzhu Aug 23, 2025
fbcba5e
clean up samples
ekzhu Aug 23, 2025
dd4632c
update samples to make it more clear
ekzhu Aug 23, 2025
c1a4088
warning for unhandled request info from sub workflow
ekzhu Aug 23, 2025
c6f9ea0
add logger info
ekzhu Aug 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Cleaning up.
  • Loading branch information
alliscode committed Aug 20, 2025
commit ecd3e5e18b7d10201509e92ffe915b4530801f48
18 changes: 0 additions & 18 deletions .claude/settings.local.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@
"InProcRunnerContext",
"Message",
"RequestInfoEvent",
"RequestInfoEvent",
"RequestInfoExecutor",
"RequestInfoExecutor",
"RequestInfoMessage",
"RequestResponse",
Expand Down
26 changes: 0 additions & 26 deletions python/packages/workflow/agent_framework_workflow/_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ async def execute(self, message: Any, context: WorkflowContext) -> None:
Returns:
An awaitable that resolves to the result of the execution.
"""
# print(f"DEBUG: Executor {self.id} received message of type {type(message).__name__}")

# Lazy registration for SubWorkflowRequestInfo if we have interceptors
if self._request_interceptors and message.__class__.__name__ == "SubWorkflowRequestInfo":
Expand All @@ -70,11 +69,9 @@ async def execute(self, message: Any, context: WorkflowContext) -> None:
for message_type in self._handlers:
if is_instance_of(message, message_type):
handler = self._handlers[message_type]
# print(f"DEBUG: Found handler for {type(message).__name__}: {handler.__name__}")
break

if handler is None:
print(f"Executor DEBUG: Available handlers in {self.__class__.__name__}: {list(self._handlers.keys())}")
raise RuntimeError(f"Executor {self.__class__.__name__} cannot handle message of type {type(message)}.")
await context.add_event(ExecutorInvokeEvent(self.id))
await handler(message, context)
Expand Down Expand Up @@ -166,7 +163,6 @@ async def _handle_sub_workflow_request(
correlated_response = RequestResponse._with_correlation(response, request.data, request.request_id)

if correlated_response.handled:
print(f"DEBUG: Request {request.data} was handled, sending response")
# Send response back to sub-workflow
from ._runner_context import Message

Expand All @@ -178,18 +174,15 @@ async def _handle_sub_workflow_request(
data=correlated_response.data,
),
)
print(f"DEBUG: Sending response to target_id: {request.sub_workflow_id}")
await ctx.send_message(response_message)
else:
print(f"DEBUG: Request {request.data} being forwarded as external request")
# Forward WITH CONTEXT PRESERVED
# Update the data if interceptor provided a modified request
if correlated_response.forward_request:
request.data = correlated_response.forward_request

# Send the inner request to RequestInfoExecutor to create external request
# This will forward the original request (e.g., DomainCheckRequest) to RequestInfoExecutor
print(f"DEBUG: Forwarding {type(request.data).__name__} to RequestInfoExecutor")
# Send to known RequestInfoExecutor ID in the main workflow
from ._runner_context import Message

Expand Down Expand Up @@ -589,7 +582,6 @@ def __init__(self, id: str | None = None):
@handler
async def run(self, message: RequestInfoMessage, ctx: WorkflowContext) -> None:
"""Run the RequestInfoExecutor with the given message."""
print(f"DEBUG: RequestInfoExecutor {self.id} received {type(message).__name__}: {message}")
source_executor_id = ctx.get_source_executor_id()

event = RequestInfoEvent(
Expand Down Expand Up @@ -717,9 +709,6 @@ async def process_workflow(self, input_data: object, ctx: WorkflowContext) -> No

# Track this execution
self._active_executions += 1
print(
f"DEBUG: WorkflowExecutor {self.id} starting execution #{self._active_executions} with input: {type(input_data).__name__}"
)

try:
# Run the sub-workflow and collect all events
Expand All @@ -731,16 +720,12 @@ async def process_workflow(self, input_data: object, ctx: WorkflowContext) -> No
# Sub-workflow completed normally - send result to parent
await ctx.send_message(event.data)
self._active_executions -= 1
print(
f"DEBUG: WorkflowExecutor {self.id} completed execution, remaining: {self._active_executions}"
)
return # Exit after completion

if isinstance(event, RequestInfoEvent):
# Sub-workflow needs external information
# Track the pending request
self._pending_requests[event.request_id] = event.data
print(f"DEBUG: WorkflowExecutor {self.id} tracking external request {event.request_id}")

# Wrap request with routing context and send to parent
wrapped_request = SubWorkflowRequestInfo(
Expand All @@ -760,7 +745,6 @@ async def process_workflow(self, input_data: object, ctx: WorkflowContext) -> No
error_event = ExecutorEvent(executor_id=self.id, data={"error": str(e), "type": "sub_workflow_error"})
await ctx.add_event(error_event)
self._active_executions -= 1
print(f"DEBUG: WorkflowExecutor {self.id} failed execution, remaining: {self._active_executions}")
raise

@handler
Expand All @@ -778,39 +762,29 @@ async def handle_response(
response: The response to a previous request.
ctx: The workflow context.
"""
print(f"DEBUG: WorkflowExecutor {self.id} handle_response called for request {response.request_id}")

# Check if we have this pending request
pending_requests = getattr(self, "_pending_requests", {})
if response.request_id not in pending_requests:
print(f"DEBUG: WorkflowExecutor {self.id} received response for unknown request - ignoring")
return

# Remove the request from pending list
pending_requests.pop(response.request_id, None)
print(f"DEBUG: WorkflowExecutor {self.id} processing response, remaining pending: {len(pending_requests)}")

from ._events import WorkflowCompletedEvent

# Send responses to the sub-workflow and continue execution until completion
print(f"DEBUG: WorkflowExecutor {self.id} calling send_responses_streaming")
result_events = [
event async for event in self._workflow.send_responses_streaming({response.request_id: response.data})
]
print(f"DEBUG: WorkflowExecutor {self.id} got {len(result_events)} events from send_responses_streaming")

# Find the completion event and send result to parent
for event in result_events:
if isinstance(event, WorkflowCompletedEvent):
print(f"DEBUG: WorkflowExecutor {self.id} found completion event with data: {event.data}")
await ctx.send_message(event.data)
self._active_executions -= 1
print(
f"DEBUG: WorkflowExecutor {self.id} sent result to parent, remaining executions: {self._active_executions}"
)
return

print(f"DEBUG: WorkflowExecutor {self.id} no completion event found in {len(result_events)} events")


# endregion: Workflow Executor
163 changes: 0 additions & 163 deletions python/packages/workflow/debug_test.py

This file was deleted.

Loading