Skip to content

Commit 8a2695a

Browse files
committed
docs: improve unsafe_reentrant warning in docstrings
Address PR feedback: - Add explicit warning about unsafe_reentrant making no guarantees - Remove parenthetical about restoring pre-lock behavior - Update both type definition and Agent.__init__ docstrings for consistency
1 parent b3f1a4c commit 8a2695a

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/strands/agent/agent.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,9 @@ def __init__(
189189
Implement a custom HookProvider for custom retry logic, or pass None to disable retries.
190190
concurrent_invocation_mode: Mode controlling concurrent invocation behavior.
191191
Defaults to "throw" which raises ConcurrencyException if concurrent invocation is attempted.
192-
Set to "unsafe_reentrant" to skip lock acquisition entirely, allowing concurrent invocations
193-
(restores pre-locking behavior, use with caution).
192+
Set to "unsafe_reentrant" to skip lock acquisition entirely, allowing concurrent invocations.
193+
Warning: "unsafe_reentrant" makes no guarantees about resulting behavior and is provided
194+
only for advanced use cases where the caller understands the risks.
194195
195196
Raises:
196197
ValueError: If agent id contains path separators.

src/strands/types/agent.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,9 @@
1515
1616
Values:
1717
throw: Raises ConcurrencyException if concurrent invocation is attempted (default).
18-
unsafe_reentrant: Allows concurrent invocations without locking (unsafe, restores pre-lock behavior).
18+
unsafe_reentrant: Allows concurrent invocations without locking.
19+
20+
Warning:
21+
The ``unsafe_reentrant`` mode makes no guarantees about resulting behavior and is
22+
provided only for advanced use cases where the caller understands the risks.
1923
"""

0 commit comments

Comments
 (0)