Skip to content

MicrosoftAgentFramework

angelatgithub edited this page Sep 19, 2026 · 1 revision

Microsoft Agent Framework — maf-algenta

create_algenta_tools — an async context manager building a governed list of agent_framework.FunctionTools from your engine's MCP tool surface, with two-layer safety-field scrubbing and typed denials built on MAF's MiddlewareFailure (its one fail-closed abort signal, never swallowed into a tool result).

PyPI

Install

pip install maf-algenta
pip install agent-framework-openai   # or any other agent_framework chat client, for Agent below

Depends on agent-framework-core (deliberately not the agent-framework umbrella package, whose [all] extra pulls in Foundry hosted-agent backends this package doesn't use), mcp, and httpx.

Quickstart

from agent_framework import Agent
from agent_framework.openai import OpenAIChatClient
from maf_algenta import create_algenta_tools

async with create_algenta_tools(base_url="http://localhost:8000/mcp", profile="observe") as tools:
    agent = Agent(OpenAIChatClient(), tools=tools)
    result = await agent.run("What's the expected value of scenario X?")
    print(result.text)

An async context manager because agent_framework.MCPStreamableHTTPTool itself is a live connected session — create_algenta_tools owns the connection for the async with block.

Profiles

All four, per the contract: observe (default) · govern · execute · full (opt-in). Filtered twice — at MCP connection time via MCPStreamableHTTPTool(allowed_tools=...) and again over .functions as defense-in-depth.

Notes

  • Both scrub layers are load-bearing here (verified against agent-framework-core 1.15.0): MAF's argument validation only rejects unexpected properties when the schema sets additionalProperties: false, which real MCP-derived schemas don't — so a smuggled force: true would sail through validation if the call-time scrub weren't there. The tests assert on the real received arguments over the real wire.
  • Denials: a real 409 arrives as an MCP tool-error → MAF's ToolExecutionException → parsed and re-raised as AlgentaToolDenied with .blocked.gate / .code / .message / .override_hint, propagating out of Agent.run unmodified. Anomalies raise AlgentaToolExecutionFailed. No fictional approval_state is modeled.
  • Scope: standalone MAF against a self-hosted MCP endpoint only. Microsoft Foundry (hosted Azure platform) is a separate, documentation-only deliverable under foundry/ — not verified against a live Foundry project. .NET parity is likewise unverified.
  • Tests: real stub MCP server + a scripted FakeChatClient driving the real function-invocation loop — uv run pytest maf-algenta -v.

Full reference: package README (verified-live denial mapping, mcp_tool= escape hatch, dependency rationale).

Clone this wiki locally