dbos-python
它能做什么
这份指南可以帮你使用 DBOS 这个工具,编写不容易出错的 Python 程序。它会告诉你如何组织代码结构,让程序即使遇到问题也能可靠地运行。
适用场景
- ✓当你要把 DBOS 添加到现有的 Python 代码中时。
- ✓当你要创建新的程序模块(工作流和步骤)时。
- ✓当你要使用队列来管理同时运行的任务数量时。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/dbos-python/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我该如何在 Python 程序中设置 DBOS?”
每周 5 个新技能,1 分钟读完。
工作原理
DBOS 的工作方式是把你的代码组织成“工作流”和“步骤”。步骤负责处理可能失败或耗时较长的任务,而工作流则负责可靠地协调这些步骤。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
DBOS Python Best Practices
Guide for building reliable, fault-tolerant Python applications with DBOS durable workflows.
When to Use
Reference these guidelines when:
- Adding DBOS to existing Python code
- Creating workflows and steps
- Using queues for concurrency control
- Implementing workflow communication (events, messages, streams)
- Configuring and launching DBOS applications
- Using DBOSClient from external applications
- Testing DBOS applications
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Lifecycle | CRITICAL | lifecycle- |
| 2 | Workflow | CRITICAL | workflow- |
| 3 | Step | HIGH | step- |
| 4 | Queue | HIGH | queue- |
| 5 | Communication | MEDIUM | comm- |
| 6 | Pattern | MEDIUM | pattern- |
| 7 | Testing | LOW-MEDIUM | test- |
| 8 | Client | MEDIUM | client- |
| 9 | Advanced | LOW | advanced- |
Critical Rules
DBOS Configuration and Launch
A DBOS application MUST configure and launch DBOS inside its main function:
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()
Workflow and Step Structure
Workflows are comprised of steps. Any function performing complex operations or accessing external services must be a step:
@DBOS.step()
def call_external_api():
return requests.get("https://api.example.com").json()
@DBOS.workflow()
def my_workflow():
result = call_external_api()
return result
Key Constraints
- Do NOT call
DBOS.start_workfloworDBOS.recvfrom a step - Do NOT use threads to start workflows - use
DBOS.start_workflowor queues - Workflows MUST be deterministic - non-deterministic operations go in steps
- Do NOT create/update global variables from workflows or steps
How to Use
Read individual rule files for detailed explanations and examples:
references/lifecycle-config.md
references/workflow-determinism.md
references/queue-concurrency.md
References
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
常见问题
什么是工作流和步骤?
工作流是程序执行的一系列操作。步骤是工作流中的较小部分,负责完成具体任务,比如调用外部服务。
为什么我的代码需要足够可靠?
可靠的程序即使遇到错误或故障也能继续运行,确保任务不间断地完成。
用于并发控制的队列是什么?
队列可以帮你管理程序同时运行的任务数量,避免系统过载,并确保一切有条不紊地运行。
详情
作者的原始描述
Guide 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.
热度
- GitHub 星标
- 48k
- 排名
- #4343
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。