AgentSkillResourceAttribute Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Marks a property or method as a skill resource that is automatically discovered by AgentClassSkill<TSelf>.
[System.AttributeUsage(System.AttributeTargets.Method | System.AttributeTargets.Property, AllowMultiple=false, Inherited=false)]
public sealed class AgentSkillResourceAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Method | System.AttributeTargets.Property, AllowMultiple=false, Inherited=false)>]
type AgentSkillResourceAttribute = class
inherit Attribute
Public NotInheritable Class AgentSkillResourceAttribute
Inherits Attribute
- Inheritance
-
AgentSkillResourceAttribute
- Attributes
Examples
public class MySkill : AgentClassSkill<MySkill>
{
public override AgentSkillFrontmatter Frontmatter { get; } = new("my-skill", "A skill.");
protected override string Instructions => "Use this skill to do something.";
[AgentSkillResource("reference-data")]
[Description("Some reference content for the skill.")]
public string ReferenceData => "Some reference content.";
}
Remarks
Apply this attribute to properties or methods in an AgentClassSkill<TSelf> subclass to register them as skill resources.
To provide a description for the resource, apply DescriptionAttribute to the same member.
When applied to a property, the property getter is invoked each time the resource is read, enabling dynamic (computed) resources. When applied to a method, the method is invoked each time the resource is read, also enabling dynamic resources. Methods with an IServiceProvider parameter support dependency injection.
This attribute is compatible with Native AOT when used with AgentClassSkill<TSelf>. Alternatively, override Resources and use CreateResource(String, Object, String) instead.
Constructors
| Name | Description |
|---|---|
| AgentSkillResourceAttribute() |
Initializes a new instance of the AgentSkillResourceAttribute class. The resource name defaults to the property or method name. |
| AgentSkillResourceAttribute(String) |
Initializes a new instance of the AgentSkillResourceAttribute class with an explicit resource name. |
Properties
| Name | Description |
|---|---|
| Name |
Gets the resource name, or |