Skip to content

.NET: Support hosted code interpreter for skill script execution#4192

Open
SergeyMenshykh wants to merge 11 commits intomicrosoft:mainfrom
SergeyMenshykh:script-execution-by-code-interpreter
Open

.NET: Support hosted code interpreter for skill script execution#4192
SergeyMenshykh wants to merge 11 commits intomicrosoft:mainfrom
SergeyMenshykh:script-execution-by-code-interpreter

Conversation

@SergeyMenshykh
Copy link
Member

@SergeyMenshykh SergeyMenshykh commented Feb 23, 2026

Summary

Add support for executing agent skill scripts via the LLM's hosted code interpreter, encapsulated as SkillExecutor.HostedCodeInterpreter().

Changes

  • Add FileAgentSkillScriptExecutor abstract class with HostedCodeInterpreterSkillScriptExecutor subclass
  • Add FileAgentSkillScriptExecutionContext and FileAgentSkillScriptExecutionDetails
  • Rename SkillFrontmatter to FileAgentSkillFrontmatter for naming consistency
  • Script execution off by default; enabled via FileAgentSkillsProviderOptions.Executor
  • Add Agent_Step02_ScriptExecutionWithCodeInterpreter sample

Closes #4131

Copilot AI review requested due to automatic review settings February 23, 2026 20:01
@markwallace-microsoft markwallace-microsoft added documentation Improvements or additions to documentation .NET labels Feb 23, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 SkillScriptExecutor abstract class with factory method pattern for extensibility
  • Added HostedCodeInterpreterExecutor that provides instructions and registers HostedCodeInterpreterTool
  • Enhanced FileAgentSkillsProvider to optionally enable script execution via FileAgentSkillsProviderOptions.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_ScriptExecutionWithCodeInterpreter sample 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

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>
- Rename SkillFrontmatter -> FileAgentSkillFrontmatter
- Rename SkillScriptExecutor -> FileAgentSkillScriptExecutor
- Add FileAgentSkillScriptExecutionContext and FileAgentSkillScriptExecutionDetails
- Update sample, provider, loader, and tests accordingly

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@SergeyMenshykh SergeyMenshykh changed the title .NET: Add SkillExecutor.HostedCodeInterpreter() skill script execution mode .NET: Support hosted code interpreter for skill script execution Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation .NET

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add SkillExecutor.HostedCodeInterpreter() skill script execution mode

5 participants