FISCFED9/CLI / .agents/skills/plugins/antigravity-awesome-skills-claude/skills/dbos-python
dbos-python
VerifiedGuide for building reliable, fault-tolerant Python applications with DBOS durable workflows. Use when adding DBOS to existing Python code, creating workflows and steps, or using queues for concurrency control.
references/workflow-background.md
View on GitHub---
title: Start Workflows in Background
impact: CRITICAL
impactDescription: Background workflows survive crashes and restarts
tags: workflow, background, start_workflow, handle
---
## Start Workflows in Background
Use `DBOS.start_workflow` to run workflows in the background. This returns a handle to monitor or retrieve results.
**Incorrect (using threads):**
```python
import threading
@DBOS.workflow()
def long_task(data):
# Long running work
pass
# Don't use threads for DBOS workflows!
thread = threading.Thread(target=long_task, args=(data,))
thread.start()
```
**Correct (using start_workflow):**
```python
from dbos import DBOS, WorkflowHandle
@DBOS.workflow()
def long_task(data):
# Long running work
return "done"
# Start workflow in background
handle: WorkflowHandle = DBOS.start_workflow(long_task, data)
# Later, get the result
result = handle.get_result()
# Or check status
status = handle.get_status()
```
You can retrieve a workflow handle later using its ID:
```python
# Get workflow ID
workflow_id = handle.get_workflow_id()
# Later, retrieve the handle
handle = DBOS.retrieve_workflow(workflow_id)
result = handle.get_result()
```
Reference: [Starting Workflows](https://docs.dbos.dev/python/tutorials/workflow-tutorial#starting-workflows-in-the-background)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 318k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 318k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 318k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 318k | Updated | Claude CodeCodex | Verified | Install |