Skip to content
GitHub

Quickstart

Terminal window
uv add lexigram-ai-workers

lexigram-ai-workers depends on lexigram and lexigram-contracts (installed automatically).

import asyncio
from lexigram import Application, LexigramConfig
from lexigram.ai.workers import WorkersModule
async def main() -> None:
config = LexigramConfig.from_yaml("application.yaml")
app = Application(name="my-app", config=config)
app.add_module(WorkersModule.configure())
await app.start()
print("Worker subsystem is running")
await asyncio.sleep(10)
await app.stop()
asyncio.run(main())

With application.yaml:

ai_workers:
enabled: true
batch_embedding_concurrency: 3
document_ingestion_concurrency: 3
  1. WorkersModule.configure() creates a DynamicModule with a WorkersProvider.
  2. Application.boot() starts the provider lifecycle:
    • registerWorkersConfig and worker types are bound in the container.
    • boot — workers (BatchEmbeddingWorker, DocumentIngestionWorker, MaintenanceWorker, DeadLetterQueueWorker) are resolved and started as background tasks.
  • Guide — mental model, worker types, typical workflows
  • How-Tos — task-oriented recipes
  • Configuration — all config keys and env-var overrides