Skip to main content

Admin API

The @agentium/admin package provides CRUD endpoints for dynamically managing agents, teams, and workflows at runtime. Entities are persisted to a storage backend and automatically hydrated into the live registry on server restart.

Architecture

  • AdminRouter — Express router with REST CRUD endpoints
  • AdminGateway — Socket.IO event handlers with real-time broadcasts
  • ConfigStore — Persists serializable blueprints to any StorageDriver
  • EntityFactory — Resolves blueprints into live Agent/Team instances via modelRegistry
  • Hydration — On startup, reads all saved configs and re-creates entities into the registry

Installation


Quick Start (Express)

Quick Start (Socket.IO)


AdminOptions

StorageDriver
required
Storage backend for persisting blueprints. Any StorageDriver works: InMemoryStorage, SqliteStorage, PostgresStorage, MongoDBStorage.
Record<string, ToolDef>
Named tools available for agent creation. Users reference tools by key name in blueprints. Explicit entries override any toolkit tools with the same name.
Toolkit[]
Toolkit instances whose tools are automatically registered in the tool library. Pass any built-in toolkit (e.g., CalculatorToolkit, GitHubToolkit) and all their tools become available for agent creation. A GET /tools endpoint and admin.tools.list event are provided for the UI to discover available tools.
RequestHandler[]
Express middleware applied to all admin routes (e.g., authentication).

Hydration

Call hydrate() once at startup to re-create all persisted entities into the live registry:
This reads all saved blueprints from storage, resolves them via EntityFactory (model providers, tools, team members), and creates live instances that auto-register into the global registry. Existing entities with the same name are skipped.

Tool Discovery

The admin layer exposes endpoints and events so the UI can list all available tools before creating agents.

REST

Socket.IO

Using collectToolkitTools

You can also manually build a tool library from toolkits:

Toolkit Configuration (Dynamic Credentials)

The admin layer includes a complete toolkit configuration system. Users can configure toolkit credentials (API keys, tokens, connection strings) through the UI without restarting the server.

How it works

  1. Toolkit Catalog — Lists all available toolkit types and what config fields they need
  2. Toolkit Configs — CRUD operations to save/update/delete credentials per toolkit instance
  3. Secret Masking — API keys are never returned in plain text; responses mask secret fields
  4. Dynamic Instantiation — When a config is saved with enabled: true, the toolkit is immediately created and its tools become available for agent creation
  5. Hydration — On startup, hydrate() re-creates all enabled toolkit instances from storage

REST Example

Socket.IO Example