Skip to content

Commit 810ddc6

Browse files
committed
Remove unused on_event callback from orchestration_manager
Deleted the unified event callback function and its related code from OrchestrationManager, as it is no longer used in the workflow assembly. The .on_event() attachment is commented out, reflecting a shift to a different event handling approach.
1 parent b7baae9 commit 810ddc6

File tree

1 file changed

+0
-42
lines changed

1 file changed

+0
-42
lines changed

src/backend/v4/orchestration/orchestration_manager.py

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -121,52 +121,10 @@ async def init_orchestration(cls, agents: List, user_id: str | None = None):
121121
participants[name] = ag
122122
cls.logger.debug("Added participant '%s'", name)
123123

124-
# Create unified event callback for Magentic workflow
125-
async def on_event(event) -> None:
126-
"""
127-
Handle all Magentic workflow events and route them to appropriate handlers.
128-
This replaces the old callback attachment approach with the proper event-based system.
129-
"""
130-
try:
131-
if isinstance(event, MagenticOrchestratorMessageEvent):
132-
# Orchestrator messages (task assignments, coordination)
133-
message_text = getattr(event.message, 'text', '')
134-
cls.logger.info(f"[ORCHESTRATOR:{event.kind}] {message_text}")
135-
136-
elif isinstance(event, MagenticAgentDeltaEvent):
137-
# Streaming update from agent - convert to our format
138-
# MagenticAgentDeltaEvent has: agent_id, text, and other properties
139-
try:
140-
await streaming_agent_response_callback(
141-
event.agent_id,
142-
event, # Pass the event itself as the update object
143-
False, # Not final yet (streaming in progress)
144-
user_id
145-
)
146-
except Exception as e:
147-
cls.logger.error(f"Error in streaming callback for agent {event.agent_id}: {e}")
148-
149-
elif isinstance(event, MagenticAgentMessageEvent):
150-
# Final agent message - complete response
151-
if event.message:
152-
try:
153-
agent_response_callback(event.agent_id, event.message, user_id)
154-
except Exception as e:
155-
cls.logger.error(f"Error in agent callback for agent {event.agent_id}: {e}")
156-
157-
elif isinstance(event, MagenticFinalResultEvent):
158-
# Final result from the entire workflow
159-
final_text = getattr(event.message, 'text', '')
160-
cls.logger.info(f"[FINAL RESULT] Length: {len(final_text)} chars")
161-
162-
except Exception as e:
163-
cls.logger.error(f"Error in on_event callback: {e}", exc_info=True)
164-
165124
# Assemble workflow with .on_event() callback (proper way for agent_framework)
166125
builder = (
167126
MagenticBuilder()
168127
.participants(**participants)
169-
#.on_event(on_event) # Enable streaming events
170128
.with_standard_manager(manager=manager)
171129
)
172130

0 commit comments

Comments
 (0)