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

# Local Turn Lock • AI Agent SDK

> LocalTurnLock: Default in-process turn lock — today's ``asyncio.Lock`` behaviour.

# LocalTurnLock

> Defined in the [**protocols**](../modules/protocols) module.

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

Default in-process turn lock — today's `asyncio.Lock` behaviour.

Zero-cost, dependency-free implementation of :class:`TurnLockProtocol` for
single-replica / no-backend deployments. It serialises turns within one
process (per event loop) exactly as the existing `LockMap` does, so
upgrading is byte-for-byte backward compatible. It provides **no** cross-
process guarantee — selecting a distributed backend (e.g. `redis`) is what
extends serialisation across replicas.

The `owner`/`ttl` arguments are accepted for protocol symmetry but are
inert here: an in-process `asyncio.Lock` is released deterministically
when the holding task exits, so there is no crashed-holder lease to expire.

## Methods

<CardGroup cols={2}>
  <Card title="acquire()" icon="function" href="../functions/LocalTurnLock-acquire">
    Instance method.
  </Card>

  <Card title="release()" icon="function" href="../functions/LocalTurnLock-release">
    Instance method.
  </Card>

  <Card title="hold()" icon="function" href="../functions/LocalTurnLock-hold">
    Instance method.
  </Card>
</CardGroup>

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/protocols.py#L5435">
  `praisonaiagents/gateway/protocols.py` at line 5435
</Card>
