Skip to content

Commit 920c48f

Browse files
committed
chore: add documentation for system_prompt setter and getter
1 parent 013a295 commit 920c48f

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

src/strands/agent/agent.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,12 +367,31 @@ def __init__(
367367

368368
@property
369369
def system_prompt(self) -> str | None:
370-
"""Get the system prompt."""
370+
"""Get the system prompt as a string for backwards compatibility.
371+
372+
Returns the system prompt as a concatenated string when it contains text content,
373+
or None if no text content is present. This maintains backwards compatibility
374+
with existing code that expects system_prompt to be a string.
375+
376+
Returns:
377+
The system prompt as a string, or None if no text content exists.
378+
"""
371379
return self._system_prompt
372380

373381
@system_prompt.setter
374382
def system_prompt(self, value: str | list[SystemContentBlock] | None) -> None:
375-
"""Set the system prompt and update internal content representation."""
383+
"""Set the system prompt and update internal content representation.
384+
385+
Accepts either a string or list of SystemContentBlock objects.
386+
When set, both the backwards-compatible string representation and the internal
387+
content block representation are updated to maintain consistency.
388+
389+
Args:
390+
value: System prompt as string, list of SystemContentBlock objects, or None.
391+
- str: Simple text prompt (most common use case)
392+
- list[SystemContentBlock]: Content blocks with features like caching
393+
- None: Clear the system prompt
394+
"""
376395
self._system_prompt, self._system_prompt_content = self._initialize_system_prompt(value)
377396

378397
@property

0 commit comments

Comments
 (0)