@exulu/backend source. For constructor-time options, see Configuration.
Constructor
create().
Lifecycle
create()
Initializes the app: merges built-in contexts, registers default providers, tools, and evals, validates IDs, checks the queue license, and probes system dependencies. See Introduction for the full behavior list.Platform configuration. See Configuration.
Contexts to register. Built-in contexts win on key collision.
Code-defined agents, merged with database agents at read time.
Custom providers, appended after the 19 defaults.
Custom evals. Only registered when Redis is configured.
Custom tools, registered ahead of the built-in tools.
The initialized instance (the same object you called
create() on). It is also stored in an internal singleton.express.init()
Builds and returns the Express application: registers the GraphQL and REST routes, sets up authentication middleware and logging, mounts the MCP endpoints whenconfig.MCP.enabled is true, starts the LiteLLM proxy supervisor when EXULU_USE_LITELLM=true, and starts the transcription polling loop when TRANSCRIPTION_SERVER is set.
The Express application, ready to
listen() on a port. Calling express.init() again returns the same instance.If the LiteLLM supervisor fails to start,
express.init() does not throw — the app keeps booting so the admin UI stays reachable, and agent requests fail with LITELLM_NOT_READY until the underlying issue is fixed and the process restarted.expressApp
Getter for the initialized Express application.The Express application created by
express.init().Component accessors
tool()
Returns a registered tool by ID.The tool ID.
The tool, or
undefined if no tool with that ID is registered.tools()
Returns all registered tools: your custom tools plus the built-ins.All registered tools.
context()
Returns a registered context by ID.The context ID.
The context, or
undefined if not registered.contexts
Getter returning all registered contexts (yours plus built-ins) as an array.provider()
Returns a registered model provider by ID.The provider ID.
The provider, or
undefined if not registered.providers
Getter returning all registered providers — the 19 defaults plus any you passed tocreate().
agent()
Resolves an agent by ID. Unlike the other accessors, this is async: agents can be defined in code (passed tocreate()) or created in the database through the platform UI, and this method checks both.
The agent ID.
Which sources to check. Code-defined agents are checked first; database agents second.
The agent with its
RBAC block resolved. Code-defined agents without an explicit RBAC get a default public one and source: "code".agents()
Returns all agents. Also async — database agents are fetched and their RBAC resolved; code-defined agents are prepended with default public RBAC.Which sources to include.
Code-defined agents first, then database agents.
Embeddings
App-level convenience wrappers around the per-context embedding methods. They resolve the context by ID and delegate to the context’s own embeddings methods.embeddings.generate.one()
Loads one item from the context’s items table by ID and generates (or queues) its embeddings.The context ID.
The item ID (UUID) within that context.
The item ID.
Job ID when the context’s embedder runs on a queue.
Number of chunks written when embeddings were generated inline.
embeddings.generate.all()
Generates (or queues) embeddings for every item in a context.The context ID.
Job IDs when the embedder runs on a queue.
Number of items processed.
Workers
bullmq.workers.create()
Starts BullMQ workers in the current process. Run this in a dedicated worker process, not inside the HTTP server.Queue names this worker should listen to. When omitted, the worker listens to all registered queues.
The BullMQ
Worker instances, one per queue.- Checks the license — throws without a valid
EXULU_ENTERPRISE_LICENSEcovering queues. - Enables LiteLLM client mode — when
EXULU_USE_LITELLM=true, the worker health-probes the server-managed proxy instead of spawning its own. - Configures worker logging — uses
workers.logger.winston.transports, falling back tologger.winston.transports, then to the built-in console transport. - Creates context source schedulers — for every context source with a
config.schedulecron expression and a queue, a BullMQ job scheduler is upserted with the source’sretries(default 3) andbackoff(default exponential, 2000 ms).