Skip to main content

ensure_run_lock

Function
This function is defined in the _run_lock module.
Lazily mint obj._run_lock under a shared module guard. getattr(obj, "_run_lock", None) works for both the dataclass-field case (Workflow) and the plain-attribute case (AgentTeam), so the behaviour is identical to the per-module implementations it replaces.

Signature

Parameters

Any
required
The orchestration instance (AgentTeam or Workflow) whose per-instance _run_lock should be returned, creating it on first access.

Returns

Any
The instance’s _run_lock — the same object for every caller under a concurrent first-access race.

Uses

  • getattr
  • threading.Lock

Source

View on GitHub

praisonaiagents/_run_lock.py at line 18

Concurrency

Thread Safety

AgentTeam Batch

Workflows Feature