| | | 1 | | namespace NexusLabs.Needlr.AgentFramework; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Configures per-agent resilience settings that override the global default |
| | | 5 | | /// set by <c>UsingResilience()</c> on <see cref="AgentFrameworkSyringe"/>. |
| | | 6 | | /// </summary> |
| | | 7 | | /// <remarks> |
| | | 8 | | /// Apply this attribute alongside <see cref="NeedlrAiAgentAttribute"/> to configure |
| | | 9 | | /// agent-specific retry and timeout behaviour. |
| | | 10 | | /// </remarks> |
| | | 11 | | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] |
| | | 12 | | public sealed class AgentResilienceAttribute : Attribute |
| | | 13 | | { |
| | | 14 | | /// <summary>Gets the maximum number of retry attempts (0 = no retry).</summary> |
| | 6 | 15 | | public int MaxRetries { get; } |
| | | 16 | | |
| | | 17 | | /// <summary>Gets the per-attempt timeout in seconds (0 = no timeout).</summary> |
| | 5 | 18 | | public int TimeoutSeconds { get; } |
| | | 19 | | |
| | | 20 | | /// <summary> |
| | | 21 | | /// Initialises a new <see cref="AgentResilienceAttribute"/>. |
| | | 22 | | /// </summary> |
| | | 23 | | /// <param name="maxRetries">Maximum number of retry attempts. Defaults to 2.</param> |
| | | 24 | | /// <param name="timeoutSeconds">Per-attempt timeout in seconds. 0 means no timeout.</param> |
| | 645 | 25 | | public AgentResilienceAttribute(int maxRetries = 2, int timeoutSeconds = 0) |
| | | 26 | | { |
| | 645 | 27 | | MaxRetries = maxRetries; |
| | 645 | 28 | | TimeoutSeconds = timeoutSeconds; |
| | 645 | 29 | | } |
| | | 30 | | } |