Files
microsoft--agent-framework/python/samples/02-agents/context_providers/code_act
Eduard van Valkenburg d08200d00e Python: Bump package versions for 1.12.0 release (#7238)
* Bump Python package versions for 1.12.0 release

Bump packages represented in the 1.12.0 changelog, promote Foundry Hosting, Azure Content Understanding, Gemini, Mistral, Monty, and Tools to beta, and apply the requested beta cohort date stamp. Root and core move to 1.12.0, released and RC packages use their selected increments, alpha packages including Hosting MCP use the 260721 stamp, and core floors are raised only for proven consumers.

Copilot-Session: 2dd9980a-b869-4c16-8642-75b7a6d6ebdf

* fix version in readme

* Add Responses conversation ID changes to release notes

Include the breaking Hosting Responses conversation ID helper changes from #7234 in the Python 1.12.0 changelog.

Copilot-Session: 2dd9980a-b869-4c16-8642-75b7a6d6ebdf
2026-07-21 15:45:00 +00:00
..

CodeAct context providers

Demonstrates the provider-owned CodeAct flow with two backends:

File Backend Notes
code_act.py Hyperlight WASM sandbox via HyperlightCodeActProvider Hardened sandbox with WASM isolation; sandbox tools called via call_tool(...).
monty_code_act.py Monty Rust-based Python interpreter via MontyCodeActProvider (beta) Cross-platform pure interpreter; sandbox tools can be called as typed async functions (await compute(...)) or via call_tool(...).

Both providers inject an execute_code tool into the agent and keep the registered sandbox tools (compute, fetch_data) hidden from the model — the model invokes them from inside the sandbox.

Installation

pip install agent-framework-hyperlight agent-framework-foundry --pre  # Hyperlight sample
pip install agent-framework-monty agent-framework-foundry --pre       # Monty sample

The Hyperlight Wasm backend is currently published only for linux/x86_64 and win32/AMD64 with Python <3.14. On other platforms execute_code will fail at runtime when it tries to create the sandbox.

Monty is cross-platform and has no hypervisor/WASM backend dependency, but it interprets a Python subset (e.g. os/network/subprocess access is blocked). The beta agent-framework-monty package is included in agent-framework[all].

Prerequisites

  • A Microsoft Foundry project endpoint (FOUNDRY_PROJECT_ENDPOINT)
  • A deployed model (FOUNDRY_MODEL)
  • Azure CLI authenticated (az login)

Run

python code_act.py        # Hyperlight
python monty_code_act.py  # Monty

See the source files for the full annotated examples.