From 97f06eab4c9d70161f514af534ab424f6450c7ac Mon Sep 17 00:00:00 2001 From: kerthcet Date: Mon, 1 Jun 2026 15:18:54 +0800 Subject: [PATCH 1/3] add agent and tool Signed-off-by: kerthcet --- alphatrion/tracing/tracing.py | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/alphatrion/tracing/tracing.py b/alphatrion/tracing/tracing.py index 2cb799af..7897f5e4 100644 --- a/alphatrion/tracing/tracing.py +++ b/alphatrion/tracing/tracing.py @@ -3,6 +3,8 @@ from opentelemetry.semconv_ai import TraceloopSpanKindValues from traceloop.sdk.decorators import task as _task from traceloop.sdk.decorators import workflow as _workflow +from traceloop.sdk.decorators import agent as _agent +from traceloop.sdk.decorators import tool as _tool def task( @@ -49,3 +51,39 @@ 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 From 71a788d460d8f3cddc3dcb715c09904e8b62db0d Mon Sep 17 00:00:00 2001 From: kerthcet Date: Mon, 1 Jun 2026 15:20:48 +0800 Subject: [PATCH 2/3] upate lint Signed-off-by: kerthcet --- alphatrion/tracing/tracing.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/alphatrion/tracing/tracing.py b/alphatrion/tracing/tracing.py index 7897f5e4..91f99417 100644 --- a/alphatrion/tracing/tracing.py +++ b/alphatrion/tracing/tracing.py @@ -1,10 +1,10 @@ import uuid from opentelemetry.semconv_ai import TraceloopSpanKindValues -from traceloop.sdk.decorators import task as _task -from traceloop.sdk.decorators import workflow as _workflow 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 def task( @@ -52,6 +52,7 @@ def decorator(func): return decorator + def tool( version: int | None = None, method_name: str | None = None, @@ -70,6 +71,7 @@ def decorator(func): return decorator + def agent( version: int | None = None, method_name: str | None = None, From 1e7af0010514924a76fd890877ca335cc8a26b1d Mon Sep 17 00:00:00 2001 From: kerthcet Date: Mon, 1 Jun 2026 15:24:39 +0800 Subject: [PATCH 3/3] expose agent tool Signed-off-by: kerthcet --- alphatrion/tracing/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/alphatrion/tracing/__init__.py b/alphatrion/tracing/__init__.py index 3f98b5a5..12a55b11 100644 --- a/alphatrion/tracing/__init__.py +++ b/alphatrion/tracing/__init__.py @@ -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", ]