> ## 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

<Badge color="blue">AI Agent</Badge>

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

<CardGroup cols={2}>
  <Card title="ensure_run_lock()" icon="function" href="../functions/ensure_run_lock">
    Lazily mint `obj._run_lock` under a shared module guard.
  </Card>
</CardGroup>

### Constants

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


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