db620d33df
CodeQL / Analyze (csharp) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
dotnet-build-and-test / dotnet-test-functions (push) Has been cancelled
dotnet-build-and-test / paths-filter (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Debug, windows-latest, net9.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net8.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-foundry-hosted-it (push) Has been cancelled
dotnet-build-and-test / dotnet-build-and-test-check (push) Has been cancelled
dotnet-build-and-test / Integration Test Report (push) Has been cancelled
3.5 KiB
3.5 KiB
Monty Package (agent-framework-monty)
Monty-backed CodeAct integrations for the Microsoft Agent Framework.
Note
Alpha package. Not part of
agent-framework[all]yet. Install explicitly withpip install agent-framework-monty --pre.
Core Classes
MontyCodeActProvider—ContextProviderthat injects a run-scopedexecute_codetool plus dynamic CodeAct instructions. Mirrors theHyperlightCodeActProviderAPI for the parts that apply to a non-sandboxed Python interpreter.MontyExecuteCodeTool—FunctionToolthat wraps the Monty interpreter. Use directly for mixed-tool agents or manual static wiring. MirrorsHyperlightExecuteCodeTool.
Public API
from agent_framework_monty import (
FileMount,
FileMountInput,
MontyCodeActProvider,
MontyExecuteCodeTool,
MountMode,
)
MontyCodeActProvider and MontyExecuteCodeTool both accept:
tools— host tool callables /FunctionToolsapproval_mode—"never_require"(default) or"always_require"workspace_root— host directory auto-mounted at/input(mirrorsHyperlightCodeActProvider.workspace_root)file_mounts— sequence ofFileMountInput(str shorthand,(host_path, mount_path)tuple, orFileMount)resource_limits— MontyResourceLimitsTypedDict
Tool-management methods on both classes: add_tools, get_tools,
remove_tool, clear_tools. Mount-management methods: add_file_mounts,
get_file_mounts, remove_file_mount, clear_file_mounts.
MontyExecuteCodeTool additionally exposes:
build_instructions(*, tools_visible_to_model: bool) -> strcreate_run_tool() -> MontyExecuteCodeToolbuild_serializable_state() -> dict[str, Any]workspace_root,resource_limitsproperties
Architecture
_types.py—FileMount,FileMountInput,MountMode(public)._provider.py—MontyCodeActProvider(thin wrapper around the tool)._execute_code_tool.py—MontyExecuteCodeToolplus tool / mount normalization, approval helpers, dynamicdescription/instructionsbuilders, and the post-execution file-capture flow that surfaces files written toread-writemounts asContent.from_dataitems._monty_bridge.py—InlineCodeBridgeandgenerate_type_stubs, adapted from the reference Monty CodeAct repo. Pauses onFunctionSnapshotto dispatch host calls, then resumes; supports direct typed tool calls, thecall_toolfallback,asyncio.gatherfan-out, and forwardsmount/limitstoMonty(...).start(...)._instructions.py— dynamic instruction / tool-description builders (include filesystem capability summaries when mounts are configured).
Not implemented (yet)
| Capability | Monty primitive | Status |
|---|---|---|
| Custom virtual filesystem | OSAccess subclass passed to Monty(...).start(os=...) |
Not exposed. Strictly more general than file mounts; useful when you want a fully synthetic FS. |
| Outbound URL allow-list | No Monty primitive — expose fetch_url as a host tool with the allow-list check in your tool function. |
Not exposed in this package; users add it as a regular tool. |
Out of scope (for now)
- Durable execution — the reference Monty CodeAct repo also offers a
Durable-Functions-backed mode (
DurableCodeBridge,register_durable_codeact,wait_for_external_event, per-tool approval via external events). That is intentionally not in this package yet.