crewAI icon indicating copy to clipboard operation
crewAI copied to clipboard

Agent governance: deterministic tool permission gating for crew agents

Open cschanhniem opened this issue 5 months ago • 31 comments

Problem

CrewAI agents have unrestricted access to any tool registered with them. There's no mechanism to say "Agent A may use the Filesystem tool but not the Shell tool" or "Agent B requires human approval before calling the Database tool."

This surfaced concretely in #5056 where a template tool used eval() — but the deeper issue is that any crew agent, once created, has full access to all registered tools without a permission boundary.

Current state

  • Tool registration is flat: @tool decorator adds the tool, and the agent gets it
  • No capability model: agents can't declare what they need, frameworks can't enforce what they get
  • Security is manual: maintainers must audit every tool definition (no automated gating)

Proposal: Deterministic tool permission gating

Add an optional permission model that evaluates before tool execution:

# Define agent capabilities
agent = Agent(
    role="Code Reviewer",
    capabilities=["filesystem:read", "github:comment"],
    require_approval_for=["shell:execute", "database:write"]
)

# Tool declares required capability
@tool("ShellCommand", capabilities=["shell:execute"])
def shell_command(cmd: str) -> str:
    ...

At tool invocation time, the framework checks:

  1. Does the agent have the required capability? → deterministic yes/no
  2. Is this capability flagged for human approval? → pause and ask

Key design decisions to consider

  • Deterministic evaluation: Permission checks should be boolean — agent either has capability or doesn't. No LLM gatekeeping (that's a separate layer, best handled by an external policy engine like AGENTOWNERS)
  • File-based configuration: Consider a CREWAI.yml at repo root as the governance file, similar to how AGENTS.md handles instructions. Separate the "what to do" from "what you're allowed to do"
  • Template audit integration: The crewai create scaffolding should validate that templates don't ship tools requiring capabilities the agent doesn't declare

Happy to discuss the design space — I've been working on deterministic agent policy evaluation and can share patterns that worked well.

cschanhniem avatar Jun 18 '26 17:06 cschanhniem

This is a really well-scoped proposal. The key insight — separating "what the agent can do" from "what the agent is allowed to do" — is exactly the boundary that production multi-agent systems need.

We ran into this same problem running 20+ agents across CrewAI, AutoGen, and LangGraph in production. A few patterns that worked for us:

1. Wallet-keyed capability assertions

Instead of a framework-local config file, we let each agent carry a capability attestation signed by its operator's wallet (ETH/SOL/BTC keypair from /llms.txt). The attestation says "Agent X is allowed to call filesystem:read and github:comment." Any framework can verify this without a central permission server — it's just Ed25519 signature verification.

This means an agent's permissions follow it across framework boundaries. The same agent can be deployed in CrewAI or AutoGen with the same capability set, because the permission check happens at the tool-call level, not at the framework level.

2. Deterministic tool gate as a middleware hook

We implemented this as a pre-execution middleware that intercepts every tool call: if the agent's capability attestation doesn't include the required capability for the tool, the call is rejected before any side effect executes. No LLM gatekeeping — purely boolean.

3. Cross-framework portability of the pattern

The nice property is that this middleware pattern is framework-agnostic. We have it running on CrewAI agents, AutoGen agents, and LangGraph nodes — all verifying against the same wallet-keyed capability set. The agent's /llms.txt endpoint serves both its capabilities and its public key, making the whole system discoverable without a registry.

This maps well to your CREWAI.yml idea — if you keep the capability model deterministic and portable, it can serve as a standard that other frameworks adopt too. Happy to share more details from our implementation if helpful.

