MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / agentops_decorator

Function agentops_decorator

camel/utils/commons.py:551–572  ·  view source on GitHub ↗

r"""Decorator that records the execution of a function if ToolEvent is available. Parameters: func (callable): The function to be decorated. Returns: callable: The wrapped function which records its execution details.

(func)

Source from the content-addressed store, hash-verified

549
550
551def agentops_decorator(func):
552 r"""Decorator that records the execution of a function if ToolEvent is
553 available.
554
555 Parameters:
556 func (callable): The function to be decorated.
557
558 Returns:
559 callable: The wrapped function which records its execution details.
560 """
561
562 @wraps(func)
563 def wrapper(*args, **kwargs):
564 if ToolEvent:
565 tool_event = ToolEvent(name=func.__name__, params=kwargs)
566 result = func(*args, **kwargs)
567 tool_event.returns = result
568 record(tool_event)
569 return result
570 return func(*args, **kwargs)
571
572 return wrapper
573
574
575class AgentOpsMeta(type):

Callers 1

__new__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected