OpenTelemetryAgent class

Provides a delegating AIAgent implementation that instruments agent operations via OpenTelemetryChatClient.

Inheritance
Available extensions

Constructors

OpenTelemetryAgent(AIAgent innerAgent, {String? sourceName})

Properties

debuggerDisplay String
no setterinherited
description String?
Gets a description of the agent's purpose and capabilities.
no setterinherited
enableSensitiveData bool
Whether potentially sensitive information should be included in telemetry.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
id String
Gets the unique identifier for this agent instance.
no setterinherited
idCore String?
A custom identifier for the agent, which derived classes can override.
no setterinherited
innerAgent AIAgent
The underlying agent that receives delegated operations.
finalinherited
name String?
Gets the human-readable name of the agent.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

asAIFunction({AIFunctionFactoryOptions? options, AgentSession? session}) → AIFunction

Available on AIAgent, provided by the AIAgentExtensions extension

Creates an AIFunction that runs this AIAgent.
asBuilder() AIAgentBuilder

Available on AIAgent, provided by the AIAgentExtensions extension

Creates a new AIAgentBuilder using this agent as the pipeline root.
createSession({CancellationToken? cancellationToken}) Future<AgentSession>
Creates a new conversation session compatible with this agent.
inherited
createSessionCore({CancellationToken? cancellationToken}) Future<AgentSession>
Core implementation of session creation logic.
inherited
deserializeSession(dynamic serializedState, {Object? jsonSerializerOptions, CancellationToken? cancellationToken}) Future<AgentSession>
Deserializes an agent session from a previously serialized state.
inherited
deserializeSessionCore(dynamic serializedState, {Object? jsonSerializerOptions, CancellationToken? cancellationToken}) Future<AgentSession>
Core implementation of session deserialization.
inherited
dispose() → void
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
evaluate(Iterable<String> queries, String evalName, Iterable<String>? expectedOutput, Iterable<Iterable<ExpectedToolCall>>? expectedToolCalls, CancellationToken cancellationToken, {AgentEvaluator? evaluator, ConversationSplitter? splitter, int? numRepetitions, ChatConfiguration? chatConfiguration, Iterable<AgentEvaluator>? evaluators, Iterable<AgentResponse>? responses}) Future<AgentEvaluationResults>

Available on AIAgent, provided by the AgentEvaluationExtensions extension

Evaluates an agent by running it against test queries and scoring the responses.
evaluateWithMeai(Iterable<String> queries, String evalName, Evaluator evaluator, ChatConfiguration chatConfiguration, {Iterable<String>? expectedOutput, Iterable<Iterable<ExpectedToolCall>>? expectedToolCalls, ConversationSplitter? splitter, int? numRepetitions, CancellationToken? cancellationToken}) Future<AgentEvaluationResults>

Available on AIAgent, provided by the AgentEvaluationExtensions extension

Wraps an MEAI Evaluator and evaluates this agent with it.
getService(Type serviceType, {Object? serviceKey}) Object?
Returns a service of the specified serviceType, or null.
inherited
getServiceOf<T extends Object>({Object? serviceKey}) → T?
Returns a service of type T, or null.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
run(AgentSession? session, AgentRunOptions? options, {CancellationToken? cancellationToken, String? message, Iterable<ChatMessage>? messages}) Future<AgentResponse>
Runs the agent with the provided messages and returns the full response.
inherited
runCore(Iterable<ChatMessage> messages, {AgentSession? session, AgentRunOptions? options, CancellationToken? cancellationToken}) Future<AgentResponse>
Core implementation of the agent invocation logic.
override
runCoreStreaming(Iterable<ChatMessage> messages, {AgentSession? session, AgentRunOptions? options, CancellationToken? cancellationToken}) Stream<AgentResponseUpdate>
Core implementation of the agent streaming invocation logic.
override
runStreaming(AgentSession? session, AgentRunOptions? options, {CancellationToken? cancellationToken, String? message, Iterable<ChatMessage>? messages}) Stream<AgentResponseUpdate>
Runs the agent in streaming mode.
inherited
runTyped<T>(AgentSession? session, {AgentRunOptions? options, CancellationToken? cancellationToken, String? message, Iterable<ChatMessage>? messages}) Future<AgentResponseOf<T>>

Available on AIAgent, provided by the AIAgentStructuredOutputExtensions extension

Runs the agent and attempts to deserialize the response as type T.
serializeSession(AgentSession session, {Object? jsonSerializerOptions, CancellationToken? cancellationToken}) Future
Serializes an agent session to a JSON-compatible map.
inherited
serializeSessionCore(AgentSession session, {Object? jsonSerializerOptions, CancellationToken? cancellationToken}) Future
Core implementation of session serialization.
inherited
toString() String
A string representation of this object.
inherited
updateCurrentActivity(Activity? previousActivity) → void
Augments the current activity with agent-specific information.

Operators

operator ==(Object other) bool
The equality operator.
inherited