{
  "name": "Stackit.ai Treasury Agent",
  "description": "Rules-based BTC & ETH treasury management. Deposit, borrow, convert, monitor, and auto-protect — all via API with built-in safety rails (60% recommended LTV ceiling, auto-repay, flash loan re-leverage, no margin calls).",
  "url": "https://api.stackit.ai",
  "version": "1.0.0",
  "protocol": "a2a",
  "provider": {
    "organization": "Stackit.ai",
    "url": "https://stackit.ai",
    "contact": "support@stackit.ai"
  },
  "authentication": {
    "schemes": [
      {
        "type": "http",
        "scheme": "bearer",
        "description": "API key issued via self-serve registration at POST /api/v1/agent/register. Format: sk_live_* (production) or sk_test_* (sandbox). No human approval required."
      }
    ]
  },
  "registration": {
    "method": "POST",
    "url": "https://stackit.ai/api/v1/agent/register",
    "description": "Self-serve agent registration. Returns API key + Privy wallet. No auth required.",
    "inputSchema": {
      "type": "object",
      "required": ["agent_name", "operator_email", "public_key", "public_key_type", "use_case"],
      "properties": {
        "agent_name": { "type": "string", "description": "Name for your agent (e.g. 'treasury-optimizer-v1')." },
        "operator_email": { "type": "string", "description": "Email for receipts and alerts." },
        "public_key": { "type": "string", "description": "ECDSA public key for Privy wallet creation." },
        "public_key_type": { "type": "string", "enum": ["ed25519", "secp256k1"] },
        "use_case": { "type": "string", "enum": ["treasury-autopilot", "expense-management", "risk-monitoring", "multi-treasury", "custom"] }
      }
    },
    "page": "https://stackit.ai/agent/register"
  },
  "capabilities": {
    "input": ["application/json"],
    "output": ["application/json"]
  },
  "sandbox": {
    "description": "Strategy simulator with live market data. No authentication required.",
    "endpoints": {
      "simulate": {
        "method": "POST",
        "url": "https://stackit.ai/api/simulate",
        "description": "Run a treasury simulation. Returns projected value, DCA comparison, debt, health factor, and all rates used."
      },
      "simulateSpec": {
        "method": "GET",
        "url": "https://stackit.ai/api/simulate",
        "description": "Machine-readable API spec with parameters, response schema, and usage instructions."
      },
      "marketData": {
        "method": "GET",
        "url": "https://stackit.ai/api/market-data",
        "description": "Live BTC/ETH returns, Aave borrow rate, spot prices. Updated hourly."
      },
      "strategyLog": {
        "method": "POST",
        "url": "https://stackit.ai/api/strategy-log",
        "description": "Log a strategy run for analysis."
      }
    }
  },
  "skills": [
    {
      "id": "simulate_strategy",
      "name": "Simulate Strategy",
      "description": "Run a treasury growth simulation with live market data. No auth required. Test leverage levels, deposit amounts, and timeframes.",
      "endpoint": "https://stackit.ai/api/simulate",
      "method": "POST",
      "authentication": "none",
      "inputSchema": {
        "type": "object",
        "required": ["monthlyDeposit"],
        "properties": {
          "monthlyDeposit": { "type": "number", "minimum": 100, "maximum": 50000, "description": "USD amount deposited each month." },
          "ltvPercent": { "type": "number", "minimum": 0, "maximum": 85, "default": 0, "description": "Loan-to-value for flash-loan leverage. 0 = no leverage. 40 = conservative. 60 = moderate. 75+ = aggressive." },
          "monthlySpend": { "type": "number", "minimum": 0, "default": 0, "description": "USD to borrow/spend per month (borrow-to-spend mode)." },
          "years": { "type": "number", "enum": [1, 2, 3, 5], "default": 3, "description": "Simulation horizon in years." },
          "source": { "type": "string", "description": "Agent identifier for tracking." }
        }
      }
    },
    {
      "id": "deposit",
      "name": "Create Deposit",
      "description": "Deposit USDC into the treasury. Converts to BTC/ETH per configured allocation. 2% fee.",
      "endpoint": "/api/v1/deposits",
      "method": "POST",
      "inputSchema": {
        "type": "object",
        "required": ["amount"],
        "properties": {
          "amount": { "type": "number", "description": "USDC amount to deposit. Minimum 100." },
          "allocation": { "type": "object", "description": "BTC/ETH split percentages." }
        }
      }
    },
    {
      "id": "borrow",
      "name": "Create Borrow",
      "description": "Borrow USDC against BTC/ETH holdings within safe LTV limits. 2% fee + Aave interest.",
      "endpoint": "/api/v1/borrow",
      "method": "POST",
      "inputSchema": {
        "type": "object",
        "required": ["amount"],
        "properties": {
          "amount": { "type": "number", "description": "USDC amount to borrow." },
          "purpose": { "type": "string", "description": "Optional label (e.g., 'payroll')." }
        }
      }
    },
    {
      "id": "convert",
      "name": "Convert USDC",
      "description": "Convert USDC to BTC or ETH for DCA or rebalancing. 2% fee + DEX spread.",
      "endpoint": "/api/v1/convert",
      "method": "POST",
      "inputSchema": {
        "type": "object",
        "required": ["amount", "target"],
        "properties": {
          "amount": { "type": "number", "description": "USDC amount to convert." },
          "target": { "type": "string", "enum": ["btc", "eth"], "description": "Target asset." }
        }
      }
    },
    {
      "id": "repay",
      "name": "Manual Repay",
      "description": "Repay outstanding borrow to reduce LTV. No fee.",
      "endpoint": "/api/v1/repay",
      "method": "POST",
      "inputSchema": {
        "type": "object",
        "required": ["amount"],
        "properties": {
          "amount": { "type": "number", "description": "USDC amount to repay." }
        }
      }
    },
    {
      "id": "treasury_status",
      "name": "Get Treasury Status",
      "description": "Full treasury overview: holdings, LTV, health score, utilization. No fee.",
      "endpoint": "/api/v1/treasury",
      "method": "GET"
    },
    {
      "id": "health_check",
      "name": "Get Health Score",
      "description": "Current health score, LTV breakdown, and auto-repay status. No fee.",
      "endpoint": "/api/v1/health",
      "method": "GET"
    },
    {
      "id": "estimate_fees",
      "name": "Estimate Fees",
      "description": "Preview fees and net amounts for any treasury action before executing. No fee.",
      "endpoint": "/api/v1/estimate",
      "method": "POST",
      "inputSchema": {
        "type": "object",
        "required": ["action", "amount"],
        "properties": {
          "action": { "type": "string", "enum": ["deposit", "borrow", "convert", "repay"] },
          "amount": { "type": "number", "description": "USDC amount." },
          "target": { "type": "string", "enum": ["btc", "eth"], "description": "Target asset (for convert)." }
        }
      }
    }
  ]
}
