Skip to main content

Introduction

Worker Core is the internal engine of Andera. It is never used directly by application developers, but serves as the technical foundation for all Workers (via Base Worker). This page is mainly for contributors or those curious about the internal architecture.

Role​

  • Provides orchestration, slot management, contract validation, logging, and the runtime for all Andera Workers.
  • All business logic (functions, services, helpers, tags) is added in a Worker project based on Base Worker.
  • Worker Core is never deployed on its own; it is used as a dependency.

Project Structure​

worker-core/
├── src/
│ ├── config/ # Loads and validates configuration
│ ├── controllers/ # Exposes HTTP endpoints (task, health, logs, etc.)
│ ├── dynamic/ # Dynamic discovery of functions/services/tags
│ ├── mcp/ # Optional MCP transport, schemas and live configuration
│ ├── middleware/ # HTTP middlewares (auth, logs, etc.)
│ ├── slots/ # Slot management (parallelism, internal queues)
│ ├── types/ # Shared TypeScript types
│ ├── utils/ # Utilities (logger, validation, etc.)
│ └── websocket/ # WebSocket server for slots and monitoring
├── test/ # Regression and integration tests
├── dist/ # Compiled build
├── package.json # Dependencies and scripts
├── README.md
└── LICENCE

Key Concepts​

  • Validated configuration: Environment variables are checked at startup; an invalid value stops the Worker with a message naming the variable (see Configuration).
  • Slots: Manages parallelism; each Worker exposes a number of slots to execute tasks in parallel.
  • Contracts: Strict validation of the interface (functions, parameters) to ensure homogeneity within a group of Workers.
  • Orchestration: Receives, schedules, and executes tasks, manages internal queues.
  • MCP (optional): Exposes selected functions to AI agents as MCP tools (see MCP endpoint).
  • Dynamic discovery: Auto-loads functions, services, helpers, and tags from the Worker project.
  • Native logging: In-memory logging system, exposed through the authenticated /logs endpoint. Errors are logged as name, message and code only, so credentials carried by error objects do not reach the logs.
  • WebSocket: For real-time monitoring (slots, status, etc.).

Contributing​

  • See the README and source code to explore entry points.
  • All contributions should follow the project philosophy: performance, simplicity, robustness.

For developer documentation (using Workers, creating functions/services/tags), see the Base Worker section.

Tests​

Worker Core has its own regression and integration tests. With a supported Node.js version (^22.23.4, ^24.22.1 or >=26.12.1), run npm ci, npm test and npm run lint in the Core repository. The suite covers REST execution, authentication, configuration validation, parameter validation, webhooks, cancellation, service lifecycle helpers and the optional MCP endpoint.