{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/atako-ai/json-schema/atako-ai-agent-record-schema.json",
  "title": "AgentRecord",
  "description": "The raw `agents` table row, returned verbatim by POST /agents (201) and POST /agents/{id}/end (200, under `.session`). Every column, including several operational/internal fields not otherwise exposed.",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/atako-ai-api-openapi.json#/components/schemas/AgentRecord",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "clientId": {
      "type": "string",
      "format": "uuid"
    },
    "teamId": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "companyId": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "name": {
      "type": "string"
    },
    "image": {
      "type": "string"
    },
    "systemPrompt": {
      "type": [
        "string",
        "null"
      ],
      "description": "Raw user instructions (no business context appended)."
    },
    "mission": {
      "type": [
        "string",
        "null"
      ]
    },
    "profileUpdatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "modelId": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "directModelId": {
      "type": [
        "string",
        "null"
      ]
    },
    "modelConfig": {
      "type": [
        "object",
        "null"
      ],
      "description": "Per-task-type model overrides.",
      "properties": {
        "vision": {
          "type": [
            "string",
            "null"
          ]
        },
        "low_effort": {
          "type": [
            "string",
            "null"
          ]
        },
        "medium_effort": {
          "type": [
            "string",
            "null"
          ]
        },
        "high_effort": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "llmKeyId": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "Set for a BYOK agent (company LLM provider key); null for the platform key."
    },
    "harnessId": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "engine": {
      "type": "string",
      "enum": [
        "openclaw",
        "hermes",
        "opencode"
      ]
    },
    "status": {
      "$ref": "#/$defs/AgentStatus"
    },
    "agentAuthTokenHash": {
      "type": [
        "string",
        "null"
      ]
    },
    "agentAuthIssuedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "agentAuthLastUsedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "startDate": {
      "type": "string",
      "format": "date-time"
    },
    "activatedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "endDate": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "lastHeartbeatAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "lastReadAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "engineVersion": {
      "type": [
        "string",
        "null"
      ]
    },
    "engineImage": {
      "type": [
        "string",
        "null"
      ]
    },
    "engineRequestedVersion": {
      "type": [
        "string",
        "null"
      ]
    },
    "upgradingAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "upgradeRequestedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "upgradeStatus": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "requested",
        "running",
        "succeeded",
        "failed"
      ]
    },
    "upgradeError": {
      "type": [
        "string",
        "null"
      ]
    },
    "provisioningError": {
      "type": [
        "string",
        "null"
      ]
    },
    "pausedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "pausedReason": {
      "type": [
        "string",
        "null"
      ]
    },
    "clientContext": {
      "type": [
        "string",
        "null"
      ],
      "description": "Per-agent \"contexte business\" free text."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "id",
    "clientId",
    "name",
    "image",
    "engine",
    "status",
    "startDate",
    "createdAt"
  ],
  "$defs": {
    "AgentStatus": {
      "type": "string",
      "enum": [
        "active",
        "completed",
        "paused",
        "provisioning",
        "unresponsive",
        "failed"
      ]
    }
  }
}