@@ -286,7 +286,7 @@ async def _run_with_trace() -> AsyncGenerator[Event, None]:
286286 with tracer .start_as_current_span (f'invoke_agent { self .name } ' ) as span :
287287 ctx = self ._create_invocation_context (parent_context )
288288 tracing .trace_agent_invocation (span , self , ctx )
289- if event := await self .__handle_before_agent_callback (ctx ):
289+ if event := await self ._handle_before_agent_callback (ctx ):
290290 yield event
291291 if ctx .end_invocation :
292292 return
@@ -298,7 +298,7 @@ async def _run_with_trace() -> AsyncGenerator[Event, None]:
298298 if ctx .end_invocation :
299299 return
300300
301- if event := await self .__handle_after_agent_callback (ctx ):
301+ if event := await self ._handle_after_agent_callback (ctx ):
302302 yield event
303303
304304 async with Aclosing (_run_with_trace ()) as agen :
@@ -324,7 +324,7 @@ async def _run_with_trace() -> AsyncGenerator[Event, None]:
324324 with tracer .start_as_current_span (f'invoke_agent { self .name } ' ) as span :
325325 ctx = self ._create_invocation_context (parent_context )
326326 tracing .trace_agent_invocation (span , self , ctx )
327- if event := await self .__handle_before_agent_callback (ctx ):
327+ if event := await self ._handle_before_agent_callback (ctx ):
328328 yield event
329329 if ctx .end_invocation :
330330 return
@@ -333,7 +333,7 @@ async def _run_with_trace() -> AsyncGenerator[Event, None]:
333333 async for event in agen :
334334 yield event
335335
336- if event := await self .__handle_after_agent_callback (ctx ):
336+ if event := await self ._handle_after_agent_callback (ctx ):
337337 yield event
338338
339339 async with Aclosing (_run_with_trace ()) as agen :
@@ -438,7 +438,7 @@ def canonical_after_agent_callbacks(self) -> list[_SingleAgentCallback]:
438438 return self .after_agent_callback
439439 return [self .after_agent_callback ]
440440
441- async def __handle_before_agent_callback (
441+ async def _handle_before_agent_callback (
442442 self , ctx : InvocationContext
443443 ) -> Optional [Event ]:
444444 """Runs the before_agent_callback if it exists.
@@ -496,7 +496,7 @@ async def __handle_before_agent_callback(
496496
497497 return None
498498
499- async def __handle_after_agent_callback (
499+ async def _handle_after_agent_callback (
500500 self , invocation_context : InvocationContext
501501 ) -> Optional [Event ]:
502502 """Runs the after_agent_callback if it exists.
0 commit comments