{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/onclarity-com/json-schema/onclarity-com-agent-response-schema.json",
  "title": "AgentResponse",
  "description": "Managed agent as returned by the API.",
  "x-generated": "2026-10-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/onclarity-com-openapi.json#/components/schemas/AgentResponse",
  "properties": {
    "id": {
      "type": "integer",
      "title": "Id",
      "description": "Agent id."
    },
    "project_id": {
      "type": "integer",
      "title": "Project Id",
      "description": "Owning project id."
    },
    "name": {
      "type": "string",
      "title": "Name",
      "description": "Agent name."
    },
    "provider": {
      "$ref": "#/$defs/Provider-Output",
      "description": "Managed-agents provider."
    },
    "model": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Model",
      "description": "Model from config, surfaced for the UI."
    },
    "model_override": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Model Override",
      "description": "The agent's own model over its template's, if it chose one."
    },
    "effort": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Effort",
      "description": "Reasoning effort from config; null = provider default."
    },
    "effort_override": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Effort Override",
      "description": "The agent's own effort over its template's, if it chose one."
    },
    "system_prompt": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "System Prompt",
      "description": "System prompt."
    },
    "skills": {
      "items": {
        "$ref": "#/$defs/SkillRef"
      },
      "type": "array",
      "title": "Skills",
      "description": "Skills attached to the agent."
    },
    "type": {
      "$ref": "#/$defs/AgentType",
      "description": "Product the agent belongs to."
    },
    "active": {
      "type": "boolean",
      "title": "Active",
      "description": "Whether this is the active agent for its type."
    },
    "is_default": {
      "type": "boolean",
      "title": "Is Default",
      "description": "This agent is the project's DEFAULT for its product surface (one per project): the copilot conversations run on, or the routine agent a new routine starts with."
    },
    "template_key": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Template Key",
      "description": "The template this agent was created from ('copilot' | 'voc_agent'), or null for an agent created by hand through this API. Identity: resolve an agent by this, never by name."
    },
    "is_shared": {
      "type": "boolean",
      "title": "Is Shared",
      "description": "This row still points at one of the two SHARED provider agents (a project not yet migrated). Update and archive are rejected with 403 for those, because the agent belongs to every project — so a client must not offer either action.",
      "default": false
    },
    "template_managed": {
      "type": "boolean",
      "title": "Template Managed",
      "description": "Whether a template upgrade may still rewrite this agent. Editing a template-created agent clears it (fork-on-edit), so the user's change is never silently overwritten — surface that as 'customized' and offer a reset.",
      "default": false
    },
    "template_version": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Template Version",
      "description": "The template version it was rendered from."
    },
    "tools": {
      "anyOf": [
        {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Tools",
      "description": "Custom tool definitions; null = the provider's default set."
    },
    "multiagent": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Multiagent",
      "description": "The multiagent roster, if any."
    },
    "created_by": {
      "type": "integer",
      "title": "Created By",
      "description": "User id of the creator."
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At",
      "description": "Creation timestamp."
    }
  },
  "type": "object",
  "required": [
    "id",
    "project_id",
    "name",
    "provider",
    "type",
    "active",
    "is_default",
    "created_by",
    "created_at"
  ],
  "$defs": {
    "AgentType": {
      "type": "string",
      "enum": [
        "generic",
        "copilot",
        "routine"
      ],
      "title": "AgentType",
      "description": "The product an agent belongs to, on the shared ``managed_agents`` table.\n\n``routine`` agents back routines; ``copilot`` is the research-copilot agent (one\nactive per project, auto-selected); ``generic`` is a plain CRUD agent."
    },
    "Provider-Output": {
      "type": "string",
      "enum": [
        "anthropic",
        "onclarity"
      ],
      "title": "Provider",
      "description": "Managed-agents provider, named by company (not product)."
    },
    "SkillRef": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id",
          "description": "Provider skill id."
        },
        "display_title": {
          "type": "string",
          "title": "Display Title",
          "description": "Human-readable skill title."
        }
      },
      "type": "object",
      "required": [
        "id",
        "display_title"
      ],
      "title": "SkillRef",
      "description": "How a skill is stored on an agent."
    }
  }
}