MCPcopy Create free account
hub / github.com/AgentOps-AI/agentops / _process_async_generator

Function _process_async_generator

agentops/sdk/decorators/utility.py:52–60  ·  view source on GitHub ↗

Process an asynchronous generator and manage its span lifecycle

(span: trace.Span, context_token: Any, generator: types.AsyncGeneratorType)

Source from the content-addressed store, hash-verified

50
51
52async def _process_async_generator(span: trace.Span, context_token: Any, generator: types.AsyncGeneratorType):
53 """Process an asynchronous generator and manage its span lifecycle"""
54 try:
55 async for item in generator:
56 yield item
57 finally:
58 # Always ensure span is ended and context detached
59 span.end()
60 context_api.detach(context_token)
61
62
63def _get_current_span_info():

Callers 1

wrapperFunction · 0.90

Calls 1

endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…