From 13d7036f292b0b5d38fd8d81e55529666e68c85c Mon Sep 17 00:00:00 2001 From: Nagkumar Arkalgud Date: Tue, 10 Mar 2026 16:13:28 -0700 Subject: [PATCH] Enhance AzureAIOpenTelemetryTracer initialization with agent_id and node tracing Update the tracer creation in LangGraphAdapter.init_tracing_internal to use additional available parameters: - agent_id: from AGENT_ID env var for agent identity tracking - trace_all_langgraph_nodes: True (since this is a LangGraph adapter) This provides richer telemetry data including agent identity and full LangGraph node tracing by default. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../azure/ai/agentserver/langgraph/langgraph.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdk/agentserver/azure-ai-agentserver-langgraph/azure/ai/agentserver/langgraph/langgraph.py b/sdk/agentserver/azure-ai-agentserver-langgraph/azure/ai/agentserver/langgraph/langgraph.py index 0d2b60bac248..72992a68f68f 100644 --- a/sdk/agentserver/azure-ai-agentserver-langgraph/azure/ai/agentserver/langgraph/langgraph.py +++ b/sdk/agentserver/azure-ai-agentserver-langgraph/azure/ai/agentserver/langgraph/langgraph.py @@ -67,10 +67,14 @@ def init_tracing_internal(self, exporter_endpoint=None, app_insights_conn_str=No try: from langchain_azure_ai.callbacks.tracers import AzureAIOpenTelemetryTracer + agent_id = os.environ.get(Constants.AGENT_ID) + self.azure_ai_tracer = AzureAIOpenTelemetryTracer( connection_string=app_insights_conn_str, enable_content_recording=True, name=self.get_agent_identifier(), + agent_id=agent_id, + trace_all_langgraph_nodes=True, ) logger.info("AzureAIOpenTelemetryTracer initialized successfully.") except Exception as e: