Skip to content

A programming framework for agentic AI

Remove otel semcov package from core dependencies (#6775)

Eric Zhuf881d8a80dfd
diff --git a/python/packages/autogen-core/pyproject.toml b/python/packages/autogen-core/pyproject.toml
index 0dc7e4797..59a72fcc3 100644
--- a/python/packages/autogen-core/pyproject.toml
+++ b/python/packages/autogen-core/pyproject.toml
@@ -21,7 +21,6 @@ dependencies = [
"protobuf~=5.29.3",
"opentelemetry-api>=1.34.1",
"jsonref~=1.1.0",
- "opentelemetry-semantic-conventions==0.55b1",
]
diff --git a/python/packages/autogen-core/src/autogen_core/_telemetry/_genai.py b/python/packages/autogen-core/src/autogen_core/_telemetry/_genai.py
index bffc2dbcc..ccbb5a353 100644
--- a/python/packages/autogen-core/src/autogen_core/_telemetry/_genai.py
+++ b/python/packages/autogen-core/src/autogen_core/_telemetry/_genai.py
@@ -1,24 +1,46 @@
from collections.abc import Generator
from contextlib import contextmanager
+from enum import Enum
from typing import Any, Optional
from opentelemetry import trace
-from opentelemetry.semconv._incubating.attributes.gen_ai_attributes import (
- GEN_AI_AGENT_DESCRIPTION,
- GEN_AI_AGENT_ID,
- GEN_AI_AGENT_NAME,
- GEN_AI_OPERATION_NAME,
- GEN_AI_SYSTEM,
- GEN_AI_TOOL_CALL_ID,
- GEN_AI_TOOL_DESCRIPTION,
- GEN_AI_TOOL_NAME,
- GenAiOperationNameValues,
-)
-from opentelemetry.semconv.attributes.error_attributes import ERROR_TYPE
from opentelemetry.trace import Span, SpanKind
from .._agent_instantiation import AgentInstantiationContext
+# OpenTelemetry semantic convention constants for GenAI operations
+# Copied from opentelemetry-semantic-conventions to avoid dependency
+
+# GenAI Agent attributes
+GEN_AI_AGENT_DESCRIPTION = "gen_ai.agent.description"
+GEN_AI_AGENT_ID = "gen_ai.agent.id"
+GEN_AI_AGENT_NAME = "gen_ai.agent.name"
+
+# GenAI Operation attributes
+GEN_AI_OPERATION_NAME = "gen_ai.operation.name"
+GEN_AI_SYSTEM = "gen_ai.system"
+
+# GenAI Tool attributes
+GEN_AI_TOOL_CALL_ID = "gen_ai.tool.call.id"
+GEN_AI_TOOL_DESCRIPTION = "gen_ai.tool.description"
+GEN_AI_TOOL_NAME = "gen_ai.tool.name"
+
+# Error attributes
+ERROR_TYPE = "error.type"
+
+
+class GenAiOperationNameValues(Enum):
+ """Enum for GenAI operation name values."""
+
+ CHAT = "chat"
+ CREATE_AGENT = "create_agent"
+ EMBEDDINGS = "embeddings"
+ EXECUTE_TOOL = "execute_tool"
+ GENERATE_CONTENT = "generate_content"
+ INVOKE_AGENT = "invoke_agent"
+ TEXT_COMPLETION = "text_completion"
+
+
# Constant for system name
GENAI_SYSTEM_AUTOGEN = "autogen"
diff --git a/python/uv.lock b/python/uv.lock
index f02ffde15..14b1db90a 100644
--- a/python/uv.lock
+++ b/python/uv.lock
@@ -484,7 +484,6 @@ source = { editable = "packages/autogen-core" }
dependencies = [
{ name = "jsonref" },
{ name = "opentelemetry-api" },
- { name = "opentelemetry-semantic-conventions" },
{ name = "pillow" },
{ name = "protobuf" },
{ name = "pydantic" },
@@ -530,7 +529,6 @@ dev = [
requires-dist = [
{ name = "jsonref", specifier = "~=1.1.0" },
{ name = "opentelemetry-api", specifier = ">=1.34.1" },
- { name = "opentelemetry-semantic-conventions", specifier = "==0.55b1" },
{ name = "pillow", specifier = ">=11.0.0" },
{ name = "protobuf", specifier = "~=5.29.3" },
{ name = "pydantic", specifier = ">=2.10.0,<3.0.0" },