Skip to main content

Secure & Verifiable Tool Invocation Flow

This CrewAI Flow template wraps a sensitive agent tool call with policy checking, evidence capture, signed execution receipts, and independent validation reports.

The default demo requires no LLM API key and no network access.

What this template does

  • Checks whether a tool invocation is allowed by an exact-match policy snapshot and tool manifest.
  • Captures deterministic evidence for one specific tool invocation.
  • Signs the resulting execution receipt with Ed25519.
  • Validates the receipt independently against the request, policy snapshot, tool manifest, tool input, and tool output.
  • Produces a CrewAI Flow wrapper that orchestrates the existing reusable modules without reimplementing them.

When to use it

  • Sensitive dataset metadata access.
  • Controlled API or tool calls that need audit evidence.
  • Compliance-oriented agent workflows.
  • Accountable data operations.
  • Data-space-like environments that need portable execution evidence.
  • Audit-oriented agent tool execution where runtime and verification should be separable.

What it guarantees

  • It generates deterministic evidence for a specific tool invocation.
  • It signs the execution receipt with Ed25519.
  • It validates that the receipt matches the request, policy snapshot, tool manifest, tool input, and tool output.
  • It detects tampering of receipt or evidence artifacts.
  • It validates audience binding, request binding, policy alignment, time window, and signature.
  • It optionally detects replay when replay cache is enabled.

What it does NOT guarantee

This template provides verifiable execution evidence for a tool invocation. It does not prove semantic correctness of the tool output. It does not prove that the policy itself is correct. It does not protect against a compromised signer. It does not replace sandboxing, IAM, access control, monitoring, or human approval. It does not require or expose raw chain-of-thought. It is not a full FDO, Gaia-X, IDS, or EDC implementation.

Architecture

ExecutionRequest
  -> PolicySnapshot / ToolManifest
  -> guarded_tool_call()
  -> demo_metadata_lookup_tool()
  -> evidence_bundle.json
  -> execution_receipt.json
  -> independent validator
  -> verification_report.json

The CrewAI Flow is only orchestration. The reusable core is guarded_tool_call(). The validator can run outside the agent runtime.

Repository layout

  • src/verifiable_tool_invocation_flow/: reusable modules, demo tool, validator, and Flow wrapper.
  • schemas/: JSON Schema for receipts and verification reports.
  • examples/: deterministic demo request, policy, manifest, tool input, and tool output fixtures.
  • tests/: unit and integration tests for hashing, signing, policy, receipts, validation, guarded calls, and Flow orchestration.
  • docs/: architecture, assumptions, threat model, integration guidance, and marketplace submission material.
  • outputs/: generated demo artifacts. Git tracks only outputs/.gitkeep.

Requirements

  • Python >=3.10,<3.14
  • CrewAI
  • cryptography
  • pydantic
  • jsonschema
  • pytest for tests

CrewAI currently does not support Python 3.14 for this project. Use Python 3.10, 3.11, 3.12, or 3.13.

Quickstart

python -m venv .venv
source .venv/bin/activate
python -m pip install -e ".[test]"
python -m verifiable_tool_invocation_flow.main
uv sync
uv run python -m verifiable_tool_invocation_flow.main

If the CrewAI CLI is available in a supported Python environment:

crewai run

Expected outputs

  • outputs/evidence_bundle.json
  • outputs/execution_receipt.json
  • outputs/verification_report.json
  • outputs/demo_public_key.pem

demo_public_key.pem is public and safe to write. No private key is written. outputs/ is ignored by Git except outputs/.gitkeep.

Run the independent validator

python -m verifiable_tool_invocation_flow.validator \
  --receipt outputs/execution_receipt.json \
  --evidence outputs/evidence_bundle.json \
  --public-key outputs/demo_public_key.pem \
  --audience demo-validator \
  --out outputs/verification_report.cli.json

Use in your own Flow

from verifiable_tool_invocation_flow.guarded_tool_call import guarded_tool_call
from verifiable_tool_invocation_flow.signer import ReceiptSigner

result = guarded_tool_call(
    request=request,
    policy=policy_snapshot,
    tool_manifest=tool_manifest,
    tool_input=tool_input,
    tool_fn=my_sensitive_tool,
    signer=ReceiptSigner.generate_demo(),
)

if result.verification_report["verdict"] != "valid":
    raise RuntimeError("Tool invocation could not be verified")

Validator rules

  • schema_valid
  • input_hash_match
  • policy_hash_match
  • tool_manifest_hash_match
  • tool_input_hash_match
  • tool_output_hash_match
  • result_hash_match
  • pre_execution_commitment_match
  • policy_decision_valid
  • signature_valid
  • time_window_valid
  • replay_check_performed
  • replay_detected
  • audience_match
  • request_binding_match

Replay protection

Replay protection is disabled unless replay_cache_path is provided. The built-in replay cache is file-based and demo-level only. Production systems should use a shared durable replay store.

Security assumptions

The validator assumes authentic public-key distribution, stable canonical JSON rules, and access to the receipt plus evidence bundle. See docs/security_assumptions.md.

Threat model

The threat model covers tampering, policy mismatch, replay, wrong audience, wrong public key, compromised signer, and guarantee-boundary misunderstandings. See docs/threat_model.md.

FDO / Data Space mapping

This template provides an FDO/Data-Space-like mapping for demonstration only. It is not a full implementation of FDO, Gaia-X, IDS, or EDC. See docs/fdo_dataspace_mapping.md.

Marketplace submission note

Marketplace-ready project naming, descriptions, categories, and submission checklist are in docs/marketplace_submission_note.md.

Metadata

Release files for verifiable-tool-invocation-flow 0.1.1

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

Source distribution (sdist)

Source distribution for verifiable-tool-invocation-flow 0.1.1
File Size Uploaded Provenance Actions
verifiable_tool_invocation_flow-0.1.1.tar.gz 26.5 kB Without provenance Details for verifiable_tool_invocation_flow-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for verifiable-tool-invocation-flow 0.1.1
File Interpreter ABI Platform Actions
verifiable_tool_invocation_flow-0.1.1-py3-none-any.whl Python 3 none any Details for verifiable_tool_invocation_flow-0.1.1-py3-none-any.whl

Total release size: 53.4 kB

Release files / verifiable_tool_invocation_flow-0.1.1.tar.gz

Download URL verifiable_tool_invocation_flow-0.1.1.tar.gz
Size 26.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a695c7b4d4d3addc78695326cc83a099c78d44f39ce748ba9d0ff42a79537386
BLAKE2b-256 checksum
How to use checksums
1ee17a36186d5b732b10bdf95e9d225d4813bc2fa6c0df0cec26758b37f7a361
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / verifiable_tool_invocation_flow-0.1.1-py3-none-any.whl

Download URL verifiable_tool_invocation_flow-0.1.1-py3-none-any.whl
Size 26.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
303fb19a2dd7eb97d13c2dc65e9c69fbe4e9e5767d242eeef765b91120ad0904
BLAKE2b-256 checksum
How to use checksums
4cd18f431e04a674fc650414c397807fce73ddfc3850c59c416b4898ab91cdee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Security for verifiable-tool-invocation-flow 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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