Add three DBOS SDK skills with reference documentation for building reliable, fault-tolerant applications with durable workflows. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1.5 KiB
1.5 KiB
title, impact, impactDescription, tags
| title | impact | impactDescription | tags |
|---|---|---|---|
| Configure and Launch DBOS Properly | CRITICAL | Application won't function without proper setup | configuration, launch, setup, initialization |
Configure and Launch DBOS Properly
Every DBOS application must configure and launch DBOS inside the main function.
Incorrect (configuration at module level):
from dbos import DBOS, DBOSConfig
# Don't configure at module level!
config: DBOSConfig = {
"name": "my-app",
}
DBOS(config=config)
@DBOS.workflow()
def my_workflow():
pass
if __name__ == "__main__":
DBOS.launch()
my_workflow()
Correct (configuration in main):
import os
from dbos import DBOS, DBOSConfig
@DBOS.workflow()
def my_workflow():
pass
if __name__ == "__main__":
config: DBOSConfig = {
"name": "my-app",
"system_database_url": os.environ.get("DBOS_SYSTEM_DATABASE_URL"),
}
DBOS(config=config)
DBOS.launch()
my_workflow()
For scheduled-only applications (no HTTP server), block the main thread:
import os
import threading
from dbos import DBOS, DBOSConfig
@DBOS.scheduled("* * * * *")
@DBOS.workflow()
def scheduled_task(scheduled_time, actual_time):
pass
if __name__ == "__main__":
config: DBOSConfig = {
"name": "my-app",
"system_database_url": os.environ.get("DBOS_SYSTEM_DATABASE_URL"),
}
DBOS(config=config)
DBOS.launch()
threading.Event().wait() # Block forever
Reference: DBOS Configuration