Skip to main content

A Python SDK for the CirtusAI backend: agent, wallet, and credential management.

Project description

CirtusAI Python SDK - Complete Developer Guide (Updated July 2025)

๐Ÿš€ The Most Comprehensive SDK for Autonomous AI Agent Management with Blockchain-Level Security

The CirtusAI Python SDK provides everything developers need to build powerful, secure, and compliant AI agent applications. From basic wallet management to advanced smart contract automation, from governance participation to real-world asset tokenization - this SDK unlocks the complete power of the CirtusAI platform.

๐ŸŽฏ What Makes CirtusAI Unique

  • ๐Ÿ” Enterprise-Grade 2FA Security: Mandatory TOTP authentication with time-sync tolerance
  • ๐Ÿค– Smart Contract Agent Wallets: On-chain spending limits, whitelists, and automated rule enforcement
  • ๐ŸŒ Multi-Chain Support: Ethereum, Polygon, Arbitrum, and more
  • ๐Ÿ“ง Email Integration: IMAP/SMTP and OAuth for seamless communication
  • ๐Ÿ›๏ธ DAO Governance: Participate in on-chain voting and proposal management
  • ๐Ÿ’ฑ DeFi Integration: Swaps, yield farming, cross-chain bridges, and gas abstraction
  • ๐Ÿ  Real-World Assets (RWA): Tokenize and manage physical assets on-chain
  • ๐Ÿ“Š Compliance Built-In: KYC/AML, audit trails, and regulatory reporting
  • โšก Production Ready: Sync/async support, comprehensive error handling, and extensive testing

๐Ÿ“ฆ Installation

# Install the latest stable SDK
pip install cirtusai-sdk

# Install the beta/pre-release version
pip install --pre cirtusai-sdk

๐Ÿš€ Quick Start Guide

1. Authentication with 2FA (Required)

Every CirtusAI application starts with secure authentication:

from cirtusai import CirtusAIClient
from cirtusai.auth import TwoFactorAuthenticationError

# Initialize the client
client = CirtusAIClient(base_url="http://localhost:8000")

# Register a new user (automatic 2FA setup)
setup_info = client.auth.register(
    username="mycompany_agent", 
    email="admin@mycompany.com",
    password="SuperSecure123!",
    preferred_2fa_method="totp"
)

# Save the QR code for your authenticator app
print(f"๐Ÿ“ฑ Scan QR: data:image/png;base64,{setup_info.qr_code_image}")
print(f"๐Ÿ”‘ Secret: {setup_info.secret}")
print(f"๐Ÿ” Backup codes: {setup_info.backup_codes}")

# Login with 2FA (one-step method)
try:
    token = client.auth.login_with_2fa(
        "mycompany_agent",
        "SuperSecure123!",
        "123456"  # Current TOTP code from authenticator
    )
    client.set_token(token.access_token)
    print("โœ… Authenticated successfully!")
except TwoFactorAuthenticationError as e:
    print(f"โŒ 2FA failed: {e}")

2. Create Your First Wallet

# Create a new HD wallet
wallet = client.wallets.create_wallet(chain="ethereum")
print(f"๐Ÿ’ฐ New wallet: {wallet['wallet_address']}")

# Import an existing wallet
imported = client.wallets.import_wallet(
    chain="ethereum",
    private_key="0x1234567890abcdef..."  # Your private key
)
print(f"๐Ÿ“ฅ Imported wallet: {imported['wallet_address']}")

# List all your wallets
wallets = client.wallets.list_wallets()
for w in wallets:
    print(f"  {w['name']}: {w['wallet_address']} ({w['chain']})")

3. Deploy Your First Agent Wallet

Agent wallets are smart contracts with programmable rules:

# Deploy a smart contract agent wallet
agent_wallet = client.wallets.deploy_agent_wallet()
print(f"๐Ÿค– Agent wallet deployed: {agent_wallet['wallet_address']}")

# Set spending limits (daily ETH limit)
tx_hash = client.wallets.set_spending_limit(
    address=agent_wallet['wallet_address'],
    token="0x0",  # ETH
    amount=1000000000000000000,  # 1 ETH in wei
    period=86400  # 24 hours
)
print(f"โšก Spending limit set: {tx_hash}")

# Add trusted addresses to whitelist
whitelist_tx = client.wallets.update_whitelist(
    address=agent_wallet['wallet_address'],
    target="0x742d35Cc6634C0532925a3b8D0715a99C7DCF",
    allowed=True
)
print(f"โœ… Address whitelisted: {whitelist_tx}")

4. Manage Child Agents

# List master agents
agents = client.agents.list_agents()
print(f"Master agents: {agents}")

# Create a child agent under a master agent
child = client.agents.create_child_agent("my_master_id", "assistant_bot")
print(f"Created child agent: {child['id']}")

# List all child agents
children = client.agents.get_children()
print(f"Child agents: {children}")

๐Ÿ—๏ธ Complete Feature Guide

1. ๐Ÿ” Advanced Authentication & Security

