Skip to content

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

Merged
SergeyMenshykh merged 12 commits into
microsoft:mainfrom
SergeyMenshykh:script-execution-by-code-interpreter
Feb 26, 2026
Merged

.NET: Support hosted code interpreter for skill script execution#4192
SergeyMenshykh merged 12 commits into
microsoft:mainfrom
SergeyMenshykh:script-execution-by-code-interpreter

Conversation

@SergeyMenshykh

@SergeyMenshykhSergeyMenshykh commented Feb 23, 2026

Copy link
Copy Markdown
Contributor

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

CopilotAI review requested due to automatic review settings February 23, 2026 20:01
@markwallace-microsoftMark Wallace (markwallace-microsoft) added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs .NET Usage: [Issues, PRs], Target: .Net labels Feb 23, 2026

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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
FileDescription
dotnet/src/Microsoft.Agents.AI/Skills/SkillScriptExecutor.csAbstract base class defining the contract for script execution modes with factory method
dotnet/src/Microsoft.Agents.AI/Skills/HostedCodeInterpreterExecutor.csConcrete implementation providing instructions and tools for hosted code interpreter execution
dotnet/src/Microsoft.Agents.AI/Skills/FileAgentSkillsProviderOptions.csAdded Executor property to enable optional script execution
dotnet/src/Microsoft.Agents.AI/Skills/FileAgentSkillsProvider.csIntegrated executor instructions and tools; migrated to named placeholder templating
dotnet/src/Microsoft.Agents.AI/Skills/FileAgentSkillLoader.csEnhanced regex to detect backtick-quoted resource paths (e.g., `scripts/run.py`)
dotnet/tests/Microsoft.Agents.AI.UnitTests/AgentSkills/SkillScriptExecutorTests.csComprehensive tests for executor creation, instruction/tool provisioning, and provider integration
dotnet/tests/Microsoft.Agents.AI.UnitTests/AgentSkills/FileAgentSkillsProviderTests.csUpdated custom template test to use named placeholders; removed obsolete format validation test
dotnet/tests/Microsoft.Agents.AI.UnitTests/AgentSkills/FileAgentSkillLoaderTests.csTests 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.slnxAdded new sample project to solution
dotnet/samples/GettingStarted/AgentSkills/README.mdUpdated 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>
Comment threaddotnet/src/Microsoft.Agents.AI/Skills/HostedCodeInterpreterExecutor.cs Outdated
Comment threaddotnet/src/Microsoft.Agents.AI/Skills/SkillScriptExecutor.cs Outdated
Comment threaddotnet/src/Microsoft.Agents.AI/Skills/SkillScriptExecutor.cs Outdated
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationUsage: [Issues, PRs], Target: documentation in the code base and learn docs.NETUsage: [Issues, PRs], Target: .Net

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add SkillExecutor.HostedCodeInterpreter() skill script execution mode

5 participants

@SergeyMenshykh@rogerbarreto@markwallace-microsoft@westey-m