Skip to main content

Creduent Python SDK

PyPI version License Python Compatibility

The official Python SDK for the Creduent Protocol, a federated, open trust-verification layer and cryptographic identity infrastructure for autonomous AI agents.

What is Creduent?

Creduent is an open application-layer protocol for cryptographic identity and trust verification of autonomous AI agents, originally created by Kashish Kanojia and stewarded by IDevSec. The official Python SDK is developed and maintained by IDevSec.

Creduent enables autonomous agents to cryptographically sign metadata, verify identities across administrative domains via DNS bindings, and interact with the Creduent registry for secure, machine-to-machine trust checks.


Key Features

  • Cryptographic Identity Management: Generate secure Ed25519 keypairs for AI agents (multi-key support enabled).
  • RFC 8785 Canonical Signatures: Compute cryptographic signatures over JSON agent documents using JCS and Ed25519.
  • Path Traversal & Relative Sequence Mitigation: Reject relative path traversal sequences (../, ..\) in target resolution routines.
  • Administrative Owner Metadata Validation: Hardened owner field validation in identity schema strictly enforcing mailto: or https:// schemes.
  • Client-Side DNSSEC RRSIG Validation: DNS-over-HTTPS (DoH) RRSIG verification helper verify_dnssec() attaching dnssec_verified boolean to VerifyResult.
  • Dynamic Cache-Control Max-Age Tuning: Parses HTTP Cache-Control: max-age=N headers when fetching agent documents to dynamically adjust LRU cache TTLs.
  • Provenance & Reversibility Guard: Fail-closed ProvenanceGuard ensuring un-bound tool self-assertions resolve to IRREVERSIBLE (OWASP AISVS v1.0 C9.2.3 canonicalization).
  • Ledger Chain Verification: Independent LedgerChainVerifier querying /ledger/chain/{chain_id} to prevent self-referential payload truncation during reduction.
  • Discovery API: Directly fetch and parse an agent's agent.json from their well-known endpoint without needing the registry.
  • Framework Integrations: Native middleware/tools for CrewAI, LangGraph, AutoGen, LangChain, LlamaIndex, Microsoft Semantic Kernel, and Google ADK.
  • Identity-Based Rate Limiting (IBRL / CREDUENT-008): Enforce request throttling per cryptographically verified agent_id using IBRLMiddleware (FastAPI / Starlette) with Redis sliding window logs and in-memory LRU fallback.
  • Unified CLI creduent: Out-of-the-box CLI commands for CRD scaffolding, signing, and capability discovery.

Protocol Standards


Installation

pip install creduent

To install with specific framework integration support:

pip install "creduent[crewai]"
pip install "creduent[langgraph]"
pip install "creduent[autogen]"
pip install "creduent[langchain]"
pip install "creduent[llamaindex]"
pip install "creduent[all]"

Agent Framework Integrations

Creduent provides native verification adapters for major AI agent frameworks, ensuring you can verify another agent's identity before interacting with it.

CrewAI

from creduent.integrations.crewai import CreduentVerificationTool
from crewai import Agent, Task, Crew

verify_tool = CreduentVerificationTool()

security_agent = Agent(
    role='Security Verifier',
    goal='Verify the identity of external agents before interacting',
    backstory='You are a strict security officer enforcing the Creduent protocol.',
    tools=[verify_tool]
)

LangGraph

from creduent.integrations.langgraph import create_verification_node
from langgraph.graph import StateGraph

def my_agent_node(state):
    # your logic
    pass

workflow = StateGraph(MyState)
# Insert verification middleware before interaction
workflow.add_node("verify_agent", create_verification_node("agent://example/target_agent"))
workflow.add_node("interact", my_agent_node)
workflow.add_edge("verify_agent", "interact")

AutoGen

from creduent.integrations.autogen import CreduentAgentMiddleware
import autogen

# Wrap your assistant to automatically verify incoming/outgoing agent messages
secure_assistant = CreduentAgentMiddleware(
    autogen.AssistantAgent(name="assistant", llm_config=llm_config)
)

Command Line Interface (CLI v2)

The new unified creduent CLI uses a YAML-first CRD (Custom Resource Definition) approach to manage your agent identities.

1. Scaffold agent.yaml

creduent init

Creates a draft agent.yaml in the current directory.

2. Generate Keys

creduent keygen

Generates Ed25519 keys inside .creduent/keys/ and prints your public key.

3. Build & Sign agent.json

creduent build

Reads agent.yaml and .creduent/keys/private.pem (or CREDUENT_PRIVATE_KEY env var) and compiles a fully canonicalized, signed agent.json ready for deployment.

4. Discover Agent Capabilities

# Public discovery
creduent discover agent://idevsec/steward

# Authenticated discovery (presents your agent identity)
creduent discover agent://idevsec/steward --as agent://my_org/my_agent

API Reference

discover(target_agent_id: str, my_agent_id: str = None, private_key_pem: str = None) -> DiscoveryResult

Resolves an agent's URL from the registry, fetches their agent.json, verifies its cryptographic signature and DNS bindings offline, and returns their capabilities. Can optionally perform authenticated discovery using your own key.

sign(draft: dict, private_key_pem: str) -> dict

Signs a draft agent document using JCS canonicalization (RFC 8785) + Ed25519. Returns signed document with the keys and signature fields.

verify(target: str | dict) -> VerifyResult

Verifies a self-signed agent.json. Accepts dict, HTTPS URL, domain, local path, or agent:// URI.

  • result.valid: bool
  • result.agent_id, result.keys, result.endpoint, result.capabilities
  • result.error: str or None

register(agent_id, domain, agent_json_url, registry_url?) -> RegisterResult

Registers an agent with the Creduent registry.

  • result.success: bool
  • result.attestation: dict (level, issued_at, expires_at, ...)

attest(agent_id, registry_url?) -> AttestResult

Fetches attestation status for an agent from the registry.

agent_to_did(agent_uri: str, scheme: str = "creduent") -> str

Converts an agent:// URI into a standard did:creduent or did:web identifier string.

did_to_agent(did_uri: str) -> str

Converts a did:creduent or did:web identifier back to an agent:// URI.

agent_to_did_document(agent_doc: dict, scheme: str = "creduent") -> dict

Generates a standard W3C DID Document (JSON-LD compliant) containing verificationMethod and authentication assertions from an agent identity document.

IBRLMiddleware(app, limiter=None)

Starlette / FastAPI middleware enforcing Identity-Based Rate Limiting per cryptographically verified agent_id or IP address.

from fastapi import FastAPI
from creduent import IBRLMiddleware

app = FastAPI()
app.add_middleware(IBRLMiddleware)

Contributing

Bugs, feature requests, and pull requests welcome via GitHub Issues.

Security & Hardening

The Creduent Python SDK enforces key safety and signature verification practices:

  • Strict Key Storage Permissions: Key generation commands (creduent keygen in the CLI and creduent-sign generate-keys in the signing tool) automatically restrict the saved private key file's permissions to 0o600 (read/write by owner only) on Unix-based systems.
  • Fail-Closed Verification: Any validation parsing error or timestamp format discrepancy defaults to marking the verification or attestation status as invalid, guarding against format injection attacks.

License

Licensed under the Apache License 2.0. See the LICENSE file for the full legal text.

Metadata

Release files for creduent 2.2.0

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

Source distribution (sdist)

Source distribution for creduent 2.2.0
File Size Uploaded Provenance Actions
creduent-2.2.0.tar.gz 53.3 kB Without provenance Details for creduent-2.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for creduent 2.2.0
File Interpreter ABI Platform Actions
creduent-2.2.0-py3-none-any.whl Python 3 none any Details for creduent-2.2.0-py3-none-any.whl

Total release size: 105.6 kB

Release files / creduent-2.2.0.tar.gz

Download URL creduent-2.2.0.tar.gz
Size 53.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1d15ba2033a95963336d63b9dbf13696096177cd60471d029f6168ff0f57efdb
BLAKE2b-256 checksum
How to use checksums
3fc500bf2134c0d5412ad2d820e7f68f13c8a97d8b99e7c9b93d8fcec2534970
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.14

Release files / creduent-2.2.0-py3-none-any.whl

Download URL creduent-2.2.0-py3-none-any.whl
Size 52.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af030ad264c16b96c6fff822ac6d3d23c31e43a16fd7c43dfbd99e61eb6719c0
BLAKE2b-256 checksum
How to use checksums
60202478d6598d1873bd04f9f764ed4138cda6d952503ce0a2bf4803c63b5701
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.14

Security for creduent 2.2.0

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

2.2.0 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