Skip to content

API Reference parrot.skills.store

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

parrot.skills.store

View source

SkillRegistry - Git-like versioned skill/knowledge store.

Provides:

  • Skill CRUD with automatic versioning
  • Unified diff storage for efficiency
  • Vector search for skill discovery
  • Auto-extraction of skills from conversations

Alias ContentType

Re-exported from parrot.skills.models.ContentType.

Alias ExtractedSkill

Re-exported from parrot.skills.models.ExtractedSkill.

Attribute FAISS_AVAILABLE

Attribute REDIS_AVAILABLE

Alias Skill

Re-exported from parrot.skills.models.Skill.

Alias SkillCategory

Re-exported from parrot.skills.models.SkillCategory.

Alias SkillMetadata

Re-exported from parrot.skills.models.SkillMetadata.

Class SkillRegistry

Git-like versioned skill registry.

Features:

  • Create/update skills with automatic versioning
  • Store diffs for space efficiency
  • Reconstruct any historical version
  • Vector search for skill discovery
  • Agent-driven skill extraction

Namespace convention: "<org_id>/<agent_id>" isolates skills to a single agent (the default, existing usage). FEAT-467 (Agent Studio) additionally uses the reserved agent segment "_shared" — "<org_id>/_shared" — for the org-wide shared skills catalog. No behavioral special-casing is needed here: a shared-namespace registry is constructed and used exactly like any other (see handlers/studio/skills_catalog/'s dual-write with the NEW navigator.ai_skills_catalog Postgres table, the durable record and SQL query plane for that catalog).

Parameter Type Default Description
namespace str 'default' Namespace for skill isolation (org_id/agent_id)
embedding_model str | Any 'sentence-transformers/all-mpnet-base-v2' Model for vector search
dimension int 768 Embedding dimension
redis_url str | None None Redis URL for storage
persistence_path Path | None None Path for file-based persistence
extraction_llm Any | None None LLM for auto-extracting skills
min_diff_threshold int 50 Minimum change size to create version

Method SkillRegistry.configure

Configure the registry.

configure(extraction_llm: Any | None = None, embedding_model: Any | None = None) -> None

Parameter Type Default Description
extraction_llm Any | None None
embedding_model Any | None None

Method SkillRegistry.embed_text

Return a normalized embedding without blocking the event loop.

embed_text(text: str) -> np.ndarray

Parameter Type Default Description
text str

Returns: np.ndarray

Method SkillRegistry.upload_skill

Upload a new skill or new version of existing skill.

upload_skill(name: str, content: str, agent_id: str, description: str = '', category: SkillCategory | str = SkillCategory.GENERAL, tags: list[str] | None = None, triggers: list[str] | None = None, related_tools: list[str] | None = None, commit_message: str = '', skill_id: str | None = None, owner_user_id: str = '') -> tuple[Skill, SkillVersion]

Parameter Type Default Description
name str Skill name
content str Full skill content (Markdown)
agent_id str Creating agent
description str '' Brief description
category SkillCategory | str SkillCategory.GENERAL Skill category
tags list[str] | None None Searchable tags
triggers list[str] | None None Activation patterns
related_tools list[str] | None None Tools this skill uses
commit_message str '' Why this version was created
skill_id str | None None Existing skill to update (looked up in self._skills); when NOT found, also used as the NEW skill's id instead of auto-generating one (FEAT-467 TASK-2515 — lets an external system-of-record, e.g. a Postgres catalog row, mirror this registry's skill_id 1:1). None still auto-generates.
owner_user_id str '' Session-user owner stamp (FEAT-467 TASK-2515 — distinct from agent_id/owner_agent_id, which tracks the creating AGENT). Only applied when creating a NEW skill; an update preserves the existing skill's owner_user_id.

Returns: tuple[Skill, SkillVersion] — Tuple of (Skill, SkillVersion)

Method SkillRegistry.read_skill

Read skill content, reconstructing from diffs if needed.

read_skill(skill_id: str, version: int | None = None) -> str

Parameter Type Default Description
skill_id str Skill to read
version int | None None Specific version (None for latest)

Returns: str — Reconstructed content

Method SkillRegistry.search_skills

Search for relevant skills.

search_skills(query: str, category: SkillCategory | None = None, tags: list[str] | None = None, include_deprecated: bool = False, max_results: int = 5, *, query_embedding: np.ndarray | None = None) -> list[SkillSearchResult]

Parameter Type Default Description
query str Search query
category SkillCategory | None None Filter by category
tags list[str] | None None Filter by tags (any match)
include_deprecated bool False Include deprecated skills
max_results int 5 Maximum results
query_embedding np.ndarray | None None Optional precomputed embedding for the query.

Returns: list[SkillSearchResult] — List of SkillSearchResult

Method SkillRegistry.get_skill_versions

Get version history for a skill.

get_skill_versions(skill_id: str) -> list[dict[str, Any]]

Parameter Type Default Description
skill_id str

Returns: list[dict[str, Any]]

Method SkillRegistry.deprecate_skill

Mark skill as deprecated.

deprecate_skill(skill_id: str, reason: str = '') -> Skill

Parameter Type Default Description
skill_id str
reason str ''

Returns: Skill

Method SkillRegistry.revoke_skill

Mark skill as revoked (do not use).

revoke_skill(skill_id: str, reason: str = '') -> Skill

Parameter Type Default Description
skill_id str
reason str ''

Returns: Skill

Method SkillRegistry.extract_skill_from_conversation

Use LLM to extract a skill from conversation.

extract_skill_from_conversation(conversation: str, agent_id: str, context: str | None = None) -> tuple[Skill, SkillVersion] | None

Parameter Type Default Description
conversation str Conversation text to analyze
agent_id str Agent doing the extraction
context str | None None Additional context

Returns: tuple[Skill, SkillVersion] | None — Created Skill and Version, or None if nothing worth saving

Method SkillRegistry.get_relevant_skills

Get relevant skills formatted for context injection.

Returns formatted Markdown suitable for system prompt.

get_relevant_skills(query: str, max_skills: int = 3, max_tokens: int = 2000) -> str

Parameter Type Default Description
query str
max_skills int 3
max_tokens int 2000

Returns: str

Method SkillRegistry.list_skills

List all skills with summary info.

list_skills(include_deprecated: bool = False) -> list[dict[str, Any]]

Parameter Type Default Description
include_deprecated bool False

Returns: list[dict[str, Any]]

Method SkillRegistry.cleanup

Cleanup resources.

cleanup() -> None

Alias SkillSearchResult

Re-exported from parrot.skills.models.SkillSearchResult.

Alias SkillStatus

Re-exported from parrot.skills.models.SkillStatus.

Alias SkillVersion

Re-exported from parrot.skills.models.SkillVersion.

Function apply_unified_diff

Apply unified diff to reconstruct content.

apply_unified_diff(base_content: str, diff_content: str) -> str

Parameter Type Default Description
base_content str
diff_content str

Returns: str

Function compute_unified_diff

Compute unified diff between two versions.

compute_unified_diff(old_content: str, new_content: str, context_lines: int = 3) -> str

Parameter Type Default Description
old_content str
new_content str
context_lines int 3

Returns: str

Function create_skill_registry

Factory function for SkillRegistry.

create_skill_registry(namespace: str, persistence_path: str | None = None, redis_url: str | None = None, **kwargs) -> SkillRegistry

Parameter Type Default Description
namespace str
persistence_path str | None None
redis_url str | None None
**kwargs {}

Returns: SkillRegistry

Alias quiet_faiss_loader

Re-exported from parrot.utils.faiss_logging.quiet_faiss_loader.

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