.NET: Add SkillExecutor.HostedCodeInterpreter() skill script execution mode#4192
Open
SergeyMenshykh wants to merge 6 commits intomicrosoft:mainfrom
Open
.NET: Add SkillExecutor.HostedCodeInterpreter() skill script execution mode#4192SergeyMenshykh wants to merge 6 commits intomicrosoft:mainfrom
SergeyMenshykh wants to merge 6 commits intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request introduces support for executing agent skill scripts via the LLM's hosted code interpreter. The implementation adds a new SkillScriptExecutor abstraction with a concrete HostedCodeInterpreterExecutor implementation that integrates with FileAgentSkillsProvider. The PR also enhances skill resource path detection to support backtick-quoted paths in addition to markdown links, and includes a comprehensive sample demonstrating password generation via script execution.
Changes:
- Introduced
SkillScriptExecutorabstract class with factory method pattern for extensibility - Added
HostedCodeInterpreterExecutorthat provides instructions and registersHostedCodeInterpreterTool - Enhanced
FileAgentSkillsProviderto optionally enable script execution viaFileAgentSkillsProviderOptions.Executor - Migrated prompt templating from format strings (
{0}) to named placeholders ({skills},{executor_instructions}) - Updated regex pattern to recognize backtick-quoted resource paths alongside markdown links
- Added comprehensive unit tests and
Agent_Step02_ScriptExecutionWithCodeInterpretersample project
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
dotnet/src/Microsoft.Agents.AI/Skills/SkillScriptExecutor.cs |
Abstract base class defining the contract for script execution modes with factory method |
dotnet/src/Microsoft.Agents.AI/Skills/HostedCodeInterpreterExecutor.cs |
Concrete implementation providing instructions and tools for hosted code interpreter execution |
dotnet/src/Microsoft.Agents.AI/Skills/FileAgentSkillsProviderOptions.cs |
Added Executor property to enable optional script execution |
dotnet/src/Microsoft.Agents.AI/Skills/FileAgentSkillsProvider.cs |
Integrated executor instructions and tools; migrated to named placeholder templating |
dotnet/src/Microsoft.Agents.AI/Skills/FileAgentSkillLoader.cs |
Enhanced regex to detect backtick-quoted resource paths (e.g., `scripts/run.py`) |
dotnet/tests/Microsoft.Agents.AI.UnitTests/AgentSkills/SkillScriptExecutorTests.cs |
Comprehensive tests for executor creation, instruction/tool provisioning, and provider integration |
dotnet/tests/Microsoft.Agents.AI.UnitTests/AgentSkills/FileAgentSkillsProviderTests.cs |
Updated custom template test to use named placeholders; removed obsolete format validation test |
dotnet/tests/Microsoft.Agents.AI.UnitTests/AgentSkills/FileAgentSkillLoaderTests.cs |
Tests for backtick resource path extraction in single and mixed scenarios |
dotnet/samples/.../Agent_Step02_ScriptExecutionWithCodeInterpreter/ |
Complete sample demonstrating script execution with password-generator skill |
dotnet/agent-framework-dotnet.slnx |
Added new sample project to solution |
dotnet/samples/GettingStarted/AgentSkills/README.md |
Updated to reference new Step02 sample |
...amples/GettingStarted/AgentSkills/Agent_Step02_ScriptExecutionWithCodeInterpreter/Program.cs
Show resolved
Hide resolved
Add the standard three-line WARNING comment about DefaultAzureCredential production considerations to both AgentSkills sample Program.cs files, matching the convention used in all other GettingStarted/Agents samples. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
westey-m
reviewed
Feb 24, 2026
westey-m
reviewed
Feb 24, 2026
dotnet/src/Microsoft.Agents.AI/Skills/HostedCodeInterpreterExecutor.cs
Outdated
Show resolved
Hide resolved
westey-m
reviewed
Feb 24, 2026
westey-m
approved these changes
Feb 24, 2026
...riptExecutionWithCodeInterpreter/skills/password-generator/references/PASSWORD_GUIDELINES.md
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add support for executing agent skill scripts via the LLM's hosted code interpreter, encapsulated as
SkillExecutor.HostedCodeInterpreter().Changes
SkillScriptExecutorabstract class withGetInstructions()andGetTools()methodsHostedCodeInterpreterExecutorsealed subclass returned bySkillScriptExecutor.HostedCodeInterpreter()HostedCodeInterpreterToolwhen executor is enabledFileAgentSkillsProviderscript execution is off by default; enabled viaFileAgentSkillsProviderOptions.ExecutorDefaultSkillsInstructionPromptto instruct LLMs to use full resource paths withread_skill_resourceAgent_Step02_ScriptExecutionWithCodeInterpretersample projectCloses #4131