Repository navigation
Python: feat(python): add opt-in fail-closed FIDES coverage for CodeAct host tools - #9290
Closed
Suhas Aggarwal (suhasagg) wants to merge 2 commits into
Closed
Suhas Aggarwal (suhasagg) wants to merge 2 commits into
Suhas Aggarwal (suhasagg) wants to merge 2 commits into
Conversation
Suhas Aggarwal (suhasagg)
requested review from
SergeyMenshykh,
Tao Chen (TaoChenOSU),
Eduard van Valkenburg (eavanvalkenburg),
Giles Odigwe (giles17),
Jose Alvarez (jpalvarezl),
Evan Mattson (moonbox3),
Roger Barreto (rogerbarreto),
sophia-ramsey and
westey (westey-m)
as code owners
October 12, 2026 09:31
Suhas Aggarwal (suhasagg)
temporarily deployed
to
github-app-auth
October 12, 2026 09:31 — with
GitHub Actions
Inactive
Suhas Aggarwal (suhasagg)
temporarily deployed
to
github-app-auth
October 12, 2026 09:31 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The security-sensitive boundary spans two execution runtimes, and the Hyperlight real-sandbox path remains unverified.
2 open findings
What changed in this PR
Adds opt-in fail-closed FIDES coverage for Python CodeAct host tools.
Changes:
- Adds
require_fidesto Monty and Hyperlight providers/tools. - Rejects nested host-tool registration and execution in strict mode.
- Adds documentation, exception handling, and regression tests.
| File | Description |
|---|---|
python/packages/core/agent_framework/exceptions.py |
Adds the dedicated coverage exception. |
python/packages/monty/agent_framework_monty/_provider.py |
Exposes strict mode through the provider. |
python/packages/monty/agent_framework_monty/_execute_code_tool.py |
Enforces fail-closed behavior across execution paths. |
python/packages/monty/tests/monty/test_fides_fail_closed.py |
Tests Monty strict-mode behavior. |
python/packages/monty/README.md |
Documents Monty configuration and limitations. |
python/packages/hyperlight/agent_framework_hyperlight/_provider.py |
Exposes strict mode through the provider. |
python/packages/hyperlight/agent_framework_hyperlight/_execute_code_tool.py |
Enforces strict mode through sandbox configuration and callbacks. |
python/packages/hyperlight/tests/hyperlight/test_hyperlight_fides_fail_closed.py |
Tests Hyperlight rejection paths and side effects. |
python/packages/hyperlight/README.md |
Documents Hyperlight configuration and limitations. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+144
to
+148
| class CodeActFidesCoverageError(IntegrationInvalidRequestException): | ||
| """Required FIDES policy coverage is unavailable for nested CodeAct host tools. | ||
|
|
||
| This is an opt-in refusal, not evidence that CodeAct provides FIDES mediation. | ||
| """ |
| file_mounts: FileMountInput | Sequence[FileMountInput] | None = None, | ||
| resource_limits: dict[str, Any] | None = None, | ||
| tool_description_format: _ToolDescriptionFormat = "compact", | ||
| require_fides: bool = False, |
Member
|
Suhas Aggarwal (@suhasagg) the issue mentioned waiting for the core team to review the issue before creating a PR, so closing this. |
This branch was previously deployed
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.

Motivation & Context
Microsoft Agent Framework provides FIDES middleware for security policy enforcement. However, CodeAct integrations using Monty and Hyperlight execute generated code that can invoke registered host functions through nested execution paths.
These nested host-tool calls are not currently mediated by FIDES. Applications requiring comprehensive FIDES coverage therefore need an explicit way to reject unsupported execution configurations rather than assume that sandbox isolation or existing middleware automatically provides policy enforcement.
This PR introduces an opt-in, fail-closed FIDES coverage requirement for Python CodeAct integrations.
The goal is to prevent registered host functions from executing through an unsupported FIDES security boundary while preserving existing behavior for applications that do not enable strict coverage.
Description & Review Guide
What are the major changes?
1. Introduce an explicit security coverage requirement
Add
require_fides=Truesupport to:MontyCodeActProviderMontyExecuteCodeToolHyperlightCodeActProviderHyperlightExecuteCodeToolThe default remains
Falsefor backward compatibility.2. Fail closed when nested host tools are registered
When strict coverage is enabled, CodeAct rejects nonempty managed host-tool registries because nested host-tool execution does not currently provide FIDES mediation.
This applies regardless of whether individual tools contain FIDES-related metadata.
The implementation introduces
CodeActFidesCoverageErrorto distinguish unsupported security coverage from ordinary execution failures.3. Protect multiple execution and registration paths
Coverage checks address:
The intended invariant is that unsupported nested host-tool execution is rejected before the host-tool body runs.
4. Preserve supported execution scenarios
Strict mode still permits code execution when no managed host tools are registered.
With
require_fides=False, existing CodeAct behavior remains unchanged.5. Add documentation and regression coverage
Update the Monty and Hyperlight READMEs to document configuration, security guarantees, limitations, and alternatives.
Add focused regression tests for strict-mode behavior, rejection paths, and execution without registered host tools.
What is the impact of these changes?
Security
Compatibility
require_fides=True.Scope and limitations
This PR does not implement full FIDES mediation for nested CodeAct host tools.
It also does not provide FIDES enforcement for filesystem access, network access, or intermediate program values.
Applications requiring security-sensitive host tools should expose those functions as direct agent tools under their existing FIDES middleware.
The strict option should be configured by trusted application code rather than treated as automatic middleware detection.
Validation
Targeted FIDES regression tests
Broader regression testing
Static checks
Known integration-testing limitation
A Hyperlight real-sandbox integration run encountered an
invalid size: invalid digit found in stringerror associated with the existing sandbox size-configuration format and the installedhyperlight-sandboxversion.The relevant size-formatting code predates this PR. This compatibility issue is outside the scope of the proposed FIDES coverage changes, and the affected real-sandbox integration test has not been demonstrated to pass.
What do you want reviewers to focus on?
require_fidesoption and dedicated exception fit the framework's existing API conventions.Related Issue
Fixes #9251
This PR implements the opt-in fail-closed coverage approach for Python Monty and Hyperlight CodeAct integrations.
AI Assistance
AI assistance details:
AI assistance was used for implementation , regression-test design. The changes were reviewed and validated locally.
Contribution Checklist