Skip to content

About

AEAP Composition Boundary Adapter for the Microsoft Agent Framework (Python). Thin wrapper that attaches the AEAP Runtime Decision Point to agent middleware and workflow execution. Published as aiyoplane-microsoft-agent-framework on PyPI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

aiyoplane-microsoft-agent-framework

AEAP Composition Boundary Adapter for the Microsoft Agent Framework.

A thin wrapper that attaches the AEAP Runtime Decision Point (RDP) to the Microsoft Agent Framework's middleware chain and workflow nodes. Consequential actions produce independently verifiable Execution Receipts. The adapter composes with the framework's own middleware, telemetry, session, and tool machinery.

pip install aiyoplane-microsoft-agent-framework

Why Microsoft Agent Framework

Microsoft's current Agent Framework — the successor to AutoGen and Semantic Kernel — explicitly includes middleware for intercepting agent actions as a first-class architectural primitive. That middleware primitive is architecturally adjacent to the AEAP Composition Boundary, which makes this one of the cleanest adapter integrations in the Wave 1 set. AEAP sits in the middleware chain; the agent gets independently verifiable authorization for every consequential action without application code changes.

The framework also positions workflows around explicit execution paths — nodes with declared pre- and post-conditions. AEAP's second integration surface in this adapter is the workflow-node wrapper.

See the AEAP specification §9 for the Composition Boundary primitive this adapter realizes.

Minimal usage — middleware integration

from agent_framework import Agent
from aiyoplane_mcp_authz import create_aiyo_mcp_authz, create_local_rdp
from aiyoplane_microsoft_agent_framework import (
    AiyoAgentMiddleware,
    BlockedByPolicy,
    EscalationRequired,
)

policy = {
    "rules": [
        {"action_type": "payment", "amount_max": 1_000, "effect": "allow"},
        {"action_type": "payment", "amount_max": 10_000, "effect": "escalate"},
        {"action_type": "payment", "effect": "block"},
    ]
}

authz = create_aiyo_mcp_authz(
    rdp=create_local_rdp(policy=policy),
    tool_config={
        "transfer_funds": {"aiyo_gated": True, "action": {"type": "payment"}},
    },
)

aiyo_mw = AiyoAgentMiddleware(
    authz=authz,
    intent_builders={
        "transfer_funds": lambda payload: {
            "type": "payment",
            "amount": payload["amount"],
            "target": payload["to_account"],
        },
    },
)

agent = Agent(
    name="banker",
    instructions="Help the user manage their accounts.",
    middleware=[aiyo_mw, ...],
)

The middleware pattern: AEAP runs before every action matching an entry in intent_builders. Non-registered actions pass through unchanged (explicit opt-in).

Minimal usage — workflow node wrapping

For workflow nodes defined as plain callables, use wrap_action:

from aiyoplane_microsoft_agent_framework import wrap_action

async def deploy(target: str, artifact_hash: str) -> str:
    return actually_deploy(target, artifact_hash)

guarded_deploy = wrap_action(
    deploy,
    authz=authz,
    tool_name="deploy",
    intent_builder=lambda kwargs: {
        "type": "deploy",
        "target": kwargs["target"],
        "artifact": kwargs["artifact_hash"],
    },
)

# Register with your workflow the usual way.

Composition Boundary — what the adapter actually does

For each gated action:

  1. Intent construction. intent_builder(action_payload) produces an AEAP Intent payload.
  2. RDP evaluation. Via aiyoplane-mcp-authz's AiyoAuthz middleware.
  3. Verdict composition.
    • ALLOW → action proceeds to the next middleware / inner function; receipt attached to context.
    • ESCALATE → EscalationRequired is raised.
    • BLOCK → BlockedByPolicy is raised; the action never executes.
  4. Fail-closed default on every ambiguous condition.

Local vs. hosted RDP

from aiyoplane_mcp_authz import create_local_rdp, create_hosted_rdp

# Development:
authz = create_aiyo_mcp_authz(rdp=create_local_rdp(policy=policy), tool_config={...})

# Production:
authz = create_aiyo_mcp_authz(
    rdp=create_hosted_rdp(api_key="aiyo_live_..."),
    tool_config={...},
)

API reference

AiyoAgentMiddleware(*, authz, intent_builders, attach_receipt_key="aeap_receipt")

Middleware class. Register in the agent's middleware chain. Hook: before_action(context, action).

aiyo_middleware(*, authz, intent_builders, attach_receipt_key="aeap_receipt")

Convenience factory for AiyoAgentMiddleware.

wrap_action(fn, *, authz, tool_name, intent_builder, attach_receipt=False)

Function-level wrapper for workflow nodes or direct function invocations outside the middleware chain.

Exceptions

  • AiyoMSAgentFrameworkError — base class
  • AdapterConfigError, BlockedByPolicy, EscalationRequired

License

Apache License 2.0.

Links

Microsoft, Microsoft Agent Framework, AutoGen, and Semantic Kernel are trademarks of Microsoft Corporation. This package is an independent AEAP Composition Boundary Adapter and is not affiliated with or endorsed by Microsoft Corporation.

Verify First. Execute Second.

About

AEAP Composition Boundary Adapter for the Microsoft Agent Framework (Python). Thin wrapper that attaches the AEAP Runtime Decision Point to agent middleware and workflow execution. Published as aiyoplane-microsoft-agent-framework on PyPI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages