BaseMiddleware autogen.beta.middleware.base.BaseMiddleware # BaseMiddleware(event, context) Source code in autogen/beta/middleware/base.py 42 43 44 45 46 47 48def __init__( self, event: "BaseEvent", context: "Context", ) -> None: self.initial_event = event self.context = context initial_event instance-attribute # initial_event = event context instance-attribute # context = context on_turn async # on_turn(call_next, event, context) Source code in autogen/beta/middleware/base.py 50 51 52 53 54 55 56async def on_turn( self, call_next: AgentTurn, event: "BaseEvent", context: "Context", ) -> "ModelResponse": return await call_next(event, context) on_tool_execution async # on_tool_execution(call_next, event, context) Source code in autogen/beta/middleware/base.py 58 59 60 61 62 63 64async def on_tool_execution( self, call_next: ToolExecution, event: "ToolCall", context: "Context", ) -> ToolResultType: return await call_next(event, context) on_llm_call async # on_llm_call(call_next, events, context) Source code in autogen/beta/middleware/base.py 66 67 68 69 70 71 72async def on_llm_call( self, call_next: LLMCall, events: "Sequence[BaseEvent]", context: "Context", ) -> "ModelResponse": return await call_next(events, context)