1.1 Complete 2FA Management

# Check current 2FA status
status = client.auth.get_2fa_status()
print(f"2FA enabled: {status.is_2fa_enabled}")

# Setup 2FA for existing users
setup = client.auth.setup_2fa()
print(f"New secret: {setup.secret}")

# Get QR code as image bytes
qr_bytes = client.auth.get_qr_code()
with open("qr_code.png", "wb") as f:
    f.write(qr_bytes)

# Debug time synchronization issues
debug_info = client.auth.debug_2fa()
print("Valid codes right now:")
for step, code in debug_info["valid_codes"].items():
    print(f"  {step}: {code}")

# Disable 2FA (requires password + TOTP)
result = client.auth.disable_2fa(
    totp_code="123456",
    password="SuperSecure123!"
)
print(f"2FA disabled: {result['enabled']}")

1.2 Session Management

# Get current user information  
user_info = client.auth.get_user_info()
print(f"User: {user_info['username']} ({user_info['email']})")

# Refresh expired tokens
new_token = client.auth.refresh(refresh_token="your_refresh_token")
client.set_token(new_token.access_token)

# Logout and clear session
client.auth.logout()

2. ๐Ÿ’ฐ Comprehensive Wallet Management

2.1 Multi-Chain Wallet Operations

# Create wallets on different chains
eth_wallet = client.wallets.create_wallet(chain="ethereum")
poly_wallet = client.wallets.create_wallet(chain="polygon") 
arb_wallet = client.wallets.create_wallet(chain="arbitrum")

# Get wallet balances
balance = client.wallets.get_balance(
    chain="ethereum",
    address=eth_wallet['wallet_address']
)
print(f"ETH Balance: {balance}")

# Get consolidated asset view across all chains
assets = client.assets.get_multi_chain_asset_view()
print(f"Total portfolio value: ${assets['total_value_usd']}")
for chain, data in assets['chains'].items():
    print(f"  {chain}: {data['native_balance']} native + {len(data['tokens'])} tokens")

2.2 ERC-20 Token Management

# Get token balance
usdc_balance = client.wallets.get_token_balance(
    wallet_id=eth_wallet['id'],
    token_address="0xA0b86a33E6D1cc22c435370bA9e4240EE8D5fE5"  # USDC
)
print(f"USDC: {usdc_balance['balance']} {usdc_balance['symbol']}")

# Transfer tokens
transfer_tx = client.wallets.transfer_tokens(
    wallet_id=eth_wallet['id'],
    token_address="0xA0b86a33E6D1cc22c435370bA9e4240EE8D5fE5",
    to_address="0x742d35Cc6634C0532925a3b8D0715a99C7DCF",
    amount=100.0
)
print(f"Transfer completed: {transfer_tx['tx_hash']}")

# Approve token spending
approve_tx = client.wallets.approve_tokens(
    wallet_id=eth_wallet['id'], 
    token_address="0xA0b86a33E6D1cc22c435370bA9e4240EE8D5fE5",
    spender_address="0x1234567890abcdef...",
    amount=500.0
)
print(f"Approval set: {approve_tx['tx_hash']}")

3. ๐Ÿค– Agent Wallet Smart Contracts

3.1 Agent Wallet Deployment & Management

# Deploy multiple agent wallets for different purposes
marketing_agent = client.wallets.deploy_agent_wallet()
finance_agent = client.wallets.deploy_agent_wallet()
ops_agent = client.wallets.deploy_agent_wallet()

# List all agent wallets
agent_wallets = client.wallets.list_agent_wallets()
for wallet in agent_wallets:
    print(f"Agent: {wallet['wallet_address']} (deployed: {wallet['created_at']})")

# Get detailed wallet information
wallet_details = client.wallets.get_agent_wallet(
    address=marketing_agent['wallet_address']
)
print(f"Wallet details: {wallet_details}")

3.2 On-Chain Rule Management

# Set daily spending limits for different tokens
agent_addr = marketing_agent['wallet_address']

# ETH spending limit: 0.5 ETH per day
eth_limit = client.wallets.set_spending_limit(
    address=agent_addr,
    token="0x0",  # ETH
    amount=500000000000000000,  # 0.5 ETH in wei
    period=86400  # 24 hours
)

# USDC spending limit: $1000 per day  
usdc_limit = client.wallets.set_spending_limit(
    address=agent_addr,
    token="0xA0b86a33E6D1cc22c435370bA9e4240EE8D5fE5",  # USDC
    amount=1000000000,  # $1000 (6 decimals)
    period=86400
)

# Build a whitelist of approved addresses
approved_vendors = [
    "0x742d35Cc6634C0532925a3b8D0715a99C7DCF",  # OpenAI API payments
    "0x8b3a92Ef6F66F79A7B7C4D8f9E2A1B5C3D7E9F",   # AWS payments  
    "0x1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a"    # Partner agent
]

