Skip to main content

aiyoplane-crewai

AEAP Composition Boundary Adapter for CrewAI.

A thin wrapper that attaches the AEAP Runtime Decision Point (RDP) to CrewAI's tool invocation surface. Consequential tool executions by any crew member produce independently verifiable Execution Receipts. The adapter composes with CrewAI's Flow, Crew, Agent, and Task primitives — it does not replace any of them.

pip install aiyoplane-crewai

Why this matters for multi-agent crews

CrewAI's architecture is deliberately about multiple specialized agents coordinating on a workflow:

Research agent → Analysis agent → Purchasing agent → Payment agent → Fulfillment agent

Each agent has a role, a goal, and tools. Role assignment answers "may this crew member perform this class of action?" — identity and delegation. AEAP answers a different question at the tool-invocation moment: "should this specific action execute right now, under the Protected Party's current Policy, against the specific Intent being formed?" The two layers compose; AEAP sits beneath the crew structure.

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

Minimal usage

from crewai import Agent, Task, Crew
from crewai.tools import BaseTool
from aiyoplane_mcp_authz import create_aiyo_mcp_authz, create_local_rdp
from aiyoplane_crewai import wrap_tool

class TransferFundsTool(BaseTool):
    name: str = "transfer_funds"
    description: str = "Transfer funds between accounts."

    def _run(self, amount: int, to_account: str) -> str:
        return actually_transfer(amount, to_account)

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"}},
    },
)

guarded_transfer = wrap_tool(
    TransferFundsTool(),
    authz=authz,
    intent_builder=lambda kwargs: {
        "type": "payment",
        "amount": kwargs["amount"],
        "target": kwargs["to_account"],
    },
)

# Attach the gated tool to a crew member the usual way:
banker = Agent(
    role="Banker",
    goal="Execute payment transactions for the user.",
    backstory="A senior banker focused on correct and policy-compliant transfers.",
    tools=[guarded_transfer],
)

Wrapping a whole tool list

from aiyoplane_crewai import wrap_tools

all_tools = [SearchDocsTool(), ReadUserTool(), TransferFundsTool(), DeleteAccountTool()]

guarded_tools = wrap_tools(
    all_tools,
    authz=authz,
    intent_builders={
        "transfer_funds": lambda kw: {"type": "payment", "amount": kw["amount"]},
        "delete_account": lambda kw: {"type": "destructive", "target": kw["user_id"]},
    },
)

Tools whose name is not a key in intent_builders pass through unchanged.

Composition Boundary — what the adapter actually does

For each wrapped tool invocation:

  1. Intent construction. intent_builder(tool_kwargs) produces an AEAP Intent payload.
  2. RDP evaluation. Via aiyoplane-mcp-authz's AiyoAuthz middleware.
  3. Verdict composition.
    • ALLOW → inner tool _run/_arun executes with the original arguments.
    • ESCALATE → EscalationRequired is raised; the crew's error handling decides routing.
    • BLOCK → BlockedByPolicy is raised; the tool 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

wrap_tool(tool, *, authz, intent_builder, tool_name_for_authz=None, return_receipt=False)

Wrap a single CrewAI tool. Returns an AiyoCrewAITool (also a BaseTool).

wrap_tools(tools, *, authz, intent_builders, return_receipt=False)

Wrap a collection. Explicit opt-in via intent_builders keys.

Exceptions

  • AiyoCrewAIError — base class
  • AdapterConfigError — adapter configuration is invalid
  • BlockedByPolicy — RDP returned BLOCK
  • EscalationRequired — RDP returned ESCALATE

License

Apache License 2.0.

CrewAI is a trademark of its respective owners. This package is an independent AEAP Composition Boundary Adapter and is not affiliated with or endorsed by the CrewAI team.

Verify First. Execute Second.

Metadata

Release files for aiyoplane-crewai 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiyoplane-crewai 1.0.2
File Size Uploaded
aiyoplane_crewai-1.0.2.tar.gz 13.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aiyoplane-crewai 1.0.2
File Interpreter ABI Platform
aiyoplane_crewai-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 25.6 kB

Release files / aiyoplane_crewai-1.0.2.tar.gz

Download URL aiyoplane_crewai-1.0.2.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
719aeb21d5529018a5aeba5fe0a1c9527d9adb6d06628e3eb4a2e5b05d21d2d8
BLAKE2b-256 checksum
How to use checksums
1d6fda61b67282664b025aa52f2d3559a6828574a43e02435e7f5437fb707830
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.0rc3

Release files / aiyoplane_crewai-1.0.2-py3-none-any.whl

Download URL aiyoplane_crewai-1.0.2-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
773f330c0ce75d1b72918192ebba6bc0f54709772c70312121841080939520bb
BLAKE2b-256 checksum
How to use checksums
d7a8f07997247a41929d61634f011c6c1ed4ed17c4f8c6d26d94dde89bd07aab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.0rc3

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page