Implementation:1ay1 Agentty ModelsDev Snapshot
| Knowledge Sources | |
|---|---|
| Domains | Model_Catalog, Background_Work |
| Last Updated | 2026-10-28 12:00 GMT |
Overview
Background snapshot of the models.dev community capability database, pushing per-model reasoning and effort facts into the catalog registries on a 24-hour refresh.
Description
The agentty::modelsdev module is a background snapshot of the models.dev community capability database (https://models.dev/api.json). models.dev names exactly the facts agentty needs for heterogeneous providers: per-model `reasoning` plus `reasoning_options` — the exact effort enum a model accepts, which varies wildly across models.
`refresh()` fetches api.json (24h disk cache under config_dir()), parses it, and pushes per-model facts into the catalog registries. The precedence pipeline places these declarations below user overrides and below learned-from-rejection facts, above from_id inference — so a brand-new model ships, the community updates models.dev, and agentty picks it up within a day without a release. Failures are silent (a metadata refresh must never surface as an error).
The background refresh runs on an owned thread joined before teardown, so a process that exits at once (pipe-EOF, --version) never starts the network call.
Usage
Import this when you need to: load the cached models.dev snapshot at startup, trigger a background refresh, or parse an api.json document for testing.
Code Reference
Source Location
- Repository: 1ay1_Agentty
- File: include/agentty/util/modelsdev.hpp
- Lines: 1-60
Signature
namespace agentty::modelsdev {
// Load the cached snapshot from disk into catalog registries. Cheap; call at startup.
void load_cached();
// Fetch a fresh snapshot if the cache is older than ~24h, then (re)load it.
// Blocking — run on a background worker. Returns models registered.
int refresh();
// Start load_cached() + refresh() on an owned thread after a short delay.
void start_background_refresh(bool no_net = false);
void join_background_refresh(const maya::unlocked& cap) noexcept;
// Parse api.json into a batch without publishing — for tests.
int parse_into(std::string_view body, CatalogBatch& out);
}
Import
#include "agentty/util/modelsdev.hpp"
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| api.json | HTTP fetch | No | The models.dev community database |
| no_net | bool | No | Skip the network fetch (offline / test) |
Outputs
| Name | Type | Description |
|---|---|---|
| refresh() | int | Number of models registered (0 on failure) |
| registries | updated | set_catalog_reasoning / set_catalog_effort_set called per model |
Usage Examples
Startup Integration
#include "agentty/util/modelsdev.hpp"
// At startup — load cached facts immediately:
agentty::modelsdev::load_cached();
// Start background refresh (won't run if process exits immediately):
agentty::modelsdev::start_background_refresh();
// Before teardown:
agentty::modelsdev::join_background_refresh(unlocked);