| | | 1 | | namespace NexusLabs.Needlr.AgentFramework.Iterative; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// The result of executing a single tool call within an iteration of an |
| | | 5 | | /// <see cref="IIterativeAgentLoop"/>. |
| | | 6 | | /// </summary> |
| | | 7 | | /// <remarks> |
| | | 8 | | /// <para> |
| | | 9 | | /// Tool call results are ephemeral — they are available via |
| | | 10 | | /// <see cref="IterativeContext.LastToolResults"/> for exactly one iteration (the next one). |
| | | 11 | | /// The prompt factory decides whether to embed them in the next prompt. |
| | | 12 | | /// </para> |
| | | 13 | | /// <para> |
| | | 14 | | /// When a tool call fails (exception or unknown function), <see cref="Succeeded"/> is |
| | | 15 | | /// <see langword="false"/> and <see cref="ErrorMessage"/> contains the failure reason. |
| | | 16 | | /// The loop does not abort on tool failure — subsequent tool calls in the same response |
| | | 17 | | /// are still executed. |
| | | 18 | | /// </para> |
| | | 19 | | /// </remarks> |
| | | 20 | | /// <param name="FunctionName">The name of the tool/function that was called.</param> |
| | | 21 | | /// <param name="Arguments"> |
| | | 22 | | /// The arguments the model provided for the tool call. Keys are parameter names; |
| | | 23 | | /// values are the deserialized argument values. |
| | | 24 | | /// </param> |
| | | 25 | | /// <param name="Result"> |
| | | 26 | | /// The return value from the tool execution, or <see langword="null"/> if the tool |
| | | 27 | | /// returned void or the call failed. |
| | | 28 | | /// </param> |
| | | 29 | | /// <param name="Duration">Wall-clock time for the tool execution.</param> |
| | | 30 | | /// <param name="Succeeded">Whether the tool call completed without throwing.</param> |
| | | 31 | | /// <param name="ErrorMessage"> |
| | | 32 | | /// The exception message if the tool call failed; <see langword="null"/> on success. |
| | | 33 | | /// </param> |
| | 166 | 34 | | public sealed record ToolCallResult( |
| | 11 | 35 | | string FunctionName, |
| | 16 | 36 | | IReadOnlyDictionary<string, object?> Arguments, |
| | 118 | 37 | | object? Result, |
| | 0 | 38 | | TimeSpan Duration, |
| | 125 | 39 | | bool Succeeded, |
| | 174 | 40 | | string? ErrorMessage); |