@voltagent/core 1.1.7-next.1 → 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3649,14 +3649,10 @@ var VoltAgentObservability = class {
3649
3649
  try {
3650
3650
  bridgeInitializer(this.loggerProvider);
3651
3651
  } catch (error) {
3652
- console.error("[VoltAgentObservability] \u274C Failed to initialize Pino bridge:", error);
3653
3652
  this.logger.error("[VoltAgentObservability] Failed to initialize Pino bridge", { error });
3654
3653
  }
3655
3654
  } else {
3656
- console.warn(
3657
- "[VoltAgentObservability] \u26A0\uFE0F Pino OpenTelemetry bridge not available - @voltagent/logger may not be installed"
3658
- );
3659
- this.logger.warn("[VoltAgentObservability] Pino OpenTelemetry bridge not available");
3655
+ this.logger.trace("[VoltAgentObservability] Pino OpenTelemetry bridge not available");
3660
3656
  }
3661
3657
  }
3662
3658
  /**
@@ -8015,10 +8011,24 @@ var AgentTraceContext = class {
8015
8011
  constructor(observability, operationName, options) {
8016
8012
  this.observability = observability;
8017
8013
  this.tracer = observability.getTracer();
8014
+ const isSubagent = !!options.parentSpan;
8018
8015
  this.commonAttributes = {
8019
- "entity.id": options.agentId,
8020
- "entity.type": "agent",
8021
- "entity.name": options.agentName,
8016
+ // Root entity attributes - only for root agents
8017
+ ...!isSubagent && {
8018
+ "entity.id": options.agentId,
8019
+ "entity.type": "agent",
8020
+ "entity.name": options.agentName
8021
+ },
8022
+ // Subagent attributes - with different namespace
8023
+ ...isSubagent && {
8024
+ "subagent.id": options.agentId,
8025
+ "subagent.name": options.agentName,
8026
+ "subagent.type": "agent",
8027
+ // Keep parent's entity info for filtering - this ensures traces are associated with root agent
8028
+ "entity.id": options.parentAgentId,
8029
+ "entity.type": "agent"
8030
+ },
8031
+ // Common attributes
8022
8032
  ...options.userId && { "user.id": options.userId },
8023
8033
  ...options.conversationId && { "conversation.id": options.conversationId },
8024
8034
  ...options.parentAgentId && { "agent.parent.id": options.parentAgentId },
@@ -8032,14 +8042,17 @@ var AgentTraceContext = class {
8032
8042
  const inputStr = typeof options.input === "string" ? options.input : (0, import_internal5.safeStringify)(options.input);
8033
8043
  spanAttributes.input = inputStr;
8034
8044
  }
8045
+ const spanName = options.parentSpan ? `subagent:${options.agentName || operationName}` : operationName;
8035
8046
  this.rootSpan = this.tracer.startSpan(
8036
- operationName,
8047
+ spanName,
8037
8048
  {
8038
8049
  kind: import_api7.SpanKind.INTERNAL,
8039
8050
  attributes: {
8040
8051
  ...spanAttributes,
8041
- "agent.state": "running"
8052
+ "agent.state": "running",
8042
8053
  // Track initial agent state
8054
+ // Mark as subagent if we have a parent span
8055
+ ...options.parentSpan && { "agent.is_subagent": true }
8043
8056
  }
8044
8057
  },
8045
8058
  parentContext