Documentation Index
Fetch the complete documentation index at: https://mintlify.com/timepoint-ai/timepoint-clockchain/llms.txt
Use this file to discover all available pages before exploring further.
What Are Workers?
Timepoint Clockchain uses several background workers to automate graph expansion, content moderation, and daily operations. Each worker runs as an async task managed by FastAPI’s lifespan context.Renderer
Communicates with Flash service to generate historical scene visualizations
Expander
Automatically discovers and adds related historical events to the graph
Judge
Screens user queries for content safety and appropriateness
Daily
Generates scenes for “Today in History” events every 24 hours
Worker Lifecycle
All workers are initialized during application startup inapp/main.py within the lifespan context manager:
Feature Flags
Workers are controlled by environment configuration:| Variable | Worker | Default | Description |
|---|---|---|---|
EXPANSION_ENABLED | Expander | false | Enable automatic graph expansion |
DAILY_CRON_ENABLED | Daily | false | Enable daily scene generation |
OPENROUTER_API_KEY | Expander, Judge | Required | API key for LLM calls |
FLASH_URL | Renderer | Required | Flash service endpoint |
FLASH_SERVICE_KEY | Renderer | Required | Service authentication key |
The Renderer and Judge workers are always available but are invoked on-demand rather than running continuously.
Error Handling
All long-running workers implement robust error handling:- Graceful cancellation: Workers catch
asyncio.CancelledErrorduring shutdown - Error recovery: Exceptions are logged but don’t crash the worker
- Interval-based execution: Workers sleep between cycles to avoid resource exhaustion
Monitoring
Worker status can be monitored through:- Application logs: Each worker logs its operations at INFO level
- Health endpoint:
/healthreturns graph statistics - Graph metrics: Node and edge counts indicate expansion activity