| | | 1 | | using Microsoft.Agents.AI; |
| | | 2 | | |
| | | 3 | | namespace NexusLabs.Needlr.AgentFramework; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Per-agent configuration options passed to <c>IAgentFactory.CreateAgent(configure)</c>. |
| | | 7 | | /// </summary> |
| | | 8 | | public sealed class AgentFactoryOptions |
| | | 9 | | { |
| | | 10 | | /// <summary> |
| | | 11 | | /// Gets or sets the agent's name. Used by MAF to populate <c>ExecutorId</c> in workflow events, |
| | | 12 | | /// making multi-agent output readable. When <see langword="null"/>, MAF assigns a generated identifier. |
| | | 13 | | /// </summary> |
| | 648 | 14 | | public string? Name { get; set; } |
| | | 15 | | |
| | | 16 | | /// <summary> |
| | | 17 | | /// Gets or sets a human-readable description of this agent's purpose. |
| | | 18 | | /// </summary> |
| | 600 | 19 | | public string? Description { get; set; } |
| | | 20 | | |
| | | 21 | | /// <summary> |
| | | 22 | | /// Gets or sets the system instructions for this specific agent. |
| | | 23 | | /// When set, overrides the default instructions configured on the factory. |
| | | 24 | | /// </summary> |
| | 631 | 25 | | public string? Instructions { get; set; } |
| | | 26 | | |
| | | 27 | | /// <summary> |
| | | 28 | | /// Gets or sets the subset of function types to wire as tools for this agent. |
| | | 29 | | /// When <see langword="null"/> and <see cref="FunctionGroups"/> is also <see langword="null"/>, |
| | | 30 | | /// all function types registered with the factory are used. |
| | | 31 | | /// </summary> |
| | 704 | 32 | | public IReadOnlyList<Type>? FunctionTypes { get; set; } |
| | | 33 | | |
| | | 34 | | /// <summary> |
| | | 35 | | /// Gets or sets the named function groups to wire as tools for this agent. |
| | | 36 | | /// Groups are declared using <see cref="AgentFunctionGroupAttribute"/> on function classes |
| | | 37 | | /// and registered via <c>AddAgentFunctionGroupsFromAssemblies()</c> or |
| | | 38 | | /// <c>AddAgentFunctionGroupsFromGenerated()</c>. |
| | | 39 | | /// When <see langword="null"/> and <see cref="FunctionTypes"/> is also <see langword="null"/>, |
| | | 40 | | /// all registered function types are used. |
| | | 41 | | /// </summary> |
| | 653 | 42 | | public IReadOnlyList<string>? FunctionGroups { get; set; } |
| | | 43 | | |
| | | 44 | | /// <summary> |
| | | 45 | | /// Optional factory that wraps the <see cref="Microsoft.Extensions.AI.IChatClient"/> |
| | | 46 | | /// resolved for this agent. Use this to inject per-agent middleware such as |
| | | 47 | | /// <c>ContextWindowGuardMiddleware</c> with agent-specific limits. |
| | | 48 | | /// When <see langword="null"/>, the global chat client is used unmodified. |
| | | 49 | | /// </summary> |
| | | 50 | | /// <example> |
| | | 51 | | /// <code> |
| | | 52 | | /// var agent = agentFactory.CreateAgent(o => |
| | | 53 | | /// { |
| | | 54 | | /// o.Name = "ColdReader"; |
| | | 55 | | /// o.ChatClientFactory = inner => new ContextWindowGuardMiddleware( |
| | | 56 | | /// innerClient: inner, |
| | | 57 | | /// maxContextTokens: 40_000, |
| | | 58 | | /// progressAccessor: progressAccessor, |
| | | 59 | | /// pruneOnOverflow: true); |
| | | 60 | | /// }); |
| | | 61 | | /// </code> |
| | | 62 | | /// </example> |
| | 337 | 63 | | public Func<Microsoft.Extensions.AI.IChatClient, Microsoft.Extensions.AI.IChatClient>? ChatClientFactory { get; set; |
| | | 64 | | } |