Agentic.Protocol.ACP.Discovery (agentic v0.2.2)

Copy Markdown

Auto-discovery of ACP-compatible agents on the system.

Probes the filesystem for known ACP-capable CLIs and registers discovered agents in the protocol registry.

The known agents database is derived from the acpx project (https://github.com/openclaw/acpx) and covers 15+ agents.

Discovery Sources

  1. Built-in known agents database (this module)
  2. config :agentic, :acp_agents (user overrides)
  3. ACP_AGENTS environment variable (comma-separated)
  4. :discover_callback in acp config (programmatic)

Summary

Functions

Return the resolved directories for an agent on the current OS.

Check if a specific agent is available.

Get backend config for a named agent.

Clear the discovery cache.

Parse configured agents from app config and ACP_AGENTS env var.

Discover all available ACP agents on the system.

Discover agents and register them in the Protocol.Registry.

Initialize the ETS table for discovery cache.

Return all known agent entries (before probing).

Get the launch command and args for a named agent.

Look up an agent entry by name.

Look up an agent in the built-in database by name or alias (no ETS required).

Returns the ETS table name (for testing).

Types

agent_entry()

@type agent_entry() :: %{
  name: atom(),
  command: String.t(),
  args: [String.t()],
  display: String.t(),
  aliases: [atom()],
  cache_dirs: [String.t()],
  directories: %{
    linux: os_directories(),
    macos: os_directories(),
    windows: os_directories()
  },
  notes: String.t() | nil
}

os_directories()

@type os_directories() :: %{
  config: [String.t()],
  logs: [String.t()],
  cache: [String.t()]
}

Functions

agent_directories(name)

@spec agent_directories(atom()) :: os_directories() | nil

Return the resolved directories for an agent on the current OS.

Returns a map with config, logs, and cache keys containing expanded absolute paths. Returns nil if the agent is unknown.

available?(name)

@spec available?(atom()) :: boolean()

Check if a specific agent is available.

backend_config(name, opts \\ [])

@spec backend_config(
  atom(),
  keyword()
) :: map()

Get backend config for a named agent.

clear_cache()

@spec clear_cache() :: :ok

Clear the discovery cache.

configured_agents()

@spec configured_agents() :: [agent_entry()]

Parse configured agents from app config and ACP_AGENTS env var.

discover_all()

@spec discover_all() :: [agent_entry()]

Discover all available ACP agents on the system.

Probes each known agent's command for filesystem presence, merges with user-configured agents, and caches results.

discover_and_register()

@spec discover_and_register() :: [atom()]

Discover agents and register them in the Protocol.Registry.

init()

@spec init() :: :ok

Initialize the ETS table for discovery cache.

known_agents()

@spec known_agents() :: [agent_entry()]

Return all known agent entries (before probing).

launch_command(name)

@spec launch_command(atom()) :: {String.t(), [String.t()]} | nil

Get the launch command and args for a named agent.

lookup(name)

@spec lookup(atom()) :: agent_entry() | nil

Look up an agent entry by name.

lookup_known(name)

@spec lookup_known(atom()) :: agent_entry() | nil

Look up an agent in the built-in database by name or alias (no ETS required).

table_name()

Returns the ETS table name (for testing).