Use AgentOps traces as Python context managers for automatic lifecycle management
with
statement for automatic trace lifecycle management. This approach ensures traces are properly started and ended, even when exceptions occur.
start_trace()
function:
with
block