Files
antigravity-skills-reference/skills/dbos-python/references/step-basics.md
Max dml 7e5abd504f feat: add DBOS skills for TypeScript, Python, and Go (#94)
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>
2026-02-17 23:26:51 +01:00

54 lines
1.3 KiB
Markdown

---
title: Use Steps for External Operations
impact: HIGH
impactDescription: Steps enable recovery by checkpointing results
tags: step, external, api, checkpoint
---
## Use Steps for External Operations
Any function that performs complex operations, accesses external APIs, or has side effects should be a step. Step results are checkpointed, enabling workflow recovery.
**Incorrect (external call in workflow):**
```python
import requests
@DBOS.workflow()
def my_workflow():
# External API call directly in workflow - not checkpointed!
response = requests.get("https://api.example.com/data")
return response.json()
```
**Correct (external call in step):**
```python
import requests
@DBOS.step()
def fetch_data():
response = requests.get("https://api.example.com/data")
return response.json()
@DBOS.workflow()
def my_workflow():
# Step result is checkpointed for recovery
data = fetch_data()
return data
```
Step requirements:
- Inputs and outputs must be serializable
- Should not modify global state
- Can be retried on failure (configurable)
When to use steps:
- API calls to external services
- File system operations
- Random number generation
- Getting current time
- Any non-deterministic operation
Reference: [DBOS Steps](https://docs.dbos.dev/python/tutorials/step-tutorial)