for vendor in approved_vendors:
    whitelist_tx = client.wallets.update_whitelist(
        address=agent_addr,
        target=vendor,
        allowed=True
    )
    print(f"โœ… Whitelisted {vendor}: {whitelist_tx}")

# Set transaction threshold requiring manual approval
threshold_tx = client.wallets.set_threshold(
    address=agent_addr,
    new_threshold=500  # Require approval for transactions > $500
)
print(f"๐Ÿ”’ Threshold set: {threshold_tx}")

3.3 Audit Trail & Event Monitoring

# Get complete transaction history for an agent wallet
transactions = client.wallets.list_wallet_transactions(
    address=agent_addr
)

print(f"๐Ÿ“Š Found {len(transactions)} events:")
for tx in transactions:
    print(f"  {tx['timestamp']}: {tx['event_name']}")
    print(f"    TX: {tx['tx_hash']}")
    print(f"    Details: {tx['details']}")
    print(f"    Block: {tx['block_number']}")
    print()

# Monitor for specific event types
spending_events = [tx for tx in transactions if tx['event_name'] == 'SpendingLimitSet']
whitelist_events = [tx for tx in transactions if tx['event_name'] == 'WhitelistUpdated']

print(f"๐Ÿ” Spending limit changes: {len(spending_events)}")
print(f"๐Ÿ” Whitelist updates: {len(whitelist_events)}")

4. ๐Ÿ‘ฅ Master/Child Agent Management

4.1 Agent Hierarchy Creation

# Create a master agent for your organization
master_agent = client.agents.create_agent(
    name="Marketing Master Agent",
    description="Handles all marketing automation",
    agent_type="master",
    capabilities=["content_creation", "social_media", "email_marketing"]
)
print(f"๐Ÿ‘‘ Master agent created: {master_agent['id']}")

# Create specialized child agents
social_media_agent = client.agents.create_agent(
    name="Social Media Specialist",
    description="Automated social media posting and engagement",
    agent_type="child",
    parent_id=master_agent['id'],
    capabilities=["social_media", "content_scheduling"]
)

email_agent = client.agents.create_agent(
    name="Email Campaign Manager", 
    description="Automated email marketing campaigns",
    agent_type="child",
    parent_id=master_agent['id'],
    capabilities=["email_marketing", "newsletter_automation"]
)

print(f"๐Ÿ‘ถ Child agents created:")
print(f"  Social Media: {social_media_agent['id']}")
print(f"  Email: {email_agent['id']}")

4.2 Agent Rule Inheritance

# Child agents inherit rules from their master
inherited_rules = client.agents.get_inherited_rules(
    child_id=social_media_agent['id']
)

print(f"๐Ÿ“‹ Inherited rules from master:")
print(f"  Spending limits: {inherited_rules['spending_limits']}")
print(f"  Whitelists: {inherited_rules['whitelists']}")
print(f"  Policies: {inherited_rules['policies']}")

4.3 Task Delegation

# Delegate specific tasks to child agents
social_campaign = client.agents.delegate_task(
    master_id=master_agent['id'],
    child_agent_id=social_media_agent['id'],
    task_type="social_media_campaign",
    budget_allocation={
        "token": "0x0",  # ETH
        "amount": "50000000000000000"  # 0.05 ETH
    },
    deadline="2025-07-24T12:00:00Z",
    parameters={
        "platform": "twitter",
        "campaign_theme": "product_launch",
        "post_frequency": "3_per_day"
    }
)
print(f"๐Ÿ“‹ Task delegated: {social_campaign['id']}")

# Monitor delegation status
delegations = client.agents.list_delegations(master_agent['id'])
for delegation in delegations:
    print(f"Task: {delegation['task_type']} โ†’ {delegation['status']}")

5. ๐Ÿ“ง Email Integration & Communication

5.1 Email Account Linking

# Link IMAP/SMTP email account
email_account = client.wallets.create_email_account(
    provider="imap",
    email_address="marketing@mycompany.com",
    config={
        "host": "imap.gmail.com",
        "port": 993,
        "username": "marketing@mycompany.com", 
        "password": "app_password_here",  # Use app password for Gmail
        "use_ssl": True,
        "smtp_host": "smtp.gmail.com",
        "smtp_port": 587
    }
)
print(f"๐Ÿ“ง Email account linked: {email_account['id']}")

# OAuth integration for Google/Outlook (redirect-based)
google_oauth_url = client.wallets.get_google_oauth_url()
print(f"๐Ÿ”— Google OAuth: {google_oauth_url}")

# List all linked email accounts
email_accounts = client.wallets.list_email_accounts()
for account in email_accounts:
    print(f"  ๐Ÿ“ฌ {account['email_address']} ({account['provider']})")

5.2 Email Management & Access

# Test email connection
test_result = client.wallets.test_email_connection(email_account['id'])
print(f"โœ… Connection test: {test_result['status']}")

# Access inbox (with proper permissions)
inbox = client.wallets.get_inbox(
    account_id=email_account['id'],
    limit=10,
    unread_only=True
)
print(f"๐Ÿ“จ Unread emails: {inbox['unread_count']}")
for msg in inbox['messages']:
    print(f"  From: {msg['from']}")
    print(f"  Subject: {msg['subject']}")
    print(f"  Date: {msg['date']}")

