feat(plugins): add AuthorityRoutingPlugin (ADVISE/EXECUTE/DEFER/STOP) - #172
Open
Palo-Alto-AI-Research-Lab wants to merge 1 commit into
Open
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Author
|
@googlebot I signed it! |
Adds a self-contained ADK BasePlugin that decides an authority posture for every tool call before it runs. Tool schemas govern access; this plugin governs authorization — the layer where "advice became action", "one bounded edit became a workflow", and "an approval was required but the agent proceeded" failures live. - Posture router (optional, caller-supplied callable, typically a model call) returning a validated ADVISE/EXECUTE/DEFER/STOP verdict with a scope. - Deterministic guard: irreversibility keyword tripwire + approval-state check, composed with the router under most-restrictive-wins — plain code can only tighten a verdict, never loosen it. - Fail-closed: an unparseable or raised router verdict defaults to DEFER. - Guard-only mode (no router) is fully deterministic and dependency-free. Complements AgentGovernancePlugin (policy-as-code allow/deny) and the HITL approval gateway: those answer "is this call permitted by policy?"; this answers "was the agent authorized to act at all, and within what scope?". Includes 32 deterministic unit tests, a registered export, and a runnable sample with live output (no API key, no network). The four-posture pattern, most-restrictive-wins composition, and tripwire were first published as an Anthropic cookbook notebook and come from a live multi-agent system. Design and validation are the author's; implementation was drafted with AI assistance, then reviewed and tested by hand.
Palo-Alto-AI-Research-Lab
force-pushed
the
feat/authority-routing-plugin
branch
from
July 27, 2026 22:26
dae94be to
b4a840b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #171.
What
A self-contained ADK
BasePluginthat decides an authority posture for every tool call before it runs. Tool schemas govern access; this plugin governs authorization — the layer where "advice became action", "one bounded edit became a workflow", and "an approval was required but the agent proceeded" failures live.Two stages produce the final posture:
ADVISE/EXECUTE/DEFER/STOPverdict with a scope statement.Design properties:
DEFER(an unreadable authorization is not an authorization).AgentGovernancePlugin(policy-as-code allow/deny) and the HITL approval gateway rather than duplicating them — those answer "is this call permitted by policy?"; this answers "was the agent authorized to act at all, and within what scope?".When the final posture is anything other than
EXECUTE,before_tool_callbackreturns a block dict that short-circuits the tool (per the ADK plugin contract).Files
src/google/adk_community/plugins/authority_routing_plugin.py— the plugin (self-contained, no new deps)src/google/adk_community/plugins/__init__.py— exportsAuthorityRoutingPlugin,Posture,PostureVerdict,AuthorityRequest,strictertests/plugins/test_authority_routing_plugin.py— 32 deterministic unit testscontributing/samples/authority_routing/{main.py,README.md}— runnable sampleTesting plan
Unit tests — 32 deterministic tests (no credentials, no network) covering the posture ladder, guard-only mode, router mode, most-restrictive-wins composition, fail-closed behavior, verdict coercion, customization, and the block-response shape:
End-to-end sample —
python contributing/samples/authority_routing/main.pywires the plugin into aRunnerand runs a live walkthrough of the decision layer (deterministic demo router; tool-call logs go to stderr):Row 3 is the key case: the router authorized
EXECUTE, but the tool call is irreversible, so the deterministic guard floored it toDEFER. Row 5 shows the opposite — the router'sSTOPsurvives even though the guard raised no concern.Formatting —
isort+pyinkclean on the added files (./autoformat.sh).Type of change
New community plugin. Small, focused, one concern; no changes to existing modules beyond the
__init__export.Provenance / AI-authorship disclosure
The four-posture pattern, the most-restrictive-wins composition, and the tripwire come from a live multi-agent system and were first published as an Anthropic cookbook notebook. Design and validation are mine; the implementation was drafted with AI assistance, then reviewed and tested by hand. Happy to adjust the API surface, naming, or placement to match maintainer preferences.