> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

#  Run Lock • AI Agent SDK

> Shared lazy run-lock helper for core orchestration modules.

# \_run\_lock

AI Agent

Shared lazy run-lock helper for core orchestration modules.

AgentTeam (`agents/agents.py`) and Workflow/AgentFlow (`workflows/workflows.py`)
both lazily mint a per-instance re-entrancy lock the first time a run begins.
Creation is serialized through a single module-level guard (double-checked
locking) so two threads racing into the first `start()`/`astart()`/`run()`
observe the *same* lock object rather than each minting and acquiring its own.

## Import

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import _run_lock
```

## Functions

> **[ensure\_run\_lock()](https://praison.ai/docs/sdk/reference/praisonaiagents/functions/ensure_run_lock.md)**
>
> Lazily mint `obj._run_lock` under a shared module guard.

### Constants

| Name | Value |
| - | - |
| `_RUN_LOCK_INIT_GUARD` | `threading.Lock()` |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.