Jesse
02/19/2026, 2:37 PMclient.create_concurrency_limit or client.create_concurrency_limit_v2 to create a concurrency limit for a tag?Marvin
02/19/2026, 2:37 PMMarvin
02/19/2026, 2:39 PMclient.create_concurrency_limit for tag-based limits. There is no client.create_concurrency_limit_v2 method on the Python client—“v2” refers to the REST API for global concurrency limits, not tag-based limits.
- Tag-based limits (tasks with specific tags): client.create_concurrency_limit(tag=..., concurrency_limit=...)
- Global limits (general purpose/rate limiting across any code): client.create_global_concurrency_limit(...)
Example (Prefect 3.x):
from prefect import get_client
async def setup_tag_limit():
async with get_client() as client:
await client.create_concurrency_limit(tag="database", concurrency_limit=5)
Notes:
- Tasks must include the tag, e.g., @task(tags=["database"]).
- Under the hood, Prefect backs tag limits with a global limit named tag:{your_tag}.
Docs:
- How-to: Tag-based concurrency limits
- Concepts: Tag-based concurrency limits
- Client API reference
- REST: Create tag-based concurrency limit
If you were aiming for rate limiting or cross-task/flow resource control, use client.create_global_concurrency_limit instead. If you’re on Prefect 2.x, let me know and I can tailor the guidance.