Skip to main content

AZTP (Agentic Zero Trust Protocol) Client Library for Python

Project description

AZTP Client Python

AZTP (Agentic Zero Trust Protocol) Client is an enterprise-grade identity service client that provides secure workload identity management using AZTP standards. The client library facilitates secure communication between workloads by managing digital identities and certificates.

Installation

pip install aztp-client

Requirements

  • Python 3.8 or higher

Quick Start

from aztp_client import Aztp

# Initialize client
client = Aztp(api_key="your-api-key")

# Create a secure agent
agent = await client.secure_connect(name="service1")

# Verify identity
is_valid = await client.verify_identity(agent)

# Verify identity using agent name (multiple methods)
is_valid = await client.verify_identity_using_agent_name(name)
is_valid = await client.verify_identity_using_agent_name(full_aztp_id)
is_valid = await client.verify_identity_using_agent_name(
    name=name,
    trust_domain="aztp.network",
    workload="workload",
    environment="production",
    method="node"
)

# Get identity details
identity = await client.get_identity(agent)

Example

import asyncio
import os
from aztp_client import Aztp
from dotenv import load_dotenv

# Load environment variables
load_dotenv()

async def main():
    # Initialize the client with your API key
    client = Aztp(
        api_key=os.getenv("AZTP_API_KEY"),
    )
    name = os.getenv("AZTP_AGENT_NAME")

    try:
        crewAgent = {}
        
        # Create a secure agent
        print("\nCreating secure agent...")
        agent = await client.secure_connect(crewAgent, name="MyAgent") # you may edit the name to your liking
        print(f"Agent created successfully!")
        
        if agent.identity.aztp_id:
            print(f"Agent: {agent.identity.aztp_id}")

        
        # Verify the identity
        print("\nVerifying identity...")
        is_valid = await client.verify_identity(agent)
        print(f"Identity valid: {is_valid}")

        # Verify identity using agent name (multiple methods)
        print("\nVerifying identity using agent name...")
        
        # Using default parameters
        is_valid = await client.verify_identity_using_agent_name(name)
        print(f"Identity valid (defaults): {is_valid}")
        
        # Using full AZTP ID
        full_aztp_id = f"aztp://aztp.network/workload/production/node/{name}"
        is_valid = await client.verify_identity_using_agent_name(full_aztp_id)
        print(f"Identity valid (full ID): {is_valid}")
        
        # Using explicit parameters
        is_valid = await client.verify_identity_using_agent_name(
            name=name,
            trust_domain="aztp.network",
            workload="workload",
            environment="production",
            method="node"
        )
        print(f"Identity valid (explicit params): {is_valid}")
        
        # Get identity details
        print("\nGetting identity details...")
        identity = await client.get_identity(agent)
        if identity:
            print(f"Retrieved identity: {identity}")
        else:
            print("No identity found") 

    except ConnectionError as e:
        print(f"Connection Error: Could not connect to the AZTP server. Please check your connection and server URL.")
        print(f"Details: {e}")
    except Exception as e:
        print(f"Error: {str(e)}")
        print("\nCurrent configuration:")
        print(f"Base URL: {client.config.base_url}")
        print(f"Environment: {client.config.environment}")
        print("API Key: ********")  # Don't print the API key for security

if __name__ == "__main__":
    asyncio.run(main())

Features

  • Workload Identity Management using AZTP standards
  • Certificate Management (X.509)
  • Secure Communication
  • Identity Verification
  • Metadata Management
  • Environment-specific Configuration

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aztp_client-1.0.8.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aztp_client-1.0.8-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file aztp_client-1.0.8.tar.gz.

File metadata

  • Download URL: aztp_client-1.0.8.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for aztp_client-1.0.8.tar.gz
Algorithm Hash digest
SHA256 743a38f63e6a953526f12ab39c6f3e36cf91b93eaf031546a95474542c784529
MD5 97eb9fc1343e63493b8a0b0e3eb5a6ee
BLAKE2b-256 f1b3f4eddfdbb5f760e3b79635c73cfc41fcc36d8355ff5deb33bc3d982ad9f6

See more details on using hashes here.

File details

Details for the file aztp_client-1.0.8-py3-none-any.whl.

File metadata

  • Download URL: aztp_client-1.0.8-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for aztp_client-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 673a4e51660365e8af8f5907c4e88cb73073e35ce42f5eb74d041d7617a6ab17
MD5 e75f1bbff3490914a622f109ae6646e1
BLAKE2b-256 14ca3ce229b39adba44ce66313dcd85e7a3a31c608c1f49db6762fbf2f47d9e0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page