AgentClassSkill<TSelf>.CreateResource Method
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.
Overloads
| Name | Description |
|---|---|
| CreateResource(String, Object, String) |
Creates a skill resource backed by a static value. |
| CreateResource(String, Delegate, String, JsonSerializerOptions) |
Creates a skill resource backed by a delegate that produces a dynamic value. |
CreateResource(String, Object, String)
Creates a skill resource backed by a static value.
protected Microsoft.Agents.AI.AgentSkillResource CreateResource(string name, object value, string? description = default);
member this.CreateResource : string * obj * string -> Microsoft.Agents.AI.AgentSkillResource
Protected Function CreateResource (name As String, value As Object, Optional description As String = Nothing) As AgentSkillResource
Parameters
- name
- String
The resource name.
- value
- Object
The static resource value.
- description
- String
An optional description of the resource.
Returns
A new AgentSkillResource instance.
Remarks
The resource is listed in the <available_resources> block of the skill body so the LLM knows it can be accessed. When no resources are registered, the block is emitted as a self-closing element to signal that none exist, preventing hallucinated resource calls.
Applies to
CreateResource(String, Delegate, String, JsonSerializerOptions)
Creates a skill resource backed by a delegate that produces a dynamic value.
protected Microsoft.Agents.AI.AgentSkillResource CreateResource(string name, Delegate method, string? description = default, System.Text.Json.JsonSerializerOptions? serializerOptions = default);
member this.CreateResource : string * Delegate * string * System.Text.Json.JsonSerializerOptions -> Microsoft.Agents.AI.AgentSkillResource
Protected Function CreateResource (name As String, method As Delegate, Optional description As String = Nothing, Optional serializerOptions As JsonSerializerOptions = Nothing) As AgentSkillResource
Parameters
- name
- String
The resource name.
- method
- Delegate
A method that produces the resource value when requested.
- description
- String
An optional description of the resource.
- serializerOptions
- JsonSerializerOptions
Optional JsonSerializerOptions used to marshal the delegate's parameters and return value.
When null, falls back to SerializerOptions.
Returns
A new AgentSkillResource instance.
Remarks
The resource is listed in the <available_resources> block of the skill body so the LLM knows it can be accessed. When no resources are registered, the block is emitted as a self-closing element to signal that none exist, preventing hallucinated resource calls.