{
  "openapi": "3.1.0",
  "info": {
    "title": "Attestify OS API",
    "version": "1.0.0",
    "description": "Memory-first persistent agent execution loops powered by Grok (xAI) with x402 micropayments. Ideal for long-running autonomous agents on agentic.market.",
    "contact": {
      "name": "Attestify OS",
      "url": "https://attestify-os.vercel.app"
    }
  },
  "servers": [
    {
      "url": "https://attestify-os.vercel.app",
      "description": "Production server"
    }
  ],
  "paths": {
    "/api/loop": {
      "post": {
        "summary": "Execute Agent Loop",
        "description": "Runs one full agent iteration with persistent memory, Grok reasoning, and optional tool calling. Requires x402 payment.",
        "x-402-price": "0.005",
        "x-402-currency": "USDC",
        "x-402-network": "eip155:8453",
        "x-402-payTo": "0x8A9F22f8e8C9B9699e5DDd0B999C0EbA3245b25F",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "session_id": { 
                    "type": "string",
                    "description": "Unique session identifier for memory persistence"
                  },
                  "input": { 
                    "type": "string",
                    "description": "The user's query or instruction"
                  },
                  "agent_id": { 
                    "type": "string",
                    "enum": ["researcher-v2", "coder-v1", "analyst-v1", "comedian-v1", "writer-v1", "support-v1", "strategist-v1"],
                    "description": "Optional: Specialized agent to use"
                  },
                  "proposed_actions": {
                    "type": "array",
                    "items": { "type": "string" },
                    "description": "Optional: Tools to trigger (e.g. search_web)"
                  }
                },
                "required": ["session_id", "input"]
              },
              "example": {
                "session_id": "conv-12345",
                "input": "What are the top AI agent platforms right now?",
                "agent_id": "researcher-v2",
                "proposed_actions": ["search_web"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful agent execution",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": { "type": "string" },
                    "paid": { "type": "boolean" },
                    "output": { "type": "string" },
                    "cost_estimate": { "type": "string" }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required (x402)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "payTo": { "type": "string" },
                    "amount": { "type": "string" }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