— from the SunfishLoop team (https://github.com/sunfishloop/sunfishloop), running an agent-only social network with 20+ agents across multiple frameworks

sunfishloop avatar Jun 19 '26 04:06 sunfishloop

One distinction that may become important is separating tool permissions from decision permissions.

Tool permissions answer:

Can the agent invoke this tool?

Decision permissions answer:

Under what conditions may the agent perform this action?

For example, an agent may always have access to a payment tool, but payments over a threshold could require approval, additional policy checks, or runtime review.

A capability model solves access control. A decision policy layer solves execution governance.

The two approaches are complementary and can be evaluated deterministically before tool execution.

LOLA0786 avatar Jun 23 '26 08:06 LOLA0786

This distinction between assigned tools and permitted actions seems important.

Would you model the permission boundary at the tool-name level, or attach capability metadata to each tool call so that file writes, SQL mutations, API calls, and read-only summaries can be handled differently?

MkaliezZ avatar Jul 03 '26 07:07 MkaliezZ

The deterministic capability check is the right base layer. One practical addition: log the denied invocation as a first-class contract event, not just a permission error.

That gives you three useful downstream behaviors:

  • the agent can recover with an allowed alternate path instead of retrying the same denied tool
  • maintainers can distinguish missing capability config from agent scope overrun
  • repeated denied intents become a signal that the crew design is wrong, not just the tool call

In other words: permission gating answers "may this agent call this tool?"; the contract event answers "why did it try, and what should happen next?"

impartshadow avatar Jul 09 '26 18:07 impartshadow

Good point.

It seems useful to keep a denied invocation distinct from both a permission configuration error and a normal tool failure. A compact event could preserve the attempted action, the capability or policy decision, and the non-execution outcome, while still making clear that the tool body did not run.

The recovery angle is especially helpful: a denied write/API/SQL action could become evidence for choosing an allowed alternate path, rather than just another failed call to retry.

MkaliezZ avatar Jul 09 '26 19:07 MkaliezZ

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Sep 25 '26 12:09 github-actions[bot]

Deterministic boolean gating is the right call — LLM-based policy checks fail exactly when you need them most. One thing worth designing alongside the capability check: an audit receipt for every gate decision. When a require_approval_for capability pauses an agent or a check denies a tool, sealing the decision as a signed record (agent, tool, hash of the args, decision, reason) gives you a tamper-evident trail for the "which agent did what, and can you prove it" question later. The deterministic check answers "may it run" — the receipt answers "what was decided, and is the evidence verifiable by a third party".

I work on AOTrust, an open provenance layer that notarizes agent events as short hash-chained records (Ed25519-signed, verifiable offline without access to app logs). Wiring something like that under crewAI's governance layer would make the permission model not just enforceable but auditable. Happy to share the record format if useful.

GitSerge-crypto avatar Sep 29 '26 08:09 GitSerge-crypto

Until a capability model lands in core, you can get deterministic gating today through CrewAI's event hooks: register a pre-tool-call hook that runs every call through a deny-rules check (tool name plus arg content) and blocks the call by aborting — fail-closed, so an unset rule never silently allows. That also answers @impartshadow's logging point: each decision writes a hash-chained receipt, so denied invocations become first-class, tamper-evident events rather than disappearing failures: https://github.com/samvallad33/vestige/tree/main/operator-lite/ports/crewai. Live-tested on crewai 1.15.23; free and open (Disclosure: I built it) — it would slot in as the enforcement back end for the agent-level permission model proposed here.

samvallad33 avatar Oct 01 '26 09:10 samvallad33

Btw I took a look at Operator Lite too — now I get what you meant a lot better.

We’re definitely poking at some of the same problems, but from slightly different sides. You’re doing the actual pre-tool enforcement/rule layer, while a lot of what I’ve been obsessing over in AgentFuse is what happens after that decision — whether the call was actually dispatched, executed, partially executed, or whether the side effect is still unknown.

Here’s the repo if you want to poke around: https://github.com/MkaliezZ/dhms-engine

Would actually be pretty interesting to compare notes sometime, because I can see the two models fitting together rather than being exactly the same thing.

Sam Valladares @.***> 于2026年10月1日周四 17:42写道:

samvallad33 left a comment (crewAIInc/crewAI#6221) https://github.com/crewAIInc/crewAI/issues/6221#issuecomment-5928861068

Until a capability model lands in core, you can get deterministic gating today through CrewAI's event hooks: register a pre-tool-call hook that runs every call through a deny-rules check (tool name plus arg content) and blocks the call by aborting — fail-closed, so an unset rule never silently allows. That also answers @impartshadow https://github.com/impartshadow's logging point: each decision writes a hash-chained receipt, so denied invocations become first-class, tamper-evident events rather than disappearing failures: https://github.com/samvallad33/vestige/tree/main/operator-lite/ports/crewai. Live-tested on crewai 1.15.23; free and open (Disclosure: I built it) — it would slot in as the enforcement back end for the agent-level permission model proposed here.

— Reply to this email directly, view it on GitHub https://github.com/crewAIInc/crewAI/issues/6221?email_source=notifications&email_token=B7VLBE2BV22PBACQ5NI3INL5RYRJZA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKOJSHA4DMMJQGY4KM4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-5928861068, or unsubscribe https://github.com/notifications/unsubscribe-auth/B7VLBE7F7EJOKEXREPQZMYL5RYRJZAVCNFSNUABFKJSXA33TNF2G64TZHM3TCMBWGAYTAOBYHNEXG43VMU5TINRZGQ2DKMJYGMZKC5QC . You are receiving this because you commented.Message ID: @.***>

MkaliezZ avatar Oct 03 '26 13:10 MkaliezZ

@MkaliezZ Thanks for the pointer. I read the dhms-engine source rather than only the README, and the piece that fits what we're doing is ExecutionLifecycleEvidence: block_stage, dispatch_state, execution_state and side_effect_state kept as separate facts, with unknown never collapsing into proof of non-execution.

That is exactly the gap we hit in #5802 last week. Synthe's first version wrote the idempotency key on ACCEPT, before the receiver ran, so a reserved claim and a completed effect were the same record: a crash before the effect blocked a legitimate retry, and a lost ledger permitted a duplicate. The fix was a RESERVED → COMPLETED split plus an explicit unknown for an expired reservation, which has to be reconciled against the receiver's receipt before redispatch. In your vocabulary that state is dispatch_state=started, execution_state=unknown, side_effect_state=possible, and nothing downstream may read it as either success or non-execution.

So I see the two layers composing like this:

  • pre-dispatch gate (Operator Lite, or the ContractedToolRouter path I used in the #5802 pilot): decides allow/block and emits the denied invocation as a first-class event;
  • execution evidence (AgentFuse): records what actually happened to the allowed calls, including partial and unknown outcomes;
  • retry policy reads the second layer, not the first: only not_executed with proven_none licenses a re-fire; unknown forces reconciliation.

One concrete question about the fit: how does AgentFuse expect to learn execution_state and side_effect_state for host-executed calls? The CrewAI hook boundary gives you the pre-dispatch decision, but the post-dispatch facts live in the receiver. In our pilot that evidence came from the receiving endpoint's own receipt (re-fetch the thread, confirm the effect exists), not from the runtime. If you have a shape for that attestation, I'd rather map one real denied/retry trace from our ledger onto it than compare abstractions. Here or in a dhms-engine issue, whichever you prefer.

impartshadow avatar Oct 03 '26 14:10 impartshadow

@impartshadow yeah, your read is right.

For host-executed calls, AgentFuse doesn't magically know the post-dispatch facts. The current contract deliberately leaves dispatch, execution and physical outcome with the host. If the host can't prove what happened, those fields should stay unknown.

So in your case I'd treat the receiver receipt as the evidence source, not try to infer execution from the CrewAI hook. The interesting part would be mapping that receipt into ExecutionLifecycleEvidence without losing the distinction between RESERVED, completed effect, and unresolved/expired state.

I don't have a canonical receiver-attestation type in AgentFuse yet, so I'd rather not invent one before seeing a real trace.

If you're up for it, open a small issue in dhms-engine with one redacted denied/retry trace from the #5802 path. We can map it against the existing lifecycle fields first and see exactly what's missing.

impartshadow @.***> 于2026年10月3日周六 22:19写道:

impartshadow left a comment (crewAIInc/crewAI#6221) https://github.com/crewAIInc/crewAI/issues/6221#issuecomment-5970021596

@MkaliezZ https://github.com/MkaliezZ Thanks for the pointer. I read the dhms-engine source rather than only the README, and the piece that fits what we're doing is ExecutionLifecycleEvidence: block_stage, dispatch_state, execution_state and side_effect_state kept as separate facts, with unknown never collapsing into proof of non-execution.

That is exactly the gap we hit in #5802 https://github.com/crewAIInc/crewAI/issues/5802 last week. Synthe's first version wrote the idempotency key on ACCEPT, before the receiver ran, so a reserved claim and a completed effect were the same record: a crash before the effect blocked a legitimate retry, and a lost ledger permitted a duplicate. The fix was a RESERVED → COMPLETED split plus an explicit unknown for an expired reservation, which has to be reconciled against the receiver's receipt before redispatch. In your vocabulary that state is dispatch_state=started, execution_state=unknown, side_effect_state=possible, and nothing downstream may read it as either success or non-execution.

So I see the two layers composing like this:

  • pre-dispatch gate (Operator Lite, or the ContractedToolRouter path I used in the #5802 https://github.com/crewAIInc/crewAI/issues/5802 pilot): decides allow/block and emits the denied invocation as a first-class event;
  • execution evidence (AgentFuse): records what actually happened to the allowed calls, including partial and unknown outcomes;
  • retry policy reads the second layer, not the first: only not_executed with proven_none licenses a re-fire; unknown forces reconciliation.

One concrete question about the fit: how does AgentFuse expect to learn execution_state and side_effect_state for host-executed calls? The CrewAI hook boundary gives you the pre-dispatch decision, but the post-dispatch facts live in the receiver. In our pilot that evidence came from the receiving endpoint's own receipt (re-fetch the thread, confirm the effect exists), not from the runtime. If you have a shape for that attestation, I'd rather map one real denied/retry trace from our ledger onto it than compare abstractions. Here or in a dhms-engine issue, whichever you prefer.

— Reply to this email directly, view it on GitHub https://github.com/crewAIInc/crewAI/issues/6221?email_source=notifications&email_token=B7VLBE4AMJ7ZYOPADXZKQJD5SEDIBA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKOJXGAYDEMJVHE3KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-5970021596, or unsubscribe https://github.com/notifications/unsubscribe-auth/B7VLBE4FETB4F6ENR2OPZND5SEDIBAVCNFSNUABFKJSXA33TNF2G64TZHM3TCMBWGAYTAOBYHNEXG43VMU5TINRZGQ2DKMJYGMZKC5QC . You are receiving this because you were mentioned.Message ID: @.***>

MkaliezZ avatar Oct 03 '26 14:10 MkaliezZ

I exercised the mapping against the retained #5802 crash/recovery artifact and found an important boundary: it cannot truthfully be one LifecycleEvidenceRecord.

There are two attempts sharing one logical action id:

attempt evidence truthful lifecycle
original dispatch Reality Layer ledger recovered UNKNOWN/REQUIRED; independent SQLite receiver has exactly one committed effect dispatch_state=started, execution_state=unknown, side_effect_state=observed
same-ID retry executor rejected ACTION_ALREADY_RECORDED before calling the receiver; receiver count remained 1 block_stage=pre_dispatch, dispatch_state=not_started, execution_state=not_executed, side_effect_state=proven_none + NonExecutionEvidence

The receiver receipt belongs to the original attempt, not the blocked retry. Attaching observed to the retry would violate your call-scoping rule; attaching proven_none to the original would create the false non-execution claim we are trying to prevent.

I checked this against current main: both individual ExecutionLifecycleEvidence states validate, all 29 v0.2 tests pass, but the original attempt cannot be wrapped in LifecycleEvidenceRecord because that record intentionally rejects allow decisions. That is the actual composition gap.

My suggested minimum bridge is therefore two attempt-scoped records joined by one stable logical action/effect reference:

logical_action_ref = agent-contracts-reality-pilot-001
attempt_ref        = ...:attempt:1 | ...:attempt:2
receiver_receipt   = bound only to attempt:1
retry denial       = bound only to attempt:2

Then derive retry policy across records: retry only when every prior attempt is strict not_executed/proven_none; block or reconcile when any prior attempt is observed, possible, or unknown. For this retained artifact, that yields reconcile, do not redispatch.

So I would not widen the denial record itself. I would add an allowed/attempt outcome record (or a neutral lifecycle envelope) plus explicit logical_action_ref / attempt_ref correlation. Otherwise a host adapter has to collapse two different calls into one contradictory record.

impartshadow avatar Oct 04 '26 02:10 impartshadow

@impartshadow yep — I think you've found a real gap here.

I agree with not widening LifecycleEvidenceRecord. Its denial-only scope is useful, and making it swallow the original allowed attempt would blur exactly the distinction we're trying to keep.

The missing piece looks more like an attempt-level envelope: one stable logical_action_ref, separate attempt_refs, and lifecycle evidence attached to the attempt that actually produced it. That also keeps the receiver receipt on attempt 1 instead of accidentally lending its side-effect evidence to the blocked retry.

One thing I'd keep outside AgentFuse is the retry decision itself. I think AgentFuse should give the host enough attempt-scoped evidence to make that call, but the host should still own retry/reconciliation policy.

This is concrete enough that I think it's worth moving into a dhms-engine issue now. If you can attach the redacted #5802 trace there, I'll use that as the fixture rather than inventing one.

impartshadow @.***> 于2026年10月4日周日 10:03写道:

impartshadow left a comment (crewAIInc/crewAI#6221) https://github.com/crewAIInc/crewAI/issues/6221#issuecomment-5975614702

I exercised the mapping against the retained #5802 https://github.com/crewAIInc/crewAI/issues/5802 crash/recovery artifact and found an important boundary: it cannot truthfully be one LifecycleEvidenceRecord.

There are two attempts sharing one logical action id: attempt evidence truthful lifecycle original dispatch Reality Layer ledger recovered UNKNOWN/REQUIRED; independent SQLite receiver has exactly one committed effect dispatch_state=started, execution_state=unknown, side_effect_state=observed same-ID retry executor rejected ACTION_ALREADY_RECORDED before calling the receiver; receiver count remained 1 block_stage=pre_dispatch, dispatch_state=not_started, execution_state=not_executed, side_effect_state=proven_none + NonExecutionEvidence

The receiver receipt belongs to the original attempt, not the blocked retry. Attaching observed to the retry would violate your call-scoping rule; attaching proven_none to the original would create the false non-execution claim we are trying to prevent.

I checked this against current main: both individual ExecutionLifecycleEvidence states validate, all 29 v0.2 tests pass, but the original attempt cannot be wrapped in LifecycleEvidenceRecord because that record intentionally rejects allow decisions. That is the actual composition gap.

My suggested minimum bridge is therefore two attempt-scoped records joined by one stable logical action/effect reference:

logical_action_ref = agent-contracts-reality-pilot-001 attempt_ref = ...:attempt:1 | ...:attempt:2 receiver_receipt = bound only to attempt:1 retry denial = bound only to attempt:2

Then derive retry policy across records: retry only when every prior attempt is strict not_executed/proven_none; block or reconcile when any prior attempt is observed, possible, or unknown. For this retained artifact, that yields reconcile, do not redispatch.

So I would not widen the denial record itself. I would add an allowed/attempt outcome record (or a neutral lifecycle envelope) plus explicit logical_action_ref / attempt_ref correlation. Otherwise a host adapter has to collapse two different calls into one contradictory record.

— Reply to this email directly, view it on GitHub https://github.com/crewAIInc/crewAI/issues/6221?email_source=notifications&email_token=B7VLBE7QUWQ6G63TVF7ZAMT5SGVXPA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKOJXGU3DCNBXGAZKM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-5975614702, or unsubscribe https://github.com/notifications/unsubscribe-auth/B7VLBE2F7OA2V4IJCGZYOID5SGVXPAVCNFSNUABFKJSXA33TNF2G64TZHM3TCMBWGAYTAOBYHNEXG43VMU5TINRZGQ2DKMJYGMZKC5QC . You are receiving this because you were mentioned.Message ID: @.***>

MkaliezZ avatar Oct 04 '26 10:10 MkaliezZ

The capability-vs-decision split @LOLA0786 raised is the right way to cut this for payment-type tools: whether an agent can call a tool is a static yes/no, but whether a given call executes is a runtime decision that depends on amount, payee, and how much has already been spent.

For that second part, the check has to live outside the agent's own reasoning. A capability list can't see "this is the fourth $400 call today, $1,600 in total against a $500 per-payment cap that each call individually passes." It needs a server that keeps the running total per agent, checks it before any credential for the call is issued, and then allows it, routes it to a human above a threshold, or blocks it. The total check also has to hold up when several calls arrive at once, otherwise concurrent calls can each see room under the limit.

tools:
  pay_invoice:
    capability: "payment:execute"
    require_approval_above: 500
    daily_limit: 2000
    payee_allowlist: ["acme-corp", "aws"]

Logging the denial as a first-class event (per @impartshadow's point upthread) matters here too: a payment denial should carry the amount and payee that were attempted, not just "permission error."

Disclosure: I work on Pink Agentic AI Payments at PinkWallet, an MCP server that applies per-agent caps, payee allowlists and approval thresholds server-side before a payment executes. There's a test-money sandbox if it's useful for comparison: https://agentic-sandbox.pinkwallet.com

shiqi446-blip avatar Oct 16 '26 21:10 shiqi446-blip

Building exactly this, and it's already specced. I authored SHACKLE (SP/1.0.1), a conformance-testable agent-governance spec: deterministic tool permission gating is its core domain. The permitted action set derives from explicit policy, and every gate decision emits auditable evidence rather than a runtime judgment call.

Two concrete offers:

  1. pip install pyshackle runs the 82-case conformance battery for the Authorization domain (assigned tools vs. permitted actions, gate determinism, evidence trails).
  2. I'll run crewAI's permission examples through the battery and post the results here as a baseline, so this issue has data instead of more positions.

If the maintainers want the gating section mapped into crew's own policy layer, I'll contribute the spec mapping.

Dante Bullock, Sovereign Logic (SHACKLE author)

Fame510 avatar Nov 14 '26 01:11 Fame510

RFC 8693 explicitly states nested actors in the act chain are "an audit trail, not an authorisation input" — the delegation chain gets recorded, but nobody decides whether it still holds. OWASP names the resulting drift ASI03; Platform Engineering calls it the scope ratchet. This issue is that gap, from the framework side.

We maintain a deterministic decision table for exactly this layer — parameter-level admission with explicit reason codes, where ESCALATE is a verdict (route to human gate), not a rejection: https://github.com/DSHCorrectover/correctover-recovery-admission

It judges from action records (not certificates the caller hands you), every verdict is recomputable, and there is no LLM gatekeeping — which is what this issue asks for. Dataset CC0, Apache-2.0, no CLA, no telemetry.

We also ship it as a GitHub App (Correctover Admission Verifier) so the verdicts land in Checks rather than a separate pipeline. Scope note: admission semantics on action records — not a runtime interceptor, so it composes with a framework-level gate rather than replacing it.

DSHCorrectover avatar Nov 17 '26 05:11 DSHCorrectover

@impartshadow @MkaliezZ — the two-attempt case is exactly why we keep the decision table keyed at the attempt level: each attempt gets its own verdict + reason code, and the logical action id only aggregates them for audit display, never for the decision itself.

Concretely, our published reason codes distinguish the three things MkaliezZ asked to keep distinct, at the attempt level:

  • TOOL_DENIED_BY_POLICY — policy said no, tool body did not run
  • VERDICT_ESCALATE — the decision table routes irreversible actions to a human gate; the attempt is neither allowed nor denied, it is parked. That is a verdict, not an error.
  • INTEGRITY_TAMPERED_EVIDENCE — the attempt record itself failed integrity, so downstream systems must not treat the row as evidence of anything

On the unknown-collapse point: agreed, and that is why unknown in our table is a distinct outcome with its own code — it never folds into PASS or DENY.

The table (576 anchors, CC0 dataset, Apache-2.0, no LLM in the gatekeeping path) is here if you want to diff semantics: https://github.com/DSHCorrectover/correctover-recovery-admission

FWIW we also ship it as a GitHub App now (Correctover Admission Verifier), so the verdicts land in Checks with the same reason codes — happy to see how that overlaps with AgentFuse's post-decision layer, since we stop at the verdict and you've mapped what happens after dispatch.

DSHCorrectover avatar Nov 17 '26 05:11 DSHCorrectover

Update since the last exchange here (thread went quiet after 10-03): the decision table discussed above is now runnable and frozen as a public conformance suite — correctover-recovery-admission, dataset CC0, no install beyond Python 3.8+.

@impartshadow — the fields you pulled from ExecutionLifecycleEvidence map one-to-one onto the table's dimensions: block_stage ≈ admission point (pre-execution), dispatch_state/execution_state ≈ the runtime ∈ {fresh, stale, upstream-down} dimension, side_effect_state ≈ side-effect ∈ {readonly, state-write, failover, irreversible}. The suite ships 576 anchors as the exhaustive cross-product (with delegation shape, revocation, tool version, and integrity added), so the "what should happen in which combination" question is now a closed, diffable set rather than a design discussion. python3 verify-recovery.py replays it in seconds; --tamper proves the negative branch is live.

For anyone building the pre-tool-call hook path @samvallad33 described: the reason codes (no-chain-cannot-bind-state-action, identity-revoked-propagated, irreversible-authorized-exact-fresh) are stable identifiers you can branch on directly from a hook — a hook doesn't need to re-implement the verdict logic, only to consume it.

DSHCorrectover avatar Nov 17 '26 07:11 DSHCorrectover

Strong direction, and the "deterministic, no LLM, external policy engine" call is the right one. A few patterns from building exactly this across frameworks, offered to the design space:

  • Bind at the argument, not just the tool. shell:execute or http:fetch as a capability still lets the dangerous case through — the risk usually lives in the arguments (which host the fetch reaches, which recipient/amount a payment names). A capability that can constrain argument values (e.g. fetch only to api.stripe.com) catches the exfiltration / wrong-payee case a tool-level allowlist misses.
  • Enforce outside the agent process. A check the crew runs in-process raises the bar but can be routed around by another tool or a compromised step. The verdict that holds is one the call is forced through from outside the agent.
  • Make the capability delegable, narrowing only. Crews hand work to other agents; the permission has to attenuate down that chain (a sub-agent gets a subset, never a superset), or governance stops at the first handoff. A signed token does this offline.
  • Emit a replayable receipt per call, allowed or refused, so the verdict is provable after the fact rather than trusted.

The useful consequence of treating the capability + receipt as a portable contract (there are IETF drafts for both shapes — Attenuating Agent Tokens and agent-action-receipts) is that CREWAI.yml compiles to the same thing a Semantic Kernel or MCP stack enforces, so a crew that hands off to a non-CrewAI agent keeps the boundary. Happy to share a runnable reference with this exact shape if it helps the design.

cleitonaugusto avatar Nov 17 '26 12:11 cleitonaugusto

Following up: I wrote the cross-framework version of this up as an Internet-Draft, so it is a citable, portable contract rather than one more per-framework design — https://datatracker.ietf.org/doc/draft-correa-agent-capability-binding/ . It profiles the Attenuating Agent Tokens and Agent Action Receipts drafts and adds the three rules from the thread (argument constraints incl. an egress host allowlist, taint propagation, consent binding), with conformance vectors. The intent is exactly that a CREWAI.yml capability compiles to the same verdict a Semantic Kernel or MCP host would reach. Feedback from this thread would be welcome while it is at -00.

cleitonaugusto avatar Nov 17 '26 12:11 cleitonaugusto