Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion alphatrion/tracing/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from alphatrion.tracing.tracing import task, workflow
from alphatrion.tracing.tracing import agent, task, tool, workflow

__all__ = [
"task",
"workflow",
"tool",
"agent",
]
40 changes: 40 additions & 0 deletions alphatrion/tracing/tracing.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import uuid

from opentelemetry.semconv_ai import TraceloopSpanKindValues
from traceloop.sdk.decorators import agent as _agent
from traceloop.sdk.decorators import task as _task
from traceloop.sdk.decorators import tool as _tool
from traceloop.sdk.decorators import workflow as _workflow


Expand Down Expand Up @@ -49,3 +51,41 @@ def decorator(func):
)(func)

return decorator


def tool(
version: int | None = None,
method_name: str | None = None,
):
"""Tool decorator for tracing.

Attributes (run_id, team_id, experiment_id) are automatically
added to all spans by ContextAttributesSpanProcessor.
"""

def decorator(func):
return _tool(
version=version,
method_name=method_name,
)(func)

return decorator


def agent(
version: int | None = None,
method_name: str | None = None,
):
"""Agent decorator for tracing.

Attributes (run_id, team_id, experiment_id) are automatically
added to all spans by ContextAttributesSpanProcessor.
"""

def decorator(func):
return _agent(
version=version,
method_name=method_name,
)(func)

return decorator
Loading