< Summary

Information
Class: Elsa.AI.Abstractions.Models.AIToolExecutionContext
Assembly: Elsa.AI.Abstractions
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.AI.Abstractions/Models/AIToolDefinition.cs
Line coverage
100%
Covered lines: 5
Uncovered lines: 0
Coverable lines: 5
Total lines: 109
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_ConversationId()100%11100%
get_TenantId()100%11100%
get_ActorId()100%11100%
get_Agent()100%11100%
get_Arguments()100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.AI.Abstractions/Models/AIToolDefinition.cs

#LineLine coverage
 1namespace Elsa.AI.Abstractions.Models;
 2
 3public record AIToolDefinition
 4{
 5    public string Name { get; init; } = "";
 6    public string DisplayName { get; init; } = "";
 7    public string Description { get; init; } = "";
 8    public JsonObject Schema { get; init; } = [];
 9    public AIToolMutability Mutability { get; init; } = AIToolMutability.ReadOnly;
 10    public AIToolDangerLevel DangerLevel { get; init; } = AIToolDangerLevel.Low;
 11    public ICollection<string> Permissions { get; init; } = [];
 12    public AITenantBehavior TenantBehavior { get; init; } = AITenantBehavior.TenantScoped;
 13    public AIToolAuditBehavior AuditBehavior { get; init; } = AIToolAuditBehavior.RecordInvocation;
 14    public ICollection<string> AgentScopes { get; init; } = [];
 15    public ICollection<string> TenantIds { get; init; } = [];
 16    public ICollection<string> ActorIds { get; init; } = [];
 17    public string? Provider { get; init; }
 18    public bool EnabledByDefault { get; init; }
 19    public bool IsEnabled { get; init; }
 20}
 21
 22public record AIToolInvocation
 23{
 24    public string Id { get; init; } = default!;
 25    public string ConversationId { get; init; } = default!;
 26    public string ToolName { get; init; } = default!;
 27    public JsonObject Arguments { get; init; } = [];
 28    public AIToolAuthorizationResult AuthorizationResult { get; init; } = AIToolAuthorizationResult.NotEvaluated;
 29    public DateTimeOffset StartedAt { get; init; }
 30    public DateTimeOffset? CompletedAt { get; init; }
 31    public AIToolInvocationStatus Status { get; init; } = AIToolInvocationStatus.Pending;
 32    public string? ResultSummary { get; init; }
 33    public string? Error { get; init; }
 34    public string? TraceId { get; init; }
 35    public string? TenantId { get; init; }
 36    public string ActorId { get; init; } = default!;
 37}
 38
 39public record AIToolResult
 40{
 41    public AIToolInvocationStatus Status { get; init; } = AIToolInvocationStatus.Completed;
 42    public string Summary { get; init; } = "";
 43    public JsonObject Data { get; init; } = [];
 44    public string? Error { get; init; }
 45}
 46
 47public record AIToolExecutionContext
 48{
 1349    public string ConversationId { get; init; } = default!;
 1350    public string? TenantId { get; init; }
 1351    public string ActorId { get; init; } = default!;
 1352    public string? Agent { get; init; }
 3753    public JsonObject Arguments { get; init; } = [];
 54}
 55
 56public record AIToolQuery
 57{
 58    public string? Agent { get; init; }
 59    public AIToolMutability? Mutability { get; init; }
 60    public AIToolDangerLevel? DangerLevel { get; init; }
 61    public string? TenantId { get; init; }
 62    public string? ActorId { get; init; }
 63    public ICollection<string> UserPermissions { get; init; } = [];
 64}
 65
 66public enum AIToolMutability
 67{
 68    ReadOnly,
 69    Proposal,
 70    Administrative
 71}
 72
 73public enum AIToolDangerLevel
 74{
 75    Low,
 76    Medium,
 77    High,
 78    Critical
 79}
 80
 81public enum AITenantBehavior
 82{
 83    TenantScoped,
 84    HostScoped,
 85    CrossTenantDenied
 86}
 87
 88public enum AIToolAuditBehavior
 89{
 90    None,
 91    RecordInvocation,
 92    RecordInvocationAndResult
 93}
 94
 95public enum AIToolAuthorizationResult
 96{
 97    NotEvaluated,
 98    Allowed,
 99    Denied
 100}
 101
 102public enum AIToolInvocationStatus
 103{
 104    Pending,
 105    Running,
 106    Completed,
 107    Failed,
 108    Denied
 109}