Getting Started
Quick Start

Quick Start Guide

Get up and running with AZTP Client v1.0.42 in minutes. This guide will walk you through creating your first secure connection and implementing basic security features.

Prerequisites

  • Python 3.8+ or Node.js 14+
  • AZTP API Key (organization-specific)
  • AZTP Base URL (your AZTP service endpoint)

Step 1: Installation

Python

pip install aztp-client

TypeScript/JavaScript

npm install aztp-client

Step 2: Environment Setup

Create a .env file or set environment variables:

# Required
export AZTP_API_KEY=your-organization-api-key
export AZTP_BASE_URL=https://your-aztp-server.com
 
# Optional: Policy configuration
export AZTP_POLICY_ENABLED=true
export USERNAME=your-username

Step 3: Your First Secure Connection

Python Example

import asyncio
from aztp_client import Aztp
 
async def first_connection():
    """Create your first secure AZTP connection."""
 
    # Check available trusted domains
    from aztp_client import whiteListTrustDomains
    print("🌐 Available Trusted Domains:")
    for domain_key, domain_value in whiteListTrustDomains.items():
        print(f"   • {domain_key}: {domain_value}")
 
    # Initialize client with your API key
    api_key = os.getenv("AZTP_API_KEY")
    if not api_key:
        print("❌ ERROR: Please set AZTP_API_KEY environment variable")
        return
 
    print(f"🔑 API Key loaded: {api_key[:10]}...")
    client = Aztp(api_key=api_key)
    print("✅ AZTP client initialized successfully")
 
    # Create secure connection for a component
    agent = await client.secure_connect(
        crew_agent={},  # Agent configuration
        name="my-first-service",  # Unique service name
        config={"isGlobalIdentity": False}  # Component-specific identity
    )
 
    print(f"✅ Secure connection established!")
    print(f"   Identity: {agent.identity.aztp_id}")
 
    # Get detailed identity information
    identity_info = await client.get_identity(agent)
    identity_data = json.loads(identity_info)
 
    print(f"📋 Identity Details:")
    print(f"   Internal ID: {identity_data['data']['_id']}")
    print(f"   AZTP ID: {identity_data['data']['aztpId']}")
    print(f"   Status: {identity_data['data']['status']}")
    print(f"   Environment: {identity_data['data']['environment']}")
    print(f"   Trust Domain: {identity_data['data']['workloadInfo']['trustDomain']}")
 
    # Verify the identity
    is_valid = await client.verify_identity(agent)
    print(f"🔍 Identity verification: {'PASSED' if is_valid else 'FAILED'}")
 
    # Also verify by AZTP ID
    is_valid_by_id = await client.verify_identity_by_aztp_id(identity_data['data']['aztpId'])
    print(f"🔍 Verification by ID: {'PASSED' if is_valid_by_id else 'FAILED'}")
 
    return agent
 
# Run the example
if __name__ == "__main__":
    asyncio.run(first_connection())

TypeScript Example

import { AztpClient } from "aztp-client";
 
async function firstConnection() {
  // Initialize client
  const client = new AztpClient("your-org-api-key");
 
  // Create secure connection
  const agent = await client.secureConnect(
    {}, // Agent configuration
    "my-first-service", // Unique service name
    { isGlobalIdentity: false } // Component-specific identity
  );
 
  console.log("✅ Secure connection established!");
  console.log(`   Identity: ${agent.identity.aztpId}`);
  console.log(`   Status: ${agent.identity.status}`);
  console.log(`   Valid: ${agent.identity.valid}`);
 
  // Verify the identity
  const isValid = await client.verifyIdentity(agent);
  console.log(`🔍 Identity verification: ${isValid ? "PASSED" : "FAILED"}`);
 
  return agent;
}
 
// Run the example
firstConnection().catch(console.error);

Step 4: Check Permissions

async def check_permissions():
    """Check what permissions your identity has."""
 
    client = Aztp(api_key="your-org-api-key")
    agent = await client.secure_connect({}, "permission-test-service")
 
    # Check component permissions
    permissions = await client.check_identity_policy_permissions(
        agent.identity.aztp_id,
        options={"actions": ["read", "write", "api_call", "admin_access"]}
    )
 
    print(f"🔐 Permission Check Results:")
    for action, allowed in permissions.items():
        status = "✅ ALLOWED" if allowed else "❌ DENIED"
        print(f"   {action}: {status}")
 
    return permissions

Step 5: Create Identity Flow

async def create_flow():
    """Create an identity flow for grouping components."""
 
    client = Aztp(api_key="your-org-api-key")
 
    # Create identity flow
    flow = await client.create_flow(
        name="my-ai-workflow",
        description="Secure AI workflow with multiple components",
        discoverable="public",
        tags=["ai", "secure", "quickstart"],
        metadata={
            "project": "quickstart-demo",
            "environment": "development"
        }
    )
 
    print(f"🔗 Identity Flow Created:")
    print(f"   Flow ID: {flow['_id']}")
    print(f"   Name: {flow['name']}")
 
    return flow

Complete Quick Start Example

import asyncio
import json
import os
from aztp_client import Aztp, whiteListTrustDomains
from dotenv import load_dotenv
 
load_dotenv()
 
async def complete_quickstart():
    """Complete quick start demonstration based on real test execution."""
 
    print("🚀 AZTP Client Quick Start v1.0.42")
    print("=" * 40)
 
    # Load API key from environment
    api_key = os.getenv("AZTP_API_KEY")
    if not api_key:
        print("❌ ERROR: AZTP_API_KEY environment variable not set")
        return {"success": False, "error": "Missing API key"}
 
    client = Aztp(api_key=api_key)
 
    try:
        # 1. Create secure connection
        print("\n🔐 Creating secure connection...")
        agent = await client.secure_connect(
            {},
            "quickstart-demo-service",
            config={"isGlobalIdentity": False}
        )
 
        # Get detailed identity information (like in test execution)
        identity_info = await client.get_identity(agent)
        identity_data = json.loads(identity_info)
        aztp_id = identity_data["data"]["aztpId"]
 
    print(f"   ✅ Identity: {aztp_id}")
    print(f"   Status: {identity_data['data']['status']}")
    print(f"   Environment: {identity_data['data']['environment']}")
    print(f"   Trust Domain: {identity_data['data']['workloadInfo']['trustDomain']}")
 
    # Example output:
    # ✅ Identity: aztp://astha.ai/workload/production/node/my-first-service
    # Status: active
    # Environment: production
    # Trust Domain: astha.ai
 
        # 2. Verify identity (multiple methods)
        print("\n🔍 Verifying identity...")
        is_valid = await client.verify_identity(agent)
        is_valid_by_id = await client.verify_identity_by_aztp_id(aztp_id)
        print(f"   Agent verification: {'✅ PASSED' if is_valid else '❌ FAILED'}")
        print(f"   ID verification: {'✅ PASSED' if is_valid_by_id else '❌ FAILED'}")
 
        # 3. Check permissions (real working example)
        print("\n🛡️ Checking permissions...")
        permissions = await client.check_identity_policy_permissions(aztp_id)
 
        print(f"   📋 Available permissions:")
        for action, allowed in permissions.items():
            status = "✅ ALLOWED" if allowed else "❌ DENIED"
            print(f"      {action}: {status}")
 
        # 4. Test OIAP policy evaluation
        print("\n👤 Testing OIAP policy...")
        try:
            result = await client.oiap_evaluate(
                aztp_id=aztp_id,
                requested_resource="list_users",
                user_id="user-demo-12345"  # Demo user ID
            )
            print(f"   ✅ OIAP Result: {result['result']}")
            print(f"   📝 Reason: {result.get('reason', 'Policy evaluation')}")
        except Exception as e:
            print(f"   ⚠️ OIAP test: {e}")
 
        # 5. Create identity flow (real working example)
        print("\n📋 Creating identity flow...")
        flow = await client.create_flow(
            name="quickstart-demo-flow",
            description="Quick start demonstration flow",
            discoverable="public",
            tags=["quickstart", "demo", "tutorial"],
            metadata={
                "project": "quickstart-demo",
                "environment": "development",
                "created_by": "quickstart_guide",
                "version": "1.0"
            }
        )
 
        # Add identity to flow
        await client.add_identity_to_flow(flow['_id'], aztp_id)
        print(f"   ✅ Flow created: {flow['_id']}")
        print(f"   📝 Name: {flow['name']}")
        print(f"   🏷️ Tags: {flow['tags']}")
 
        # 6. Verify identity in flow context
        print("\n🔍 Verifying identity in flow context...")
        is_valid_in_flow = await client.verify_identity_by_aztp_id(
            aztp_id,
            identity_flow_id=flow['_id']
        )
        print(f"   {'✅ VERIFIED' if is_valid_in_flow else '❌ NOT VERIFIED'}")
 
        print("\n🎉 Quick start completed successfully!")
        print(f"\n📊 Summary:")
        print(f"   🔑 Secure Identity: {aztp_id}")
        print(f"   📋 Flow ID: {flow['_id']}")
        print(f"   🛡️ Permissions: {len(permissions)} actions available")
        print(f"   ✅ All verifications: PASSED")
 
        return {
            "agent": agent,
            "flow": flow,
            "permissions": permissions,
            "aztp_id": aztp_id,
            "identity_data": identity_data,
            "success": True
        }
 
    except Exception as e:
        print(f"\n❌ Quick start failed: {e}")
        return {"success": False, "error": str(e)}
 
# Run complete quick start
if __name__ == "__main__":
    result = asyncio.run(complete_quickstart())
 
    if result.get("success"):
        print("\n🎯 Next Steps:")
        print("   • Explore Identity Management: /docs/02-identity/overview")
        print("   • Learn Policy Management: /docs/03-policy/overview")
        print("   • See Real-World Examples: /docs/04-examples/examples")
        print("   • Read API Reference: /docs/05-api-reference/api-reference")
        print("   • Try Langflow Integration: /docs/04-examples/langflow-integration")
    else:
        print("\n🔧 Need Help?")
        print("   • Check Installation Guide: /docs/01-getting-started/installation")
        print("   • Review Trusted Domains: /docs/01-getting-started/trusted-domains")
        print("   • Contact Support: https://astha.ai")

What's Next?

Learn the Fundamentals

  1. Identity Management - Deep dive into AZTP identities
  2. Policy Management - Access control and permissions
  3. Trusted Domains - Understanding trust boundaries

See Real Implementations

  1. Langflow Integration - Production AI platform security
  2. SAFE-MCP Protocol - Advanced MCP security
  3. Enterprise Examples - Comprehensive implementations

Advanced Topics

  1. API Reference - Complete documentation
  2. Monitoring & Observability - Production monitoring
  3. Enterprise Support (opens in a new tab) - Professional assistance

Troubleshooting

Common Quick Start Issues

API Key Problems

# Verify API key is set
echo $AZTP_API_KEY
 
# Test API connectivity
curl -H "Authorization: Bearer $AZTP_API_KEY" $AZTP_BASE_URL/health

Network Connectivity

# Test base URL accessibility
curl -I https://your-aztp-server.com
 
# Check DNS resolution
nslookup your-aztp-server.com

Module Import Issues

# Python: Verify installation
pip show aztp-client
 
# Test import
python -c "from aztp_client import Aztp; print('✅ Import successful')"
# TypeScript: Verify installation
npm list aztp-client
 
# Test import
node -e "const { AztpClient } = require('aztp-client'); console.log('✅ Import successful');"

Getting Help

Ready to build secure AI systems? Continue with Identity Management!