6. ๐ŸŒ‰ Cross-Chain Bridge & DeFi

6.1 Cross-Chain Transfers

# Get bridge quote for cross-chain transfer
quote = client.bridge.get_quote(
    from_chain="ethereum", 
    to_chain="polygon",
    from_token="0xA0b86a33E6D1cc22c435370bA9e4240EE8D5fE5",  # USDC
    to_token="0x2791bca1f2de4661ed88a30c99a7a9449aa84174",   # USDC on Polygon
    amount=1000000000  # $1000 USDC
)
print(f"๐Ÿ’ฑ Bridge quote:")
print(f"  Fee: ${quote['fee_usd']}")
print(f"  Time: {quote['estimated_time']}")
print(f"  You'll receive: {quote['to_amount']} USDC on Polygon")

# Execute the bridge transfer
if quote['fee_usd'] < 10:  # Acceptable fee
    bridge_tx = client.bridge.bridge_transfer(
        provider=quote['provider'],
        from_chain="ethereum",
        to_chain="polygon", 
        from_token="0xA0b86a33E6D1cc22c435370bA9e4240EE8D5fE5",
        to_token="0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
        amount=1000000000,
        recipient_address=poly_wallet['wallet_address']
    )
    print(f"๐ŸŒ‰ Bridge transfer initiated: {bridge_tx['tx_hash']}")

6.2 DeFi Integration

# Swap tokens using integrated DEX
swap_tx = client.wallets.swap_tokens(
    wallet_id=eth_wallet['id'],
    from_token="0x0",  # ETH
    to_token="0xA0b86a33E6D1cc22c435370bA9e4240EE8D5fE5",  # USDC
    amount=1.0,  # 1 ETH
    slippage_tolerance=0.5  # 0.5%
)
print(f"๐Ÿ”„ Swap completed: {swap_tx['tx_hash']}")

# Deposit into yield farming vault
yield_deposit = client.wallets.deposit_yield_vault(
    wallet_id=eth_wallet['id'],
    vault_address="0x1234567890abcdef...",  # Aave USDC vault
    token_address="0xA0b86a33E6D1cc22c435370bA9e4240EE8D5fE5",
    amount=500.0
)
print(f"๐ŸŒพ Yield farming deposit: {yield_deposit['tx_hash']}")

# Check yield farming positions
positions = client.wallets.get_yield_positions(eth_wallet['id'])
for position in positions:
    print(f"Vault: {position['vault_name']}")
    print(f"  Deposited: {position['deposited_amount']}")
    print(f"  Current value: {position['current_value']}")
    print(f"  APY: {position['apy']}%")

6.3 On-Chain Swap Services

# Get swap quote for token pair
swap_quote = client.swap.get_quote(
    from_token="0x0",  # ETH
    to_token="0xA0b86a33E6D1cc22c435370bA9e4240EE8D5fE5",  # USDC
    amount=1.0
)
print(f"๐Ÿ” Swap quote: {swap_quote}")

# Execute the swap
swap_tx = client.swap.execute_swap(
    from_token="0x0",
    to_token="0xA0b86a33E6D1cc22c435370bA9e4240EE8D5fE5",
    amount=1.0,
    slippage_tolerance=0.5
)
print(f"๐Ÿ”„ Swap executed: {swap_tx['tx_hash']}")

# Cancel a pending swap quote
cancel = client.swap.cancel_swap(quote_id=swap_quote['quote_id'])
print(f"โŒ Swap quote cancelled: {cancel['status']}")

6.4 Marketplace Operations

# List marketplace listings
listings = client.marketplace.list_listings(limit=20)
for l in listings:
    print(f"Listing: {l['id']} - {l['asset_name']} at {l['price']}")

# Create a new listing
new_listing = client.marketplace.create_listing(
    asset_id="asset123",
    price="0.5 ETH",
    quantity=1
)
print(f"โœ… Created listing: {new_listing['id']}")

# Place a bid on a listing
bid = client.marketplace.place_bid(
    listing_id=new_listing['id'],
    bid_amount="0.45 ETH"
)
print(f"๐ŸŽฏ Bid placed: {bid['bid_id']}")

# Cancel a listing
client.marketplace.cancel_listing(listing_id=new_listing['id'])
print("โŒ Listing cancelled")

7. ๐Ÿ›๏ธ Governance & DAO Participation

7.1 Proposal Management

# Create a governance proposal
proposal = client.governance.create_proposal(
    targets=["0x1234567890abcdef..."],  # Contract to call
    values=[0],  # ETH to send (0 for parameter change)
    calldatas=["0xabcdef..."],  # Encoded function call
    description="Increase agent spending limits to $2000/day"
)
print(f"๐Ÿ“œ Proposal created: {proposal['proposal_id']}")

