Skip to content

[dotnet-port] Port string[] arguments for file-based skill scripts #129

Description

@github-actions

Summary

Aligns the Go SDK with the .NET breaking change microsoft/agent-framework#5475, which switched skill script arguments from a key-value dictionary to a positional CLI-style string array.

Changes made:

  • agent/skills/skills.goScript.Run signature changed from func(context.Context, *Skill, map[string]any) to func(context.Context, *Skill, []string). ScriptRunner type updated accordingly. Added doc comments explaining the positional []string arg format.
  • agent/skills/provider.gorun_skill_script tool's Arguments field changed from map[string]any to []string. JSON schema description updated to instruct the LLM to send a string array (e.g. ["--value","26.2","--factor","1.60934"]). runSkillScript method signature updated.
  • agent/skills/fsskills/source.gonewScript closure updated; removed the nil-to-empty-map fallback (no longer needed with []string).
  • agent/skills/fsskills/source_script_test.go — All ScriptRunner signatures updated; TestFileSource_ExecutorReceivesArguments now passes []string{"--value","26.2","--factor","1.60934"}.
  • agent/skills/provider_test.goScriptRunner signatures updated; TestProvider_RunSkillScript_PassesArguments now invokes the tool with a JSON string array and validates correctly.
  • examples/02-agents/skills/internal/skillhelpers/subprocess_script_runner.go — Rewritten to accept []string and pass tokens directly to the subprocess. Removed buildCLIFlags / NormalizeKey helpers.
  • examples/02-agents/skills/internal/skillhelpers/inline.goNumberArg and StringArg rewritten to look up by positional index instead of map key. Removed json.Number handling and sort import.
  • examples/02-agents/skills/step02_code_defined_skills/main.go — Script closure updated to parse positional args; instructions updated.
  • examples/02-agents/skills/step03_mixed_skills/main.go — Both convert-volume and convert-temperature script closures updated to positional []string args.

Why this was selected:

The .NET SDK explicitly marked this as a breaking change. The Go SDK had a meaningful misalignment by still using map[string]any. Aligning here ensures LLM tool calls produce the same schema in both SDKs.

Ported .NET PRs

Upstream commit: 2eb0705e on upstream-agent-framework/main

Breaking Changes

Yes.

  • Old: Script.Run func(context.Context, *Skill, map[string]any) and ScriptRunner func(context.Context, *Skill, *Script, map[string]any)
  • New: Script.Run func(context.Context, *Skill, []string) and ScriptRunner func(context.Context, *Skill, *Script, []string)

Any code that defined custom scripts using key-based argument lookup (e.g. arguments["value"]) must be updated to positional index access (e.g. args[0]). Since the Go SDK is in beta, this breaking change is acceptable and mirrors the upstream .NET breaking change.

Tests and Examples

  • Updated agent/skills/fsskills/source_script_test.go — all tests pass new []string arg format.
  • Updated agent/skills/provider_test.goTestProvider_RunSkillScript_PassesArguments validates end-to-end []string arg passing.
  • Updated examples for step02 (code-defined) and step03 (mixed) skills.
  • Note: Go 1.25 is required to build/test this module; tests were validated by code review since Go 1.25 is not available in this agent environment.

Notes

  • The .NET implementation uses reflection on typed delegates to auto-parse named parameters. Go cannot replicate this without reflect, so the Go approach uses purely positional []string tokens. File-based scripts using argparse (like convert.py) accept CLI flags naturally (e.g. ["--value", "26.2", "--factor", "1.60934"]).
  • SKILL.md instruction files don't need updating since they document the --flag value CLI style, which the LLM naturally translates to the string array format given the updated JSON schema.
  • Upstream commit range inspected: since 806075ae (last ported commit in Go SDK PR Port .NET skill and workflow fixes #126).

Warning

⚠️ Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • proxy.golang.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "proxy.golang.org"

See Network Configuration for more information.

Generated by .NET to Go Porting Agent · ● 12.6M ·


Note

This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch port-skill-script-string-args-389e2b66775d99f5.

Click here to create the pull request

To fix the permissions issue, go to SettingsActionsGeneral and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ

Show patch preview (500 of 639 lines)
From 61b0a9291ebfd07112ff32f4b7cbc06615c36513 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Wed, 6 May 2026 09:05:29 +0000
Subject: [PATCH] Port string[] arguments for file-based skill scripts

Aligns the Go SDK with the .NET breaking change in microsoft/agent-framework#5475.

Previously, skill scripts received arguments as map[string]any (a key-value
dictionary). Now they receive arguments as []string (positional CLI-style
string tokens), matching the .NET change that shifted the run_skill_script
tool schema to {"type":"array","items":{"type":"string"}}.

Changes:
- skills.Script.Run: map[string]any -> []string
- skills.ScriptRunner: map[string]any -> []string
- provider.go: run_skill_script tool Arguments field []string; jsonschema updated
- fsskills/source.go: newScript closure updated; nil-map fallback removed
- Tests updated: source_script_test.go, provider_test.go
- Examples updated: skillhelpers/inline.go, subprocess_script_runner.go,
  step02_code_defined_skills/main.go, step03_mixed_skills/main.go

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 agent/skills/fsskills/source.go               |  5 +-
 agent/skills/fsskills/source_script_test.go   | 36 ++++++------
 agent/skills/provider.go                      |  8 +--
 agent/skills/provider_test.go                 | 25 ++++----
 agent/skills/skills.go                        | 13 ++++-
 .../skills/internal/skillhelpers/inline.go    | 57 +++++--------------
 .../skillhelpers/subprocess_script_runner.go  | 48 ++++------------
 .../skills/step02_code_defined_skills/main.go | 10 ++--
 .../skills/step03_mixed_skills/main.go        | 22 +++----
 9 files changed, 90 insertions(+), 134 deletions(-)

diff --git a/agent/skills/fsskills/source.go b/agent/skills/fsskills/source.go
index daaf813d..e15bdbb0 100644
--- a/agent/skills/fsskills/source.go
+++ b/agent/skills/fsskills/source.go
@@ -531,16 +531,13 @@ func validateExtensions(exte
... (truncated)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions