Skip to main content

agentity-sdk-python

Python SDK for the Agentity Protocol. Create agent identities, sign HTTP requests, verify tokens, integrate with LangChain and CrewAI.

Installation

pip install agentity-sdk-python

Usage

Create an agent identity

from agentity_sdk import AgentKeyPair

kp = AgentKeyPair()
aid = kp.create_identity(
    owner_did="did:agentity:human:alice",
    scopes=["stripe:payments:read", "calendar:events:write"],
    ttl_days=30,
)
print(f"DID: {aid.did}")
print(f"Signature valid: {aid.verify_signature()}")

Sign HTTP requests

from agentity_sdk import RequestSigner

signer = RequestSigner(kp, aid)
headers = signer.sign_request("GET", "/api/v1/payments")
# {
#   "Agentity-Token": "<base64(AID)>.<base64(sig)>",
#   "Agentity-Nonce": "<uuid-v4>",
#   "Agentity-Timestamp": "<ISO-8601>",
# }

Verify on the server side

from agentity_sdk import RequestVerifier

verifier = RequestVerifier()
used_nonces = set()
aid = verifier.verify_request(
    headers, "GET", "/api/v1/payments",
    used_nonces=used_nonces,
)

Rotate keys

new_aid = kp.rotate(aid, ttl_days=90)
print(f"Version: {new_aid.version}")       # 2
print(f"Previous AID: {new_aid.previousAid}")

LangChain integration

from agentity_sdk.integrations.langchain import AgentityLangChainMixin

class MyAgent(AgentityLangChainMixin):
    def run(self):
        headers = self._agentity_sign_headers("POST", "https://api.example.com/data")
        print(f"Agent DID: {self.agentity_did()}")

Provider manifest

from agentity_sdk import ProviderManifest, ScopeEntry, ScopeRisk

manifest = ProviderManifest(
    provider="did:agentity:provider:stripe",
    name="Stripe",
    description="Payment processing API",
    scopes=[
        ScopeEntry(id="payments:read", description="Read payments", risk=ScopeRisk.LOW),
        ScopeEntry(id="payments:write", description="Create payments", risk=ScopeRisk.HIGH),
    ],
)

Public API

Export Description
AgentKeyPair Ed25519 keypair + create_identity() + rotate()
AgentIdentity Pydantic model — DID, scopes, proof, status
AgentDid DID string builder
RequestSigner Sign HTTP requests with Agentity headers
RequestVerifier Verify tokens server-side
ProviderManifest Publish service scope definitions
AgentityLangChainMixin Mixin for LangChain agents

Tests

pip install -e .[dev]
pytest tests/

License: Apache 2.0

Metadata

Release files for agentity-sdk-python 0.1.2

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

Source distribution (sdist)

Source distribution for agentity-sdk-python 0.1.2
File Size Uploaded Provenance
agentity_sdk_python-0.1.2.tar.gz 8.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for agentity-sdk-python 0.1.2
File Interpreter ABI Platform
agentity_sdk_python-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 16.6 kB

Release files / agentity_sdk_python-0.1.2.tar.gz

Download URL agentity_sdk_python-0.1.2.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d6b90a464e73da22ab9233d4ffe69daeb07d5e89d6b13d41ae4e95eb50b20709
BLAKE2b-256 checksum
How to use checksums
532ca54b91ab5cab721c24e756ed3edbc98b5b2f68effbd30960357d2f67c9ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / agentity_sdk_python-0.1.2-py3-none-any.whl

Download URL agentity_sdk_python-0.1.2-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e3803120572c116efb1a48a46ce7afffcbbae2939b3326973b0bf12c5289dc89
BLAKE2b-256 checksum
How to use checksums
0a6138ac6657ac1d9fe8f7729e831ebf423f10c1f61d0e64b5bbf71a13a9a934
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Security for agentity-sdk-python 0.1.2

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.

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