Source Code:
src/gaia/agents/registry.pyComponent: AgentRegistry
Module:
gaia.agents.registry
Import: from gaia.agents.registry import AgentRegistry, AgentManifest, AgentRegistration, KNOWN_TOOLSOverview
AgentRegistry is the central catalog of agents available to the Agent UI. It
is populated at server startup by AgentRegistry.discover(), which:
- Registers built-in agents declared in code (today:
chat,builder, optionally others). - Scans
~/.gaia/agents/for custom agents — either a YAMLmanifest.yamlfile or a Python module exporting a factory — and registers each subdirectory it finds.
AgentRegistration objects that the UI router
(src/gaia/ui/routers/agents.py) lists and that _chat_helpers.py uses to
instantiate agents per chat session.
The OpenAI-compatible API server (
src/gaia/api/) still uses a separate,
hard-coded AGENT_MODELS dict in src/gaia/api/agent_registry.py; it does
not go through AgentRegistry. See API Server for
how to wire new agents into the OpenAI surface.Core types
AgentManifest
Pydantic v2 model used to validate a YAML manifest.yaml file under
~/.gaia/agents/<agent-id>/.
validate_id in the source for the exact pattern) and check
every tool in tools appears in KNOWN_TOOLS.
KNOWN_TOOLS
Whitelist of tool-mixin keys a manifest may reference. Each maps to a lazily-
imported (module, class) pair:
AgentRegistration
Dataclass the registry stores per agent:
Public API
AgentRegistry is typically instantiated once per process and shared via
src/gaia/ui/dependencies.py:
| Method | Purpose |
|---|---|
discover() | Scan built-ins and ~/.gaia/agents/. Idempotent; logs results. |
get(id) | Return the registration for id or raise KeyError. |
list() | Enumerate registered agents as a list of AgentRegistration. |
refresh() | Re-scan ~/.gaia/agents/ to pick up new YAML manifests at runtime. |
**kwargs) — the caller
filters to valid AgentConfig fields per agent (see chat_factory in the
source for the common pattern using dataclasses.fields(...)).
Custom-agent directory layout
manifest.yaml:
agent.py must export a factory(**kwargs)
function that returns an Agent subclass instance. The registry imports the
module lazily at discovery time.
Related
- Agent UI Server — how the UI backend uses the registry to resolve chat sessions.
- API Server — the separate OpenAI-style
model registry used by
gaia api start.