feat(tools): add Creduent zero-trust agent verification tool (Closes #6773) - #6780
feat(tools): add Creduent zero-trust agent verification tool (Closes #6773)#6780cyberfascinate wants to merge 9 commits into
Conversation
📝 WalkthroughWalkthroughAdds ChangesCreduent verification integration
Sequence Diagram(s)sequenceDiagram
participant Caller
participant CreduentVerificationTool
participant CreduentVerify
Caller->>CreduentVerificationTool: provide agent_uri
CreduentVerificationTool->>CreduentVerify: verify agent_uri
CreduentVerify-->>CreduentVerificationTool: verification result or error
CreduentVerificationTool-->>Caller: return success or failure
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (3)
lib/crewai-tools/tests/tools/test_creduent_verification_tool.py (2)
37-50: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winStrengthen the failure-message assertion to catch message corruption.
This test only checks
"Invalid signature" in str(exc_info.value). Because of the double-wrapping bug flagged increduent_verification_tool.py(Lines 58-75), the actual raised message becomes"Verification failure for {agent_uri}: Verification FAILED for {agent_uri}: Invalid signature"instead of the intended single-wrapped message, yet this test still passes. Assert the exact expected message (once the tool fix is applied) to catch this class of regression.✅ Proposed stronger assertion
- assert "Invalid signature" in str(exc_info.value) + assert str(exc_info.value) == ( + "Verification FAILED for agent://untrusted.dev/hacker: Invalid signature" + )🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/crewai-tools/tests/tools/test_creduent_verification_tool.py` around lines 37 - 50, Update test_failed_verification_strict to assert the complete exact ValueError message, including the agent URI and the intended single “Verification FAILED” wrapper around “Invalid signature,” rather than checking substring inclusion. Keep the strict-mode setup and exception capture unchanged so the test detects double-wrapped or otherwise corrupted messages.
1-51: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a test for the missing-package fallback path.
No test covers the
ImportErrorbranch in_run(Lines 49-55 ofcreduent_verification_tool.py) wherecreduentis not installed and the tool returns an install-hint message. Add a test that simulates the missing import (e.g., patchingbuiltins.__import__or usingsys.modulesmanipulation) to confirm the fallback message is returned instead of raising.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/crewai-tools/tests/tools/test_creduent_verification_tool.py` around lines 1 - 51, Add a test covering the ImportError fallback in CreduentVerificationTool._run by simulating an unavailable creduent package, then invoke the tool and assert it returns the expected installation-hint message without raising. Preserve the existing verification tests and use import mocking or sys.modules manipulation to trigger the missing-package branch.Source: Path instructions
lib/crewai-tools/src/crewai_tools/tools/creduent_verification_tool/creduent_verification_tool.py (1)
9-19: 🚀 Performance & Scalability | 🔵 TrivialConsider validating the
agent://<namespace>/<name>format at the schema level.
agent_uriaccepts any string with no pattern constraint, even though the tool's contract is specificallyagent://<namespace>/<name>per the description and README. Adding apatternto theFieldwould reject malformed URIs before the lazy import and network-free crypto check, giving faster and clearer feedback to the calling agent.♻️ Optional pattern validation
agent_uri: str = Field( ..., description="Target agent URI to verify, formatted as agent://<namespace>/<name>", + pattern=r"^agent://[^/]+/[^/]+$", )🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/crewai-tools/src/crewai_tools/tools/creduent_verification_tool/creduent_verification_tool.py` around lines 9 - 19, Add schema-level pattern validation to the agent_uri field in CreduentVerificationSchema so only values matching the documented agent://<namespace>/<name> format are accepted. Keep the existing field description and ensure malformed URIs are rejected before tool execution.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@lib/crewai-tools/src/crewai_tools/tools/creduent_verification_tool/creduent_verification_tool.py`:
- Around line 58-75: Separate the verify(agent_uri) call from the invalid-result
handling in the surrounding method so exceptions raised by verify are handled by
the generic error path, while the deliberate strict-mode ValueError for
result.valid == False bypasses it. Preserve the existing warning and exact
“Verification FAILED…” message for invalid results, and keep unexpected
exception logging and chaining unchanged.
- Around line 22-55: Wire the optional creduent dependency through
CreduentVerificationTool by declaring its package dependency, adding a
corresponding pyproject extra, and referencing that extra in the tool
documentation. Update test_creduent_verification_tool.py to provide a test-only
importable boundary or patch a local abstraction instead of requiring the
upstream creduent package to exist.
---
Nitpick comments:
In
`@lib/crewai-tools/src/crewai_tools/tools/creduent_verification_tool/creduent_verification_tool.py`:
- Around line 9-19: Add schema-level pattern validation to the agent_uri field
in CreduentVerificationSchema so only values matching the documented
agent://<namespace>/<name> format are accepted. Keep the existing field
description and ensure malformed URIs are rejected before tool execution.
In `@lib/crewai-tools/tests/tools/test_creduent_verification_tool.py`:
- Around line 37-50: Update test_failed_verification_strict to assert the
complete exact ValueError message, including the agent URI and the intended
single “Verification FAILED” wrapper around “Invalid signature,” rather than
checking substring inclusion. Keep the strict-mode setup and exception capture
unchanged so the test detects double-wrapped or otherwise corrupted messages.
- Around line 1-51: Add a test covering the ImportError fallback in
CreduentVerificationTool._run by simulating an unavailable creduent package,
then invoke the tool and assert it returns the expected installation-hint
message without raising. Preserve the existing verification tests and use import
mocking or sys.modules manipulation to trigger the missing-package branch.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b36547a4-835b-419b-a4d7-ed1c9b6e0598
📒 Files selected for processing (5)
lib/crewai-tools/src/crewai_tools/tools/__init__.pylib/crewai-tools/src/crewai_tools/tools/creduent_verification_tool/README.mdlib/crewai-tools/src/crewai_tools/tools/creduent_verification_tool/__init__.pylib/crewai-tools/src/crewai_tools/tools/creduent_verification_tool/creduent_verification_tool.pylib/crewai-tools/tests/tools/test_creduent_verification_tool.py
|
Great work on this @cyberfascinate — zero-trust agent identity verification is a real gap in multi-agent orchestration, and integrating it natively into crewai-tools is the right move. A few observations from our work on CCS (Common Component Standard for Agent Runtime Verification) that might be worth considering: Identity is necessary but not sufficientCreduent covers the Identity dimension well — Ed25519 signatures + JCS canonical attestation in <5ms is solid. But identity alone does not guarantee safe delegation. A verified agent can still:
This is exactly why we designed CCS as a 6-dimensional runtime verification framework: Structure, Schema, Latency, Cost, Identity, Integrity. Identity is one of six pillars, not the whole story. Practical suggestionThe Creduent tool here could serve as the Identity layer within a broader verification pipeline. For example, before delegating a task:
Our reference implementation On standardizationWe've submitted an IETF Internet-Draft for CCS to keep it vendor-neutral and open. Creduent's agent URI scheme ( Happy to collaborate on a conformance test suite or a joint reference implementation if the crewAI maintainers are interested. Either way, glad to see identity verification getting attention in the ecosystem. |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
lib/crewai-tools/src/crewai_tools/tools/creduent_verification_tool/creduent_verification_tool.py (1)
50-56: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick winFail closed when
creduentis unavailable in strict mode.A missing verifier means the target identity cannot be verified. This branch returns a normal string even when
strict=True. A caller that relies on strict-mode exceptions can continue delegation without verification.Raise
ValueErrorfrom this branch whenself.strictis enabled.Proposed fix
- except ImportError: - return ( + except ImportError as err: + error_msg = ( "Error: creduent package is not installed. " "Install it using: pip install creduent" ) + if self.strict: + raise ValueError(error_msg) from err + return error_msg🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/crewai-tools/src/crewai_tools/tools/creduent_verification_tool/creduent_verification_tool.py` around lines 50 - 56, Update the ImportError branch in the verification method to raise ValueError with the existing missing-package message when self.strict is enabled, while preserving the current string return behavior when strict mode is disabled.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In
`@lib/crewai-tools/src/crewai_tools/tools/creduent_verification_tool/creduent_verification_tool.py`:
- Around line 50-56: Update the ImportError branch in the verification method to
raise ValueError with the existing missing-package message when self.strict is
enabled, while preserving the current string return behavior when strict mode is
disabled.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e383588b-b51b-4ef8-83f5-ae4c6a60c014
📒 Files selected for processing (3)
lib/crewai-tools/pyproject.tomllib/crewai-tools/src/crewai_tools/tools/creduent_verification_tool/creduent_verification_tool.pylib/crewai-tools/tests/tools/test_creduent_verification_tool.py
There was a problem hiding this comment.
🧹 Nitpick comments (1)
lib/crewai-tools/tests/tools/test_creduent_verification_tool.py (1)
71-73: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse the public
runentry point in these tests.Both tests call
CreduentVerificationTool._rundirectly and bypassBaseTool.run. The missing-package test should calltool.run(...)instead.Also applies to: 82-83
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/crewai-tools/tests/tools/test_creduent_verification_tool.py` around lines 71 - 73, Update both Creduent verification tests to invoke the public tool.run entry point instead of calling tool._run directly, including the missing-package case around CreduentVerificationTool. Preserve the existing arguments and assertions while ensuring execution goes through BaseTool.run.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@lib/crewai-tools/tests/tools/test_creduent_verification_tool.py`:
- Around line 71-73: Update both Creduent verification tests to invoke the
public tool.run entry point instead of calling tool._run directly, including the
missing-package case around CreduentVerificationTool. Preserve the existing
arguments and assertions while ensuring execution goes through BaseTool.run.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 484ffed8-14f5-4d2c-a244-8592e1c89fdf
📒 Files selected for processing (2)
lib/crewai-tools/src/crewai_tools/tools/creduent_verification_tool/creduent_verification_tool.pylib/crewai-tools/tests/tools/test_creduent_verification_tool.py
🚧 Files skipped from review as they are similar to previous changes (1)
- lib/crewai-tools/src/crewai_tools/tools/creduent_verification_tool/creduent_verification_tool.py
|
Thanks @Correctover for the thoughtful feedback and for highlighting the CCS framework. That distinction is key: identity verification provides the cryptographic root of trust for an agent's origin and keys, while runtime governance validates execution bounds like schema contracts, rate limits, and output structure. The mapping between Creduent's agent:// URI attestation schema and CCS's identity dimension makes a lot of sense. Having identity sit cleanly as the cryptographic layer within a multi-dimensional verification pipeline is the right architecture for zero-trust agent delegation. Would be happy to explore a joint reference implementation or conformance integration once this PR lands. |
Summary
Adds
CreduentVerificationTooltocrewai-toolsto enable local zero-trust verification of external agent identities and attestations before task delegation.Proposed Changes
CreduentVerificationToolunderlib/crewai-tools/src/crewai_tools/tools/creduent_verification_tool/crewai_tools.toolsexportslib/crewai-tools/tests/tools/test_creduent_verification_tool.pyProtocol Verification
Performs local Ed25519 signature verification and canonical JCS RFC 8785 attestation validation on agent URIs (
agent://<namespace>/<name>) in under 5ms.Closes #6773