ADR-0010: AI Tool Registry and Manifest Discovery¶
Status¶
ACCEPTED
Date: 2026-02-14
Changelog¶
| Date | Revision | Description | Author |
|---|---|---|---|
| 2026-02-14 | 1.0 | Initial version | souperk |
| 2026-02-15 | 1.1 | Update status to reflect implementation | souperk |
Implementation Status¶
Data model and catalog revision infrastructure are implemented. Tool sources, tools, and catalog revisions are fully modeled with entities, repositories, and services. Content-hash-based catalog revisions are created on refresh, and runs pin to a specific catalog revision.
Not yet implemented: - HTTP fetching of manifests from tool sources (currently stubbed) - No real tool source services are registered yet
Context¶
The AI service requires a mechanism to discover and register external tools that the LLM can invoke during orchestration runs. Tools are hosted by other Loryth services (e.g., grocery, issues, kb) and must be made available to the model as JSON Schema function definitions.
Key factors influencing this decision: - Tools are owned and deployed independently by their respective services - The AI service needs a consistent view of available tools for each run - Tool definitions may change between deployments (parameters added/removed, descriptions updated) - Runs must be reproducible: the exact set of tools used in a run must be determinable after the fact - V1 needs to be simple and operational quickly; more sophisticated discovery can come later
Decision¶
We will implement a config-seeded tool registry with content-hash-based catalog revisions:
-
Tool Sources: Each external service that exposes tools is registered as a
ToolSourcewith amanifest_urlpointing to a well-known endpoint (e.g.,GET /tools/manifest). Tool sources are seeded from application configuration at startup. -
Manifest Format: Each tool source returns a JSON array of tool definitions, each containing
tool_id,name,description, andparameters_schema(JSON Schema). -
Refresh Cycle: An admin endpoint (
POST /admin/tools/refresh) triggers the AI service to pull manifests from all active tool sources, upsert tools, and compute a SHA-256 content hash over the sorted, canonical tool set. -
Catalog Revisions: When the content hash changes after a refresh, a new
ToolCatalogRevisionis created with an incrementingrevision_numberand the computedcontent_hash. This provides an immutable snapshot of the tool catalog at a point in time. -
Run Pinning: When a run is created, the current
catalog_revision_idis recorded on theRunentity. This ensures the run's tool set is frozen and auditable regardless of later tool changes. -
No Auto-Discovery in V1: There is no service mesh introspection or dynamic registration. Tool sources are explicitly configured. This is a deliberate simplification for the initial version.
Consequences¶
Positive¶
- Simple to implement and reason about: tool sources are explicit configuration
- Content-hash revisions provide cheap change detection without diffing individual tools
- Run pinning guarantees reproducibility and auditability of tool usage
- Refresh is idempotent and safe to call repeatedly (no-op if hash unchanged)
Negative¶
- Manual configuration required when adding new tool sources
- No real-time tool discovery: changes are only detected on explicit refresh
- Manifest endpoint must be implemented by each service that wants to expose tools
Neutral¶
- Future versions may add event-driven refresh (tool source publishes change event via RabbitMQ)
- Future versions may add service mesh discovery to auto-detect tool sources
- The content hash approach scales well to hundreds of tools but may need partitioning for thousands
Alternatives Considered¶
- Service Mesh Auto-Discovery
- Description: Use Consul/etcd service tags or DNS SRV records to auto-discover tool-providing services
- Pros: Zero-config for new tool sources, always up to date
- Cons: Requires service mesh infrastructure not currently in place, complex failure modes, overkill for current service count
-
Why not chosen: Premature infrastructure investment for a platform with < 10 services
-
Event-Driven Tool Sync
- Description: Tool sources publish events when their tool definitions change; AI service consumes and updates
- Pros: Near-real-time updates, decoupled from polling
- Cons: Requires each service to implement event publishing for tool changes, adds messaging complexity
-
Why not chosen: Good future enhancement but unnecessary complexity for V1 where tools change infrequently
-
Static Tool Definitions in AI Service Config
- Description: Embed tool JSON schemas directly in the AI service configuration files
- Pros: Simplest possible approach, no network calls
- Cons: Tool definitions duplicated across services, no single source of truth, manual sync burden
- Why not chosen: Violates ownership principle; tool-providing services should be the authority on their tool schemas
References¶
- OpenAI Function Calling Specification
- JSON Schema Specification
- ADR-0003: Event-Driven Architecture (future refresh trigger)
- ADR-0004: Service Boundary Definition