# Get proposal details
proposal_info = client.governance.get_proposal_state(proposal['proposal_id'])
print(f"Proposal status: {proposal_info['status']}")
print(f"Votes for: {proposal_info['votes_for']}")
print(f"Votes against: {proposal_info['votes_against']}")
print(f"Voting deadline: {proposal_info['voting_deadline']}")

7.2 Voting

# Cast vote on proposal (1 = for, 0 = against)
vote = client.governance.cast_vote(
    proposal_id=proposal['proposal_id'],
    support=1  # Vote in favor
)
print(f"๐Ÿ—ณ๏ธ Vote cast: {vote['tx_hash']}")

# Check your voting history
voting_history = client.governance.get_user_votes()
for vote_record in voting_history:
    print(f"Proposal {vote_record['proposal_id']}: {'FOR' if vote_record['support'] else 'AGAINST'}")

8. ๐Ÿ  Real-World Assets (RWA)

8.1 Asset Tokenization

# Register a real-world asset token
rwa_asset = client.wallets.register_rwa_asset(
    token_address="0x9876543210fedcba...",  # RWA token contract
    token_id="1",  # Specific asset ID
    metadata_uri="https://metadata.example.com/asset/1"
)
print(f"๐Ÿ  RWA asset registered: {rwa_asset['id']}")

# List your RWA holdings
rwa_holdings = client.wallets.list_rwa_assets()
for asset in rwa_holdings:
    print(f"Asset: {asset['name']}")
    print(f"  Type: {asset['asset_type']}")
    print(f"  Value: ${asset['estimated_value']}")
    print(f"  Yield: {asset['annual_yield']}%")

8.2 Asset Management

# Transfer RWA tokens
rwa_transfer = client.wallets.transfer_rwa(
    wallet_id=eth_wallet['id'],
    token_address="0x9876543210fedcba...",
    token_id="1",
    to_address="0x742d35Cc6634C0532925a3b8D0715a99C7DCF",
    amount=1
)
print(f"๐Ÿ”„ RWA transfer: {rwa_transfer['tx_hash']}")

9. ๐ŸŽฏ Child Asset Provisioning

9.1 Email Asset Provisioning

# Provision email access to child agents
email_provision = client.agents.provision_email_asset(
    child_id=email_agent['id'],
    email_account_id=email_account['id'],
    permissions=["read", "send"],
    quota={
        "daily_emails": 100,
        "monthly_emails": 2000
    }
)
print(f"๐Ÿ“ง Email access provisioned: {email_provision['email_address']}")

# Check email quota usage
email_usage = client.agents.get_email_usage(email_agent['id'])
print(f"Email usage: {email_usage['used_today']}/{email_usage['daily_limit']}")

9.2 Wallet Asset Provisioning

# Provision dedicated wallets for child agents
child_eth_wallet = client.agents.provision_wallet_asset(
    child_id=social_media_agent['id'],
    chain="ethereum"
)
print(f"๐Ÿ’ฐ Child wallet created: {child_eth_wallet['wallet_address']}")

child_poly_wallet = client.agents.provision_wallet_asset(
    child_id=social_media_agent['id'],
    chain="polygon"
)
print(f"๐Ÿ’ฐ Child Polygon wallet: {child_poly_wallet['wallet_address']}")

# Transfer budget to child wallets
budget_transfer = client.agents.transfer_assets_to_child(
    child_id=social_media_agent['id'],
    from_wallet=eth_wallet['wallet_address'],
    to_wallet=child_eth_wallet['wallet_address'],
    asset_type="eth",
    amount="100000000000000000",  # 0.1 ETH
    note="Monthly social media budget"
)
print(f"๐Ÿ’ธ Budget transferred: {budget_transfer['transfer_id']}")

10. ๐Ÿ’ณ Fiat On/Off Ramps

10.1 Fiat Onboarding

# Create fiat on-ramp session
onramp_session = client.wallets.create_onramp_session(
    currency="USD",
    amount=1000.0  # $1000
)
print(f"๐Ÿ’ณ On-ramp session: {onramp_session['session_id']}")
print(f"๐Ÿ”— Widget URL: {onramp_session['widget_url']}")

# Check on-ramp status
onramp_status = client.wallets.get_onramp_status(
    session_id=onramp_session['session_id']
)
print(f"Status: {onramp_status['status']}")
if onramp_status['status'] == 'completed':
    print(f"โœ… Received: {onramp_status['crypto_amount']} {onramp_status['crypto_currency']}")

11. โ›ฝ Gas Management & Abstraction

11.1 Gas Sponsorship

# Deposit tokens for gas sponsorship
gas_deposit = client.wallets.sponsor_gas(
    token_address="0xA0b86a33E6D1cc22c435370bA9e4240EE8D5fE5",  # USDC
    amount=100.0  # $100 worth of gas
)
print(f"โ›ฝ Gas sponsorship: {gas_deposit}")

# Check gas balance
gas_balance = client.wallets.get_gas_sponsorship_balance()
print(f"โ›ฝ Gas balance: {gas_balance} USDC")

