Skip to content

API Reference parrot.handlers.models.skills_catalog

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.handlers.models.skills_catalog

View source

SkillCatalogEntry asyncdb model — durable record + SQL query plane for the shared skills catalog (FEAT-467 TASK-2515).

PG-first, dual-write design (spec §3 Module 7): this table is the system-of-record; the SkillRegistry (Redis + file, shared "<org>/ _shared" namespace) is a best-effort secondary index for embedding search + git-like versioning. search_index_stale marks rows whose registry write failed — repaired by the startup reconciliation pass or the admin resync endpoint.

NOTE: deliberately NOT using from __future__ import annotations — asyncdb's Model/datamodel Cython field processor introspects __annotations__ directly (no typing.get_type_hints() resolution) and requires REAL type objects, not the postponed- evaluation string literals the future import would produce; with it, constructing SkillCatalogEntry(...) raises TypeError: Expected type, got str inside datamodel.validation (confirmed empirically — matches the working, future-import-free scheduler/models.py:: ServiceSchedule pattern; see handlers/models/studio_drafts.py for the same fix applied to TASK-2513's model).

Class SkillCatalogEntry

Database model for the org-wide shared skills catalog (spec §2).

SQL Table Creation (migration 0004 adds the tenancy columns and constraints): CREATE TABLE IF NOT EXISTS navigator.ai_skills_catalog ( skill_id UUID PRIMARY KEY DEFAULT gen_random_uuid(), name VARCHAR NOT NULL, description TEXT NOT NULL, category VARCHAR NOT NULL DEFAULT 'general', owner VARCHAR NOT NULL, triggers JSONB DEFAULT '[]'::JSONB, body TEXT NOT NULL, version INTEGER NOT NULL DEFAULT 1, status VARCHAR NOT NULL DEFAULT 'active', search_index_stale BOOLEAN NOT NULL DEFAULT FALSE, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), tenant TEXT NULL, -- 0004 visibility TEXT NOT NULL DEFAULT 'private', -- 0004 allowed_groups TEXT[] NOT NULL DEFAULT '{}', -- 0004 UNIQUE (tenant, name), -- replaces the global UNIQUE(name) CHECK (visibility IN ('private', 'tenant', 'groups')), CHECK (tenant IS NULL OR tenant ~ '^[a-z0-9][a-z0-9_-]{0,62}$'), CHECK (tenant IS NOT NULL OR visibility = 'private') ); CREATE UNIQUE INDEX ai_skills_catalog_global_name_uq ON navigator.ai_skills_catalog (name) WHERE tenant IS NULL; CREATE INDEX ai_skills_catalog_tenant_visibility_idx ON navigator.ai_skills_catalog (tenant, visibility); CREATE INDEX idx_ai_skills_catalog_category ON navigator.ai_skills_catalog(category); CREATE INDEX idx_ai_skills_catalog_owner ON navigator.ai_skills_catalog(owner);

skill_id mirrors the SkillRegistry Skill.skill_id for the same entry (FEAT-467 TASK-2515 — SkillRegistry.upload_skill's skill_id= parameter is used to create the registry-side Skill with THIS row's id). category is constrained to parrot.skills.models.SkillCategory values by the handler; out-of- vocabulary values are never persisted (handler-side validation, not a DB constraint).

Attributes:

Attribute Type Description
skill_id uuid.UUID
name str
description str
category str
owner str
triggers list
body str
version int
status str
search_index_stale bool
tenant Optional[str]
visibility str
allowed_groups list
created_at datetime
updated_at datetime

Class SkillCatalogEntry.Meta

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally