AgentClassSkill<TSelf>.CreateScript 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.
Creates a skill script backed by a delegate.
protected Microsoft.Agents.AI.AgentSkillScript CreateScript(string name, Delegate method, string? description = default, System.Text.Json.JsonSerializerOptions? serializerOptions = default);
member this.CreateScript : string * Delegate * string * System.Text.Json.JsonSerializerOptions -> Microsoft.Agents.AI.AgentSkillScript
Protected Function CreateScript (name As String, method As Delegate, Optional description As String = Nothing, Optional serializerOptions As JsonSerializerOptions = Nothing) As AgentSkillScript
Parameters
- name
- String
The script name.
- method
- Delegate
A method to execute when the script is invoked.
- description
- String
An optional description of the script.
- serializerOptions
- JsonSerializerOptions
Optional JsonSerializerOptions used to marshal the delegate's parameters and return value.
When null, falls back to SerializerOptions.
Returns
A new AgentSkillScript instance.
Remarks
The script is listed in the <available_scripts> block of the skill body so the LLM knows it can be called. When no scripts are registered, the block is emitted as a self-closing element to signal that none exist, preventing hallucinated script calls.