@mlx-node/agent

The model catalog and local model discovery behind the mlx agent and Portato.

What this package is

@mlx-node/agent is a library. It holds the model catalog and the local model list that the mlx agent and Portato use. It is not the agent program.

To run the agent, use the mlx command:

bash
mlx agent            # a coding agent on a local model, in your terminal
mlx launch claude    # Claude Code on a local model

See @mlx-node/cli. The first run downloads the agent to ~/.mlx-node/bin. Its settings live in ~/.mlx-agent.

Install

bash
npm install @mlx-node/agent

It needs Node.js 22.19 or newer.

List the catalog and the local models

ts
import { homedir } from 'node:os';
import { join } from 'node:path';

import { discoverMlxModels, visibleCatalog } from '@mlx-node/agent';

// The models the first-run picker offers on a Mac or a machine without CUDA.
for (const entry of visibleCatalog()) console.log(entry.label, '-', entry.description);

// The chat models already on disk.
const local = await discoverMlxModels(join(homedir(), '.mlx-node', 'models'));
console.log(local.map((model) => model.agentModel.id));

visibleCatalog() returns the models the first-run picker offers on a Mac or a machine without CUDA. It hides the entries the machine cannot run, such as the two models that need 96 GiB of RAM. With no GPU argument it also hides the builds that need a CUDA GPU, today the two Hy4-flash Spark builds (96 GiB of GPU memory). On Linux and Windows the picker passes the GPU as the third argument; to get the same list there, call visibleCatalog(totalmem(), process.platform, getRuntimeCapabilities()) with getRuntimeCapabilities from @mlx-node/lm. discoverMlxModels(folder) reads a models folder and returns the chat models it finds, without loading their weights.

Import paths

Import What it gives
@mlx-node/agent The model catalog and local model discovery
@mlx-node/agent/catalog The model catalog
@mlx-node/agent/models Local model discovery
@mlx-node/agent/binary The managed path of the agent program, and its release tags
@mlx-node/agent/paths The folders the agent and the engine use
@mlx-node/agent/delegate The command and prompt text used to hand a task to the agent

Limits

This package is used by the mlx command and by Portato first. Its API can change between 0.0.x releases.

Go deeper