pratyushdeosingh/mdp / .agents/skills/dbos-python
dbos-python
VerifiedDBOS Python SDK for building reliable, fault-tolerant applications with durable workflows. Use this skill when writing Python code with DBOS, creating workflows and steps, using queues, using DBOSC...
references/queue-rate-limiting.md
View on GitHub---
title: Rate Limit Queue Execution
impact: HIGH
impactDescription: Prevents hitting API rate limits
tags: queue, rate-limit, api, throttle
---
## Rate Limit Queue Execution
Use rate limits when working with rate-limited APIs (like LLM APIs). Limits are global across all processes.
**Incorrect (no rate limiting):**
```python
queue = Queue("llm_tasks")
@DBOS.step()
def call_llm(prompt):
# May hit rate limits if too many calls
return openai.chat.completions.create(...)
```
**Correct (with rate limit):**
```python
# Max 50 tasks started per 30 seconds
queue = Queue("llm_tasks", limiter={"limit": 50, "period": 30})
@DBOS.step()
def call_llm(prompt):
return openai.chat.completions.create(...)
@DBOS.workflow()
def process_prompts(prompts):
handles = []
for prompt in prompts:
# Queue enforces rate limit
handle = queue.enqueue(call_llm, prompt)
handles.append(handle)
return [h.get_result() for h in handles]
```
Rate limit parameters:
- `limit`: Maximum number of functions to start in the period
- `period`: Time period in seconds
Rate limits can be combined with concurrency limits:
```python
queue = Queue("api_tasks",
worker_concurrency=5,
limiter={"limit": 100, "period": 60})
```
Reference: [Rate Limiting](https://docs.dbos.dev/python/tutorials/queue-tutorial#rate-limiting)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 467k | Updated | Claude CodeCodex | Verified | Install |
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 467k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |