Jido.Discovery (Jido v2.0.0-rc.1)
View SourceFast, persistent catalog of Jido components (Actions, Sensors, Agents, Skills, Demos).
Discovery uses :persistent_term for optimal read performance. The catalog is built
asynchronously during application startup and can be refreshed on demand.
Component Discovery
Discovery automatically finds and indexes:
- Actions - Discrete units of work (
__action_metadata__/0) - Sensors - Event monitoring components (
__sensor_metadata__/0) - Agents - Autonomous workers (
__agent_metadata__/0) - Skills - Reusable capability packs (
__skill_metadata__/0) - Demos - Example implementations (
__jido_demo__/0)
Component Metadata
Each discovered component includes:
%{
module: MyApp.CoolAction,
name: "cool_action",
description: "Does cool stuff",
slug: "abc123de",
category: :utility,
tags: [:cool, :stuff]
}Usage
# List components with optional filters
Jido.Discovery.list_actions(category: :utility, limit: 10)
Jido.Discovery.list_sensors(tag: :monitoring)
# Find by slug
Jido.Discovery.get_action_by_slug("abc123de")
# Refresh catalog
Jido.Discovery.refresh()
# Get last update time
{:ok, timestamp} = Jido.Discovery.last_updated()Filtering Options
:limit- Maximum results to return:offset- Results to skip (pagination):name- Filter by name (partial match):description- Filter by description (partial match):category- Filter by category (exact match):tag- Filter by tag (must have exact tag)
Filters use AND logic - all specified filters must match.
Performance
Reads are extremely fast (direct memory access) and never block. All processes can read concurrently without contention.
Summary
Functions
Returns the full catalog for inspection.
Retrieves an Action by its slug.
Retrieves an Agent by its slug.
Retrieves a Demo by its slug.
Retrieves a Sensor by its slug.
Retrieves a Skill by its slug.
Initializes the discovery catalog asynchronously.
Returns the last time the catalog was updated.
Lists all Actions with optional filtering and pagination.
Lists all Agents with optional filtering and pagination.
Lists all Demos with optional filtering and pagination.
Lists all Sensors with optional filtering and pagination.
Lists all Skills with optional filtering and pagination.
Refreshes the component catalog by rescanning all loaded applications.
Types
Functions
@spec catalog() :: {:ok, map()} | {:error, :not_initialized}
Returns the full catalog for inspection.
@spec get_action_by_slug(String.t()) :: component_metadata() | nil
Retrieves an Action by its slug.
@spec get_agent_by_slug(String.t()) :: component_metadata() | nil
Retrieves an Agent by its slug.
@spec get_demo_by_slug(String.t()) :: component_metadata() | nil
Retrieves a Demo by its slug.
@spec get_sensor_by_slug(String.t()) :: component_metadata() | nil
Retrieves a Sensor by its slug.
@spec get_skill_by_slug(String.t()) :: component_metadata() | nil
Retrieves a Skill by its slug.
@spec init_async() :: Task.t()
Initializes the discovery catalog asynchronously.
Call this from your application supervisor's start callback. The catalog will be built in the background without blocking startup.
@spec last_updated() :: {:ok, DateTime.t()} | {:error, :not_initialized}
Returns the last time the catalog was updated.
@spec list_actions(keyword()) :: [component_metadata()]
Lists all Actions with optional filtering and pagination.
@spec list_agents(keyword()) :: [component_metadata()]
Lists all Agents with optional filtering and pagination.
@spec list_demos(keyword()) :: [component_metadata()]
Lists all Demos with optional filtering and pagination.
@spec list_sensors(keyword()) :: [component_metadata()]
Lists all Sensors with optional filtering and pagination.
@spec list_skills(keyword()) :: [component_metadata()]
Lists all Skills with optional filtering and pagination.
@spec refresh() :: :ok
Refreshes the component catalog by rescanning all loaded applications.