Run middleware & permission · PyPI 0.1.0 · Alpha · Apache-2.0

beeai-acgs for BeeAI Framework.

Package Specification · Inspected HEAD c63df4e

Framework maintainer
IBM · framework.beeai.dev
Upstream repository
i-am-bee/beeai-framework
PyPI release
beeai-acgs==0.1.0
Python requirement
>=3.11,<3.14
Framework constraint
beeai-framework>=0.1.85,<0.2
Governance engine pin
acgs-lite>=3.0.1,<4
Integration mechanic
Pre-tool veto / intervention hook
Hook entry point
ACGSMiddleware.bind · permission_requirement · decide

01 · Local Setup & Quickstart

Attach governance to one tool-calling agent.

Install the pinned release from PyPI alongside acgs-lite>=3.0.1,<4. Rule evaluation uses deterministic keyword and regex matching locally in Python—no external model or network call is made by the governance check.

Caveat: Pre-0.2 framework target; tested against beeai-framework 0.1.85 with a scripted model on Python >=3.11,<3.14.

Shell · PyPI installation

pip install "beeai-acgs==0.1.0"

Python · BeeAI Framework integration

src/beeai_acgs/middleware.py#L139
from beeai_framework.agents.requirement import RequirementAgent
from beeai_acgs import ACGSMiddleware

agent = RequirementAgent(
    llm=llm,
    tools=[send_email],
    middlewares=[ACGSMiddleware()],
)

02 · Verdict & Review Mapping

How ACGS-Lite verdicts map to BeeAI Framework.

When a tool call is proposed, the adapter formats the tool name and arguments via format_tool_call and evaluates them against the configured Constitution. Blocking rules always take precedence over review rules.

Verdict.ALLOW

Permits the tool call and verifies at tool start that no other listener mutated the arguments after evaluation.

Verdict.DENY

Blocks the tool call and returns the violation reason as the tool output; raises ACGSToolCallChangedError if another listener mutates or forces a denied call.

Verdict.REVIEW

Invokes the configured Approver (such as io_confirm_approver); denied by default when no approver is configured.

03 · Public API Surface

Exported symbols and source entry points.

Each adapter keeps its public surface minimal and re-exports the shared GovernanceDecision, Verdict, and ToolCallFormatter types alongside the framework-specific hook or middleware class.

__all__ exports · beeai-acgs

src/beeai_acgs/middleware.py#L139 ↗
ACGSMiddlewareACGSToolCallChangedErrorApproverReviewRequestio_confirm_approverGovernanceDecisionToolCallFormatterVerdictformat_tool_call

Primary hook surface: ACGSMiddleware.bind · permission_requirement · decide. Custom ToolCallFormatter functions may be supplied if your tool arguments require custom canonical serialization before rule matching.

04 · Scope & Bypass Boundaries

What this adapter does and does not cover.

Verify these framework-specific boundaries when integrating beeai-acgs into an evaluation workflow.

  1. 01

    Covers tool calls inside the BeeAI run, including sub-agent calls via HandoffTool and nested tool-to-tool calls.

  2. 02

    Raises ACGSToolCallChangedError if another event listener modifies tool arguments after ACGS evaluation.

  3. 03

    In the current 0.1.x adapter series, rule evaluation runs through acgs-lite's ToolCallGovernor path. If your workflow requires SignedReceipt, ExecutionGrant, or SQLite EffectStore reservations, wire those contracts explicitly at the tool executor boundary.

Put one real workflow under your control.

Choose one tool. Define what it may do. Inspect what happens when a request crosses the boundary.