Feature
Companion object implementing the AIAgentFeature interface to provide OpenTelemetry specific functionality for agents. It manages spans and contexts to trace and monitor the lifecycle of agent executions, nodes, LLM calls, and tool invocations.
This class handles:
Initialization and configuration of OpenTelemetry agents.
Interception and tracing of agent lifecycle events such as agent start, finish, run errors, and various activities like node execution, LLM calls, and tool calls.
Management of spans and contexts for monitoring and lifecycle completion.
The implementation includes private utility methods for ensuring spans are handled correctly and resources are properly released.