Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.xhipai.com/llms.txt

Use this file to discover all available pages before exploring further.

Admin Storage

The admin package persists entity blueprints to a StorageDriver, ensuring they survive server restarts. Any storage backend supported by @agentium/core works.

Storage Backends

import { InMemoryStorage } from "@agentium/core";
import { createAdminRouter } from "@agentium/admin";

const { router, hydrate } = createAdminRouter({
  storage: new InMemoryStorage(),
});
Data is lost on server restart. Use for development only.

How It Works

The admin layer uses four namespaces to organize data:
NamespaceContents
agentium:admin:agentsAgentBlueprint objects
agentium:admin:teamsTeamBlueprint objects
agentium:admin:workflowsWorkflowBlueprint objects
agentium:admin:toolkit-configsToolkitConfig objects (credentials, settings)
Each record is stored as a plain JSON object keyed by the entity’s name (or instanceName for toolkit configs). No class instances or functions are persisted — only serializable configuration.
Toolkit configs may contain sensitive values (API keys, tokens). These are stored as-is in the storage driver. Use an encrypted-at-rest storage backend (e.g., PostgreSQL with disk encryption) for production deployments. API responses always mask secret fields.

Hydration Flow

On server startup, call hydrate() to restore entities:
Server starts

hydrate()

ToolkitManager.hydrate()  →  Instantiate enabled toolkit configs  →  Tools available
ConfigStore.listAgents()   →  EntityFactory.createAgent()          →  registry.add()
ConfigStore.listTeams()    →  EntityFactory.createTeam()           →  registry.add()

Transport layer discovers all entities via registry

Ready to serve requests
Toolkit configs are hydrated first (so their tools are available), then agents (which may reference those tools), then teams (which reference agents). Entities already in the registry are skipped.

Sharing Storage

The admin storage can use the same StorageDriver instance as your agents’ memory and sessions. Namespaces prevent collisions:
const storage = new PostgresStorage("postgresql://localhost:5432/agentium");

// Admin uses agentium:admin:* namespaces
const { router, hydrate } = createAdminRouter({ storage });

// Agents use agentium:sessions:*, agentium:memory:* namespaces
const agent = new Agent({
  name: "bot",
  model: openai("gpt-4o"),
  memory: { storage },
});