Skip to content

ToolCallResult

NexusLabs.Needlr.AgentFramework

NexusLabs.Needlr.AgentFramework.Iterative

ToolCallResult Class

The result of executing a single tool call within an iteration of an IIterativeAgentLoop.

public sealed record ToolCallResult : System.IEquatable<NexusLabs.Needlr.AgentFramework.Iterative.ToolCallResult>

Inheritance System.Object 🡒 ToolCallResult

Implements System.IEquatable<ToolCallResult>

Remarks

Tool call results are ephemeral — they are available via LastToolResults for exactly one iteration (the next one). The prompt factory decides whether to embed them in the next prompt.

When a tool call fails (exception or unknown function), Succeeded is false and ErrorMessage contains the failure reason. The loop does not abort on tool failure — subsequent tool calls in the same response are still executed.

Constructors

ToolCallResult(string, IReadOnlyDictionary<string,object>, object, TimeSpan, bool, string) Constructor

The result of executing a single tool call within an iteration of an IIterativeAgentLoop.

public ToolCallResult(string FunctionName, System.Collections.Generic.IReadOnlyDictionary<string,object?> Arguments, object? Result, System.TimeSpan Duration, bool Succeeded, string? ErrorMessage);

Parameters

FunctionName System.String

The name of the tool/function that was called.

Arguments System.Collections.Generic.IReadOnlyDictionary<System.String,System.Object>

The arguments the model provided for the tool call. Keys are parameter names; values are the deserialized argument values.

Result System.Object

The return value from the tool execution, or null if the tool returned void or the call failed.

Duration System.TimeSpan

Wall-clock time for the tool execution.

Succeeded System.Boolean

Whether the tool call completed without throwing.

ErrorMessage System.String

The exception message if the tool call failed; null on success.

Remarks

Tool call results are ephemeral — they are available via LastToolResults for exactly one iteration (the next one). The prompt factory decides whether to embed them in the next prompt.

When a tool call fails (exception or unknown function), Succeeded is false and ErrorMessage contains the failure reason. The loop does not abort on tool failure — subsequent tool calls in the same response are still executed.

Properties

ToolCallResult.Arguments Property

The arguments the model provided for the tool call. Keys are parameter names; values are the deserialized argument values.

public System.Collections.Generic.IReadOnlyDictionary<string,object?> Arguments { get; init; }

Property Value

System.Collections.Generic.IReadOnlyDictionary<System.String,System.Object>

ToolCallResult.Duration Property

Wall-clock time for the tool execution.

public System.TimeSpan Duration { get; init; }

Property Value

System.TimeSpan

ToolCallResult.ErrorMessage Property

The exception message if the tool call failed; null on success.

public string? ErrorMessage { get; init; }

Property Value

System.String

ToolCallResult.FunctionName Property

The name of the tool/function that was called.

public string FunctionName { get; init; }

Property Value

System.String

ToolCallResult.Result Property

The return value from the tool execution, or null if the tool returned void or the call failed.

public object? Result { get; init; }

Property Value

System.Object

ToolCallResult.Succeeded Property

Whether the tool call completed without throwing.

public bool Succeeded { get; init; }

Property Value

System.Boolean