# Send gasless transaction using ERC-4337
user_op = client.wallets.send_user_operation(
    user_op={
        "sender": agent_addr,
        "nonce": "0x0",
        "initCode": "0x",
        "callData": "0x...",  # Your transaction data
        "callGasLimit": "0x5208",
        "verificationGasLimit": "0x5208", 
        "preVerificationGas": "0x5208",
        "maxFeePerGas": "0x3b9aca00",
        "maxPriorityFeePerGas": "0x3b9aca00",
        "paymasterAndData": "0x",
        "signature": "0x"
    },
    entry_point_address="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
)
print(f"๐Ÿš€ Gasless transaction: {user_op['user_op_hash']}")

12. ๐Ÿ“Š Monitoring & Compliance

12.1 Transaction Monitoring

# Start monitoring an address
monitoring = client.monitoring.watch_address(
    address="0x742d35Cc6634C0532925a3b8D0715a99C7DCF",
    alert_conditions=["large_transaction", "new_contract_interaction"]
)
print(f"๐Ÿ‘๏ธ Monitoring started: {monitoring['watch_id']}")

# Get transaction status
tx_status = client.monitoring.get_transaction_status(
    tx_hash="0xabcdef1234567890..."
)
print(f"Transaction status: {tx_status['status']}")
print(f"Confirmations: {tx_status['confirmations']}")

# List all active watches
watches = client.monitoring.list_watches()
for w in watches:
    print(f"๐Ÿ‘๏ธ Watch: {w['watch_id']} - {w['address']}")

# Retrieve recent alerts
alerts = client.monitoring.get_alerts()
for alert in alerts:
    print(f"โš ๏ธ Alert: {alert['alert_id']} - {alert['type']} at {alert['timestamp']}")

12.2 Compliance & Reporting

# Check KYC status
kyc_status = client.compliance.get_kyc_status()
print(f"KYC Status: {kyc_status['status']}")

# Initiate KYC if needed
if kyc_status['status'] == 'not_verified':
    kyc_session = client.compliance.initiate_kyc()
    print(f"๐Ÿ†” KYC session: {kyc_session['verification_url']}")

# Generate compliance report
compliance_report = client.compliance.generate_report(
    start_date="2025-07-01",
    end_date="2025-07-17",
    report_type="full_audit"
)
print(f"๐Ÿ“‹ Compliance report:")
print(f"  Total transactions: {compliance_report['total_transactions']}")
print(f"  Total value: ${compliance_report['total_value_usd']}")
print(f"  Flagged activities: {compliance_report['flagged_count']}")
print(f"  Compliance score: {compliance_report['compliance_score']}/100")

# Get detailed audit trail for an entity
audit_trail = client.compliance.get_audit_trail(
    entity_id="entity123",
    entity_type="transaction"
)
print("๐Ÿ“ Audit trail entries:")
for entry in audit_trail:
    print(f"  {entry['timestamp']}: {entry['action']} by {entry['performed_by']}")

13. ๐Ÿ”ฅ Advanced Features

13.1 NFT Management

# List NFTs in wallet
nfts = client.wallets.list_nfts(wallet_id=eth_wallet['id'])
for nft in nfts:
    print(f"๐Ÿ–ผ๏ธ {nft['name']} #{nft['token_id']}")
    print(f"  Collection: {nft['collection_name']}")
    print(f"  Value: ${nft['estimated_value']}")

# Transfer NFT
nft_transfer = client.wallets.transfer_nft(
    wallet_id=eth_wallet['id'],
    contract_address="0x1234567890abcdef...",
    token_id="123", 
    to_address="0x742d35Cc6634C0532925a3b8D0715a99C7DCF"
)
print(f"๐Ÿ–ผ๏ธ NFT transferred: {nft_transfer['tx_hash']}")

# Get metadata for a specific NFT
metadata = client.nfts.get_nft_metadata(
    contract_address="0x1234567890abcdef...",
    token_id="123"
)
print(f"NFT Metadata: {metadata}")

# Mint a new NFT
minted = client.nfts.mint_nft(
    contract_address="0xNFTContract...",
    to_address="0x742d35Cc6634C0532925a3b8D0715a99C7DCF",
    metadata_uri="https://metadata.example.com/nft/1"
)
print(f"๐ŸŽจ NFT minted: {minted['token_id']}")

# Batch transfer multiple NFTs
batch = client.nfts.batch_transfer(
    contract_address="0x1234567890abcdef...",
    transfers=[
        {"token_id": "123", "to_address": "0xabc..."},
        {"token_id": "124", "to_address": "0xdef..."}
    ]
)
print("๐Ÿ”€ Batch transfer complete")

# Burn an NFT
burn = client.nfts.burn_nft(
    contract_address="0x1234567890abcdef...",
    token_id="123"
)
print(f"๐Ÿ”ฅ NFT burned: {burn['status']}")

13.2 Event Subscriptions

# Subscribe to wallet events
subscription = client.wallets.subscribe_to_events(
    wallet_address=eth_wallet['wallet_address'],
    event_types=["transfer", "approval", "swap"]
)
print(f"๐Ÿ“ก Event subscription: {subscription['subscription_id']}")

# Get recent events
events = client.wallets.get_wallet_events(
    wallet_address=eth_wallet['wallet_address'],
    limit=50
)
for event in events:
    print(f"โšก {event['event_type']}: {event['details']}")

๐Ÿ“š Complete API Reference

AuthClient

  • register(username, email, password, preferred_2fa_method="totp") โ†’ TwoFactorSetupResponse
  • login(username, password) โ†’ Token | TwoFactorRequiredResponse
  • login_with_2fa(username, password, totp_code) โ†’ Token
  • verify_2fa(temporary_token, totp_code) โ†’ Token
  • get_2fa_status() โ†’ TwoFactorStatusResponse
  • setup_2fa() โ†’ TwoFactorSetupResponse
  • confirm_2fa(totp_code) โ†’ dict
  • disable_2fa(totp_code, password) โ†’ dict
  • get_qr_code() โ†’ bytes
  • debug_2fa() โ†’ dict
  • refresh(refresh_token) โ†’ Token
  • logout() โ†’ dict

WalletsClient

Basic Wallet Operations:

  • create_wallet(chain) โ†’ dict
  • import_wallet(chain, private_key) โ†’ dict
  • list_wallets() โ†’ List[dict]
  • delete_wallet(wallet_id) โ†’ None
  • get_balance(chain, address) โ†’ Decimal

Token Management:

  • get_token_balance(wallet_id, token_address) โ†’ dict
  • transfer_tokens(wallet_id, token_address, to_address, amount) โ†’ dict
  • approve_tokens(wallet_id, token_address, spender_address, amount) โ†’ dict

Agent Wallets:

  • deploy_agent_wallet() โ†’ dict
  • list_agent_wallets() โ†’ List[dict]
  • get_agent_wallet(address) โ†’ dict
  • set_spending_limit(address, token, amount, period) โ†’ str
  • update_whitelist(address, target, allowed) โ†’ str
  • set_threshold(address, new_threshold) โ†’ str
  • list_wallet_transactions(address) โ†’ List[dict]

DeFi Integration:

  • swap_tokens(wallet_id, from_token, to_token, amount, slippage_tolerance) โ†’ dict
  • deposit_yield_vault(wallet_id, vault_address, token_address, amount) โ†’ dict
  • withdraw_yield_vault(wallet_id, vault_address, amount) โ†’ dict
  • get_yield_positions(wallet_id) โ†’ List[dict]

Email Integration:

  • list_email_accounts() โ†’ List[dict]
  • create_email_account(provider, email_address, config) โ†’ dict
  • test_email_connection(account_id) โ†’ dict
  • get_inbox(account_id, limit=10, unread_only=False) โ†’ dict

Gas & Fees:

  • sponsor_gas(token_address, amount) โ†’ str
  • get_gas_sponsorship_balance() โ†’ Decimal
  • send_user_operation(user_op, entry_point_address) โ†’ dict

Events & Monitoring:

  • subscribe_to_events(wallet_address, event_types) โ†’ dict
  • get_wallet_events(wallet_address, limit=50) โ†’ List[dict]
  • unsubscribe_event(subscription_id) โ†’ None

RWA & NFTs:

  • register_rwa_asset(token_address, token_id, metadata_uri) โ†’ dict
  • list_rwa_assets() โ†’ List[dict]
  • transfer_rwa(wallet_id, token_address, token_id, to_address, amount) โ†’ dict
  • list_nfts(wallet_id) โ†’ List[dict]
  • transfer_nft(wallet_id, contract_address, token_id, to_address) โ†’ dict

Fiat Integration:

  • create_onramp_session(currency, amount) โ†’ dict
  • get_onramp_status(session_id) โ†’ dict

AgentsClient

  • list_agents() โ†’ List[dict]
  • create_agent(name, description, agent_type, parent_id=None, capabilities=[]) โ†’ dict
  • get_agent(agent_id) โ†’ dict
  • update_agent(agent_id, **kwargs) โ†’ dict
  • delete_agent(agent_id) โ†’ None
  • get_inherited_rules(child_id) โ†’ dict
  • delegate_task(master_id, child_agent_id, task_type, budget_allocation, deadline, parameters) โ†’ dict
  • list_delegations(agent_id) โ†’ List[dict]
  • provision_email_asset(child_id, email_account_id, permissions, quota) โ†’ dict
  • provision_wallet_asset(child_id, chain) โ†’ dict
  • transfer_assets_to_child(child_id, from_wallet, to_wallet, asset_type, amount, note) โ†’ dict
  • get_email_usage(child_id) โ†’ dict

BridgeClient

  • get_quote(from_chain, to_chain, from_token, to_token, amount) โ†’ dict
  • bridge_transfer(provider, from_chain, to_chain, from_token, to_token, amount, recipient_address) โ†’ dict

AssetsClient

  • get_multi_chain_asset_view() โ†’ dict

GovernanceClient

  • create_proposal(targets, values, calldatas, description) โ†’ dict
  • cast_vote(proposal_id, support) โ†’ dict
  • get_proposal_state(proposal_id) โ†’ dict
  • get_user_votes() โ†’ List[dict]

ReputationClient

  • issue_sbt(to_address, metadata_uri) โ†’ dict
  • get_sbt_owner(token_id) โ†’ dict
  • get_user_reputation(user_id) โ†’ dict
  • stake_reputation(amount) โ†’ dict

MonitoringClient

  • watch_address(address, alert_conditions) โ†’ dict
  • get_transaction_status(tx_hash) โ†’ dict
  • list_watches() โ†’ List[dict]
  • get_alerts() โ†’ List[dict]

ComplianceClient

  • get_kyc_status() โ†’ dict
  • initiate_kyc() โ†’ dict
  • generate_report(start_date, end_date, report_type) โ†’ dict
  • get_audit_trail(entity_id, entity_type) โ†’ List[dict]

SwapClient

  • get_quote(from_token, to_token, amount) โ†’ dict
  • execute_swap(from_token, to_token, amount, slippage_tolerance) โ†’ dict
  • cancel_swap(quote_id) โ†’ dict

MarketplaceClient

  • list_listings(limit=None) โ†’ List[dict]
  • get_listing(listing_id) โ†’ dict
  • create_listing(asset_id, price, quantity) โ†’ dict
  • place_bid(listing_id, bid_amount) โ†’ dict
  • cancel_listing(listing_id) โ†’ None

Contributing

We welcome contributions! Please see our Contributing Guide for details on:

  • Setting up the development environment
  • Running tests and linting
  • Submitting pull requests
  • Code style guidelines

๐Ÿ“‹ Requirements

  • Python 3.8+
  • requests or httpx (for async support)
  • pydantic for data validation
  • Authenticator app (Google Authenticator, Authy, Microsoft Authenticator, etc.)

๐Ÿ“ˆ What's New in July 2025

๐Ÿ”ฅ Latest Features

  • โœ… Complete Two-Factor Authentication with TOTP and SMS support
  • โœ… Agent Smart Contract Wallets with programmable on-chain rules
  • โœ… Master/Child Agent Hierarchy with rule inheritance
  • โœ… Multi-Chain Asset Aggregation across 10+ blockchains
  • โœ… Advanced DeFi Integration with yield farming and swaps
  • โœ… Real-World Asset Tokenization for physical asset management
  • โœ… Gas Abstraction with ERC-4337 support
  • โœ… Enhanced Compliance with KYC/AML and audit trails
  • โœ… Email Integration via IMAP/SMTP and OAuth
  • โœ… Cross-Chain Bridging for seamless asset transfers

๐ŸŽฏ Coming Soon

  • ๐Ÿ”œ Advanced AI Agent Templates for common use cases
  • ๐Ÿ”œ Mobile SDK for iOS and Android
  • ๐Ÿ”œ WebSocket Support for real-time events
  • ๐Ÿ”œ Advanced Analytics with machine learning insights
  • ๐Ÿ”œ Layer 2 Optimizations for faster, cheaper transactions

๐ŸŽ‰ Ready to build the future of autonomous AI agents? Install the CirtusAI SDK today and unlock the complete power of programmable, compliant, and secure AI automation!

pip install cirtusai-sdk

Built with โค๏ธ by the CirtusAI team - Empowering the Autonomous

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

cirtusai_sdk-0.2.0b1.tar.gz (65.9 kB view details)

Uploaded Source

Built Distribution

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

cirtusai_sdk-0.2.0b1-py3-none-any.whl (35.3 kB view details)

Uploaded Python 3

File details

Details for the file cirtusai_sdk-0.2.0b1.tar.gz.

File metadata

  • Download URL: cirtusai_sdk-0.2.0b1.tar.gz
  • Upload date:
  • Size: 65.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cirtusai_sdk-0.2.0b1.tar.gz
Algorithm Hash digest
SHA256 fe466b3331a3e09f8772317b85d44871f00aa1abae0f9ffcd72de4027cbba3a9
MD5 9bd8fbdd0ff0c609ccc501536bcf8673
BLAKE2b-256 f1917591645301b4a576bbc70992c25125d42bc9113ce71278dc587a6834f9d8

See more details on using hashes here.

File details

Details for the file cirtusai_sdk-0.2.0b1-py3-none-any.whl.

File metadata

  • Download URL: cirtusai_sdk-0.2.0b1-py3-none-any.whl
  • Upload date:
  • Size: 35.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cirtusai_sdk-0.2.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 362d5f38956737ce7f696e663b2a69f2d29bdb7e01784c294a39da5234484606
MD5 10fbeecceb30720e15c0c7ee372f35f9
BLAKE2b-256 2e6d6fb8c942f9eed83406ed0e55b1084a654051fd591418b719b8ea52fa989f

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