AgentInlineSkill.AddResource Method

Definition

Overloads

Name Description
AddResource(String, Object, String)

Registers a static resource with this skill.

AddResource(String, Delegate, String, JsonSerializerOptions)

Registers a dynamic resource with this skill, backed by a C# delegate. The delegate's parameters and return type are automatically marshaled via AIFunctionFactory.

AddResource(String, Object, String)

Registers a static resource with this skill.

public Microsoft.Agents.AI.AgentInlineSkill AddResource(string name, object value, string? description = default);
member this.AddResource : string * obj * string -> Microsoft.Agents.AI.AgentInlineSkill
Public Function AddResource (name As String, value As Object, Optional description As String = Nothing) As AgentInlineSkill

Parameters

name
String

The resource name.

value
Object

The static resource value.

description
String

An optional description of the resource.

Returns

This instance, for chaining.

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

AddResource(String, Delegate, String, JsonSerializerOptions)

Registers a dynamic resource with this skill, backed by a C# delegate. The delegate's parameters and return type are automatically marshaled via AIFunctionFactory.

public Microsoft.Agents.AI.AgentInlineSkill AddResource(string name, Delegate method, string? description = default, System.Text.Json.JsonSerializerOptions? serializerOptions = default);
member this.AddResource : string * Delegate * string * System.Text.Json.JsonSerializerOptions -> Microsoft.Agents.AI.AgentInlineSkill
Public Function AddResource (name As String, method As Delegate, Optional description As String = Nothing, Optional serializerOptions As JsonSerializerOptions = Nothing) As AgentInlineSkill

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 for this resource's delegate marshaling. When null, the skill-level default (if any) is used; otherwise DefaultOptions is used.

Returns

This instance, for chaining.

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