Skip to content

[Feature]: InlineSkills. Allow to add scripts that are not added to the body of the skill #5405

@christianarg

Description

@christianarg

Description

In dotnet, for InlineSkills when adding scripts, these are added to the "body" of the skill https://github.com/microsoft/agent-framework/blob/main/dotnet/src/Microsoft.Agents.AI/Skills/Programmatic/AgentInlineSkillContentBuilder.cs so the model knows they exists and the scripts can be called by the run_skill_script tool.
This is a great default behaviour but it would be much more powerful and it would have more progressive disclosure capabilities if we could add the scripts to references/resources as it's done in the "normal" skill specification.

I believe that in a "normal" file skill (forget agent framework, just "skills" https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills) you have:
my-skill

  • SKILL.md
  • refereneces/somereference.md
  • scripts/somescript.py // python just an example.

I believe the somescript.py isn't necessary mentioned in the SKILL.MD file. You can tell the model in SKILL.md to read somereference.md and then in somereference.md you explain the model that she has somescript.py.

This way I can "nest" the scripts the model can load without bloating the context with scripts that it might not need.
I'm not sure how to implement it, may add a AddResourceScript(..) method? something like this (from your sample https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/02-agents/AgentSkills/Agent_Step02_CodeDefinedSkills/Program.cs):

Code Sample

var unitConverterSkill = new AgentInlineSkill(
    name: "unit-converter",
    description: "Convert between common units using a multiplication factor. Use when asked to convert miles, kilometers, pounds, or kilograms.",
    instructions: """
        Use this skill when the user asks to convert between units.

        1. Review the conversion-table resource to find the factor for the requested conversion.
        2. Check the conversion-policy resource for rounding and formatting rules.
        3. Use the convert script, passing the value and factor from the table.
        """)
    // 1. Static Resource: conversion tables
    .AddResource(
        "conversion-table",
        """
        # Conversion Tables

        Formula: **result = value × factor**

        | From        | To          | Factor   |
        |-------------|-------------|----------|
        | miles       | kilometers  | 1.60934  |
        | kilometers  | miles       | 0.621371 |
        | pounds      | kilograms   | 0.453592 |
        | kilograms   | pounds      | 2.20462  |
        """)
    // 2. Dynamic Resource: conversion policy (computed at runtime)
    .AddResource("conversion-policy", () =>
    {
        const int Precision = 4;
        return $"""
            # Conversion Policy

            **Decimal places:** {Precision}
            **Format:** Always show both the original and converted values with units
            **Generated at:** {DateTime.UtcNow:O}
            """;
    })
    // 3. Code Script: convert (Note maybe not the best example it's just to get the idea)
    .AddResourceScript("conversion-policy", "convert", (double value, double factor) =>
    {
        double result = Math.Round(value * factor, 4);
        return JsonSerializer.Serialize(new { value, factor, result });
    });

Language/SDK

.NET

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions