{
  "openapi": "3.1.0",
  "info": {
    "title": "agents.tn Public API",
    "version": "1.0.0",
    "description": "Public API surface for agent discovery, registration, and health checks on agents.tn."
  },
  "servers": [
    {
      "url": "https://agents.tn"
    }
  ],
  "paths": {
    "/api/discover-agents": {
      "get": {
        "summary": "Discover registered agents",
        "description": "Search the public agents registry with natural language and receive ranked matches.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 3
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10,
              "default": 5
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful discovery response"
          }
        }
      }
    },
    "/api/register-agent": {
      "post": {
        "summary": "Register an agent",
        "description": "Submit an AI agent registration request with discovery metadata, A2A details, and guardrails.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "companyName",
                  "contactName",
                  "email",
                  "agentName",
                  "agentCategory",
                  "shortDescription",
                  "exactOutput",
                  "deploymentType",
                  "useCase",
                  "capabilities",
                  "guardrails",
                  "humanApproval",
                  "a2aEndpoint",
                  "agentCardUrl",
                  "promptTemplate",
                  "consent"
                ],
                "properties": {
                  "companyName": { "type": "string" },
                  "contactName": { "type": "string" },
                  "email": { "type": "string", "format": "email" },
                  "phone": { "type": "string" },
                  "agentName": { "type": "string" },
                  "agentCategory": { "type": "string" },
                  "shortDescription": { "type": "string" },
                  "exactOutput": { "type": "string" },
                  "deploymentType": { "type": "string" },
                  "tags": {
                    "oneOf": [
                      { "type": "string" },
                      {
                        "type": "array",
                        "items": { "type": "string" }
                      }
                    ]
                  },
                  "useCase": { "type": "string" },
                  "capabilities": { "type": "string" },
                  "guardrails": { "type": "string" },
                  "channels": { "type": "string" },
                  "a2aEndpoint": { "type": "string", "format": "uri" },
                  "agentCardUrl": { "type": "string", "format": "uri" },
                  "dataSources": { "type": "string" },
                  "humanApproval": { "type": "string" },
                  "promptTemplate": { "type": "string" },
                  "discoverable": { "type": "boolean" },
                  "visibility": { "type": "string" },
                  "consent": { "type": "boolean" }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Registration accepted"
          }
        }
      }
    },
    "/api/health": {
      "get": {
        "summary": "Health status",
        "responses": {
          "200": {
            "description": "Healthy"
          }
        }
      }
    }
  }
}
