API Reference / agent / user_algorithms /

registration.py

Import user algorithm files and register them with the TuiML registry.

Functions

Func

load_all

Line 139
load_all() -> Dict[str, Any]

Scan USER_ALGS_DIR and register every algorithm found.

Called once at MCP server startup. Failures on individual files are logged but do not abort the whole load. Only the latest version of each algorithm is loaded.

Returns

result
Dict[str, Any]
Keys status, loaded (count), algorithms (list of dicts with name, kind, version), and errors (list of dicts with path, error for files that failed to load).
Func

ensure_loaded

Line 182
ensure_loaded(verbose: bool=False) -> Dict[str, Any]

Run load_all once per process, returning the cached result after.

Registering user algorithms means executing Python from USER_ALGS_DIR, so it must happen before anything reads the registry but never merely because a module was imported. Callers that are about to touch the registry — the MCP server, a CLI subcommand, execute_tool — call this; tuiml --version and tuiml --help never do, and so never run user code.

Parameters

verbose
bool = False
Report the load on stderr. The MCP server passes True, where the counts are startup logging; the CLI leaves it False so ordinary commands stay quiet.

Returns

result
Dict[str, Any]
Whatever load_all returned on the first call.