Skip to content

[AAASM-3538] ✨ (adapters): Add Microsoft Agent Framework adapter#164

Merged
Chisanan232 merged 8 commits into
masterfrom
v0.0.1/AAASM-3538/feat/ms_agent_framework_support
Jun 22, 2026
Merged

[AAASM-3538] ✨ (adapters): Add Microsoft Agent Framework adapter#164
Chisanan232 merged 8 commits into
masterfrom
v0.0.1/AAASM-3538/feat/ms_agent_framework_support

Conversation

@Chisanan232

Copy link
Copy Markdown
Contributor

Description

Adds full Python-SDK governance support for Microsoft Agent Framework — the unified MS framework published on PyPI as agent-framework (importable module agent_framework, verified at v1.9.0).

The adapter (agent_assembly/adapters/microsoft_agent_framework/) hooks agent_framework.FunctionTool.invoke — the single async coroutine through which every function tool executes (both @agent_framework.tool-decorated callables and direct FunctionTool(...) instances). Patching that one method governs all tool execution without requiring the user to register any opt-in framework middleware.

Key points:

  • is_available() probes the importable agent_framework module, not the framework name microsoft_agent_framework — avoiding the AAASM-3528 silent no-op.
  • Governance contract mirrors the CrewAI / Pydantic AI adapters: deny raises PolicyViolationError before the wrapped function runs (no side effect); allow runs it and records the result; pending waits for approval; an unknown/malformed verdict fails closed under enforce and open under observe/disabled.
  • Registered as a builtin adapter (priority 6, after Google ADK, before the MCP fallback).

Type of Change

  • ✨ New feature

Breaking Changes

  • No

Related Issues

  • Related JIRA ticket: AAASM-3538 (parent AAASM-3535)

Testing

  • Unit tests added/updated

test/unit/adapters/microsoft_agent_framework/ proves real governance, not a no-op:

  • Fake-FunctionTool tests verify deny blocks AND prevents the wrapped function's side effect, allow runs + records, pending-then-deny rejects, and fail-closed/open verdict handling.
  • An importorskip-guarded test drives the real agent_framework.FunctionTool with a negative control: the ungoverned call executes its side effect; deny then prevents it; allow runs it and records the result.

All 16 new tests pass; the full 304-test adapter suite is green. ruff check, ruff format, and the configured mypy are clean on the new files.

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Comments added for complex logic
  • Documentation updated if needed
  • All tests passing

Refs AAASM-3538

🤖 Generated with Claude Code

Chisanan232 and others added 4 commits June 22, 2026 14:23
Govern Microsoft's unified Agent Framework (PyPI `agent-framework`, module
`agent_framework`) by monkey-patching `FunctionTool.invoke` — the single async
coroutine through which every function tool executes. This intercepts both
`@tool`-decorated callables and direct `FunctionTool(...)` instances without
requiring any opt-in framework middleware.

`is_available()` probes the importable `agent_framework` module rather than the
framework name (`microsoft_agent_framework`), avoiding the AAASM-3528 silent
no-op. Deny raises `PolicyViolationError` before the wrapped function runs;
allow runs it and records the result; pending waits for approval; unknown
verdicts fail closed under enforce.

Refs AAASM-3538

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Wire MicrosoftAgentFrameworkAdapter into the AdapterRegistry builtin set and
give it priority 6 (after Google ADK, before the MCP fallback) so
`init_assembly()` auto-detects and hooks it whenever `agent_framework` is
importable.

Refs AAASM-3538

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Prove the adapter genuinely governs rather than no-ops (AAASM-3528): a deny
verdict blocks the tool AND prevents its side effect, allow runs it and records
the result, pending-then-deny rejects at approval, and unknown verdicts fail
closed under enforce / open otherwise. A guarded `importorskip` test drives the
REAL `agent_framework.FunctionTool` with a negative control showing the
ungoverned call executes the side effect, then deny prevents it.

Refs AAASM-3538

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add the Microsoft Agent Framework row to the README and compatibility tables,
note the `agent-framework` (PyPI) vs `agent_framework` (import) split, the
`FunctionTool.invoke` hook point, and the pre-release install caveat (uv needs
`--prerelease=allow`). Link the framework-support status row to the new example.

Refs AAASM-3538

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread agent_assembly/adapters/microsoft_agent_framework/patch.py Dismissed
Comment thread agent_assembly/adapters/microsoft_agent_framework/patch.py Dismissed
@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.65517% with 21 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...sembly/adapters/microsoft_agent_framework/patch.py 90.53% 16 Missing ⚠️
...mbly/adapters/microsoft_agent_framework/adapter.py 83.33% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Chisanan232

Copy link
Copy Markdown
Contributor Author

Claude Code — review result

✅ Real CI green (SonarCloud not blocking).

  • Framework facts (the newness risk, resolved): pip install agent-framework resolves cleanly; importable module is agent_framework 1.9.0. Install caveat: it pulls pre-release sub-distributions, so uv needs --prerelease=allow (pip doesn't) — documented in the integration-tests + examples PRs.
  • Adapter: hooks agent_framework.FunctionTool.invoke (the single async coroutine every function tool runs through; middleware would be bypassable, this isn't). Registered (priority 6). is_available() probes the real import name agent_framework, not the framework's display name — the exact AAASM-3528 trap, avoided. ✔
  • Governance proven: negative control against the installed framework — deny raises PolicyViolationError and prevents the side effect; allow runs+records; revert restores. ✔
  • Shared files: trivial keep-all overlap with siblings.

Ready to merge. No blocker — the framework installed and hooked cleanly. Merge before examples #153 + a python-sdk release. Full cross-repo review on AAASM-3535.

Chisanan232 and others added 4 commits June 22, 2026 15:48
Resolve registry + README overlaps after py #160 (Haystack) merged:
keep both frameworks' entries/imports/builtins. frameworks.md + compat
table auto-merged (both rows present).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…eat/ms_agent_framework_support

# Conflicts:
#	README.md
#	agent_assembly/adapters/registry.py
#	docs/compatibility/frameworks.md
…eat/ms_agent_framework_support

# Conflicts:
#	README.md
#	agent_assembly/adapters/registry.py
#	docs/compatibility/frameworks.md
…eat/ms_agent_framework_support

# Conflicts:
#	README.md
#	agent_assembly/adapters/registry.py
@sonarqubecloud

Copy link
Copy Markdown

@Chisanan232 Chisanan232 merged commit 7d389dc into master Jun 22, 2026
23 checks passed
@Chisanan232 Chisanan232 deleted the v0.0.1/AAASM-3538/feat/ms_agent_framework_support branch June 22, 